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

Allow repos to use Sonar to manage clean code, fix warnings #98

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

bernhardkaindl
Copy link
Collaborator

@bernhardkaindl bernhardkaindl commented Mar 22, 2024

Optionally allow repos to use Sonar to manage clean code and fix Sonar warnings

  • Fix warnings from sonarlint and Sourcery
  • Update configuration to be compatible with sonarcloud
  • When the SONAR_TOKEN variable is added to a repo, sonarcloud can help to review pull requests.
    • It can (optionally) add a pull request comment that looks like this:

Quality Gate Passed Quality Gate passed

Issues

Measures


Example PR comment by Sonarcloud:
xenserver-next#26 (comment)

  • xen-bugtool's code is very clean at the moment, and this PR should help to test sonarcloud.

  • Code coverage (also checked by sonarcloud for this PR) confirms that the changed lines in xen-bugtool and the unit tests are already covered by existing unit tests that cover 90% of the code.

  • I checked if the change to disk_list() is indeed tested: Yes it is:

Here is the documentation for the used GitHub action:
https://github.com/SonarSource/sonarcloud-github-action?tab=readme-ov-file

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

Merging #98 (a76f121) into master (d0e569d) will increase coverage by 2%.
Report is 16 commits behind head on master.
The diff coverage is 100%.

Additional details and impacted files
@@          Coverage Diff          @@
##           master    #98   +/-   ##
=====================================
+ Coverage      88%    91%   +2%     
=====================================
  Files          18     18           
  Lines        2196   2211   +15     
=====================================
+ Hits         1939   2017   +78     
+ Misses        257    194   -63     
Files Coverage Δ
tests/integration/test_system_load.py 100% <100%> (ø)
tests/integration/test_xenserver_config.py 100% <ø> (ø)
tests/integration/utils.py 85% <ø> (ø)
tests/unit/conftest.py 100% <100%> (ø)
tests/unit/test_main.py 100% <100%> (ø)
tests/unit/test_output.py 100% <100%> (ø)
xen-bugtool 88% <100%> (+3%) ⬆️

... and 1 file with indirect coverage changes

Flag Coverage Δ
python2.7 96% <100%> (+9%) ⬆️
python3.10.13 91% <100%> (+3%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@bernhardkaindl bernhardkaindl force-pushed the add-sonarcloud branch 7 times, most recently from 064ea92 to c9cd952 Compare March 22, 2024 23:36
@coveralls
Copy link

coveralls commented Mar 22, 2024

Pull Request Test Coverage Report for Build 8420807166

Details

  • 23 of 23 (100.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-4.6%) to 90.354%

Totals Coverage Status
Change from base Build 8419300538: -4.6%
Covered Lines: 2042
Relevant Lines: 2260

💛 - Coveralls

@bernhardkaindl bernhardkaindl force-pushed the add-sonarcloud branch 5 times, most recently from 1d02833 to 91437ad Compare March 23, 2024 00:43
- Fix warnings from SonarLint, Codacy (e.g bandit), Sourcery
- Update configuration to be compatible with SonarCloud

Signed-off-by: Bernhard Kaindl <[email protected]>
@bernhardkaindl bernhardkaindl force-pushed the add-sonarcloud branch 7 times, most recently from 4992e34 to dcf9cf4 Compare March 23, 2024 02:46
@bernhardkaindl bernhardkaindl changed the title Add configuration for SonarLint and SonarCloud, fix sonar warnings Optionally allow repos to use Sonar to manage clean code and fix Sonar warnings Mar 23, 2024
@bernhardkaindl bernhardkaindl changed the title Optionally allow repos to use Sonar to manage clean code and fix Sonar warnings Allow repos to use Sonar to manage clean code, fix warnings Mar 23, 2024
ashwin9390
ashwin9390 previously approved these changes Mar 25, 2024
elif filetype == "tar":
tarfile.TarFile.open(filename).extractall(tmp_path)
tar = tarfile.TarFile.open(filename)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth using context managers here and line 205?

@bernhardkaindl bernhardkaindl merged commit 15ab34d into xenserver:master Mar 28, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants