Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XML generator for sonarqube generic coverage report #308

Closed
wants to merge 8 commits into from

Conversation

@akmll
Copy link
Contributor

akmll commented May 6, 2019

Add command line option '--sonarqube' with output report file name to generate sonarqube generic coverage report as described in https://docs.sonarqube.org/latest/analysis/generic-test/

@akmll akmll closed this May 6, 2019
@latk

This comment has been minimized.

Copy link
Member

latk commented May 6, 2019

Thank you for this PR, that looks fantastic. It is fine to leave the PR open while you work on it. The Travis test failures seem to only be about code style issues (unused variables).

What I need from you before I can merge:

  • Please add your name to the AUTHORS file
  • Please add a mention of this format to the README file.
  • The recent pull request #307 moves to the lxml backend which reduces memory usage. I think this would be a good idea here as well. If you run into any Python 2 vs 3 problems, it's fine if new features only work under 3.
  • I need at least one test case for the generator. This involves:
    1. creating a new target in the test's Makefile,
    2. running it manually to create the output file
    3. manually verifying the output
    4. moving the file into the test's reference folder
    5. extend the gcovr/tests/test_gcovr.py test runner to run this additional target if it is available

Please let me know if you run into any problems.

@latk latk reopened this May 6, 2019
@codecov

This comment has been minimized.

Copy link

codecov bot commented May 6, 2019

Codecov Report

Merging #308 into master will decrease coverage by 2.78%.
The diff coverage is 16.41%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
- Coverage   94.89%   92.11%   -2.79%     
==========================================
  Files          15       16       +1     
  Lines        1823     1890      +67     
  Branches      315      327      +12     
==========================================
+ Hits         1730     1741      +11     
- Misses         46      101      +55     
- Partials       47       48       +1
Impacted Files Coverage Δ
gcovr/configuration.py 97.22% <ø> (ø) ⬆️
gcovr/sonarqube_generator.py 15.87% <15.87%> (ø)
gcovr/__main__.py 91.21% <25%> (-1.84%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c018e2b...9c93208. Read the comment docs.

2 similar comments
@codecov

This comment has been minimized.

Copy link

codecov bot commented May 6, 2019

Codecov Report

Merging #308 into master will decrease coverage by 2.78%.
The diff coverage is 16.41%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
- Coverage   94.89%   92.11%   -2.79%     
==========================================
  Files          15       16       +1     
  Lines        1823     1890      +67     
  Branches      315      327      +12     
==========================================
+ Hits         1730     1741      +11     
- Misses         46      101      +55     
- Partials       47       48       +1
Impacted Files Coverage Δ
gcovr/configuration.py 97.22% <ø> (ø) ⬆️
gcovr/sonarqube_generator.py 15.87% <15.87%> (ø)
gcovr/__main__.py 91.21% <25%> (-1.84%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c018e2b...9c93208. Read the comment docs.

@codecov

This comment has been minimized.

Copy link

codecov bot commented May 6, 2019

Codecov Report

Merging #308 into master will decrease coverage by 2.78%.
The diff coverage is 16.41%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
- Coverage   94.89%   92.11%   -2.79%     
==========================================
  Files          15       16       +1     
  Lines        1823     1890      +67     
  Branches      315      327      +12     
==========================================
+ Hits         1730     1741      +11     
- Misses         46      101      +55     
- Partials       47       48       +1
Impacted Files Coverage Δ
gcovr/configuration.py 97.22% <ø> (ø) ⬆️
gcovr/sonarqube_generator.py 15.87% <15.87%> (ø)
gcovr/__main__.py 91.21% <25%> (-1.84%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c018e2b...9c93208. Read the comment docs.

@codecov

This comment has been minimized.

Copy link

codecov bot commented May 6, 2019

Codecov Report

Merging #308 into master will decrease coverage by 0.18%.
The diff coverage is 88.46%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
- Coverage   94.89%   94.71%   -0.19%     
==========================================
  Files          15       16       +1     
  Lines        1823     1874      +51     
  Branches      315      324       +9     
==========================================
+ Hits         1730     1775      +45     
- Misses         46       49       +3     
- Partials       47       50       +3
Impacted Files Coverage Δ
gcovr/configuration.py 97.22% <ø> (ø) ⬆️
gcovr/tests/test_gcovr.py 97.75% <100%> (ø) ⬆️
gcovr/__main__.py 93.24% <100%> (+0.18%) ⬆️
gcovr/sonarqube_generator.py 87.23% <87.23%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c018e2b...d83b899. Read the comment docs.

@akmll akmll force-pushed the akmll:master branch from 9c93208 to 20f46a9 May 6, 2019
@akmll akmll closed this May 6, 2019
@akmll akmll reopened this May 6, 2019
@akmll

This comment has been minimized.

Copy link
Contributor Author

akmll commented May 6, 2019

Sorry, I didn't notice it was reopened. I am quite a newbie in python so this might take time, and I use msys2 on windows, it seems some of the test cases would fail.

@latk

This comment has been minimized.

Copy link
Member

latk commented May 6, 2019

akmll added 5 commits May 6, 2019
The error is cause by in-consistent output of different gcc versions
@akmll

This comment has been minimized.

Copy link
Contributor Author

akmll commented May 10, 2019

Finally I have made the unit tests to success. The uncovered lines of code share across the generators, so I think it is OK.

I have tested the generator with a real project under enterprise environment and it works like a charm, the coverage information is just the same as the html report generated.

I read in the PR #307 that the memory usage is high with xml.minidom. I was thinking about generating the xml text directly since the format is rather simple. I am not very familiar with python, so I am not sure if that would help.

Another thing needs to mention is that there is no stdout print option for this sonarqube generator, I could add it easily if there is such scenario.

@latk
latk approved these changes May 11, 2019
Copy link
Member

latk left a comment

This looks great! I'll probably fiddle a bit with the details while merging, but all the necessary stuff is there now. Thank you for working on this :)

latk added a commit to latk/gcovr that referenced this pull request May 25, 2019
latk added a commit to latk/gcovr that referenced this pull request May 25, 2019
latk added a commit to latk/gcovr that referenced this pull request May 25, 2019
@latk

This comment has been minimized.

Copy link
Member

latk commented May 25, 2019

OK, I've merged this manually! I decided not to use the string-based output generation but rather ported to lxml. Your idea to pass the output file name via --sonarqube rather than -o was good, so I added that to all other formats as well.

Thanks again for working on this!

@latk latk closed this May 25, 2019
@misery misery referenced this pull request Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.