Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0b2a23af
Commit
0b2a23af
authored
Jan 06, 2021
by
Erick Bajao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix parsing of empty sources in cobertura
parent
6bd1be63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
changelogs/unreleased/eb-fix-cobertura-empty-sources.yml
changelogs/unreleased/eb-fix-cobertura-empty-sources.yml
+5
-0
lib/gitlab/ci/parsers/coverage/cobertura.rb
lib/gitlab/ci/parsers/coverage/cobertura.rb
+1
-1
spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb
spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb
+6
-0
No files found.
changelogs/unreleased/eb-fix-cobertura-empty-sources.yml
0 → 100644
View file @
0b2a23af
---
title
:
Fix cobertura parser when there is an empty sources node
merge_request
:
50971
author
:
type
:
fixed
lib/gitlab/ci/parsers/coverage/cobertura.rb
View file @
0b2a23af
...
...
@@ -36,7 +36,7 @@ module Gitlab
end
def
parse_node
(
key
,
value
,
coverage_report
,
context
)
if
key
==
'sources'
&&
value
[
'source'
].
present?
if
key
==
'sources'
&&
value
&&
value
[
'source'
].
present?
parse_sources
(
value
[
'source'
],
context
)
elsif
key
==
'package'
Array
.
wrap
(
value
).
each
do
|
item
|
...
...
spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb
View file @
0b2a23af
...
...
@@ -224,6 +224,12 @@ RSpec.describe Gitlab::Ci::Parsers::Coverage::Cobertura do
it_behaves_like
'ignoring sources, project_path, and worktree_paths'
end
context
'when there is an empty <sources>'
do
let
(
:sources_xml
)
{
'<sources />'
}
it_behaves_like
'ignoring sources, project_path, and worktree_paths'
end
context
'when there is a <sources>'
do
context
'and has a single source with a pattern for Go projects'
do
let
(
:project_path
)
{
'local/go'
}
# Make sure we're not making false positives
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment