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

Support GitLab Code Quality report format #803

Merged
merged 2 commits into from
Nov 26, 2023

Conversation

Johnnei
Copy link
Contributor

@Johnnei Johnnei commented Nov 20, 2023

Add support to output GitLab Code Quality report format (Fixes #775).

Note: On multi module projects this will need support from the preferred build tool or trick (cat + jq?) to aggregate the jsons into one json.

The report requires project root relative paths to get correct links in the widgets. To this I used CI_PROJECT_DIR (https://docs.gitlab.com/ee/ci/variables/predefined_variables.html). If this turns out to not be flexible enough then maybe it could still become a config option for the report.

@codecov-commenter
Copy link

codecov-commenter commented Nov 20, 2023

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (9f33cec) 87.07% compared to head (055d6a1) 86.75%.

Files Patch % Lines
...l/scapegoat/io/GitlabCodeQualityReportWriter.scala 74.19% 8 Missing ⚠️
...main/scala/com/sksamuel/scapegoat/io/IOUtils.scala 0.00% 1 Missing ⚠️
src/main/scala/com/sksamuel/scapegoat/plugin.scala 75.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #803      +/-   ##
==========================================
- Coverage   87.07%   86.75%   -0.33%     
==========================================
  Files         141      142       +1     
  Lines        1540     1578      +38     
  Branches      268      274       +6     
==========================================
+ Hits         1341     1369      +28     
- Misses        199      209      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Johnnei Johnnei force-pushed the support-gitlab-codequality branch from d17783d to df31199 Compare November 23, 2023 15:49
@Johnnei Johnnei changed the title Draft: Support GitLab Code Quality report format Support GitLab Code Quality report format Nov 23, 2023
@Johnnei Johnnei force-pushed the support-gitlab-codequality branch from df31199 to 7feec0b Compare November 23, 2023 15:53
@Johnnei Johnnei force-pushed the support-gitlab-codequality branch from 7feec0b to 3191d1f Compare November 23, 2023 16:04
@Johnnei
Copy link
Contributor Author

Johnnei commented Nov 23, 2023

@saeltz @mccartney Could you be so kind to review this PR?

I've done some basic tests on a (private) GitLab Ultimate instance to test the various features around Code Quality, and they look fine.

Copy link
Collaborator

@saeltz saeltz left a comment

Choose a reason for hiding this comment

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

Thanks for your work!

Comment on lines 29 to 30
val fingerprint = MessageDigest
.getInstance("MD5")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe extract the MessageDigest to only have one instance instead of initialising one for every warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As MessageDigest is stateful and not thread safe, I've moved it to the outer loop so it at least re-uses the instance for an entire report.

@Johnnei Johnnei force-pushed the support-gitlab-codequality branch from 78e0f29 to 055d6a1 Compare November 26, 2023 08:42
@saeltz saeltz merged commit 3ffcca4 into scapegoat-scala:master Nov 26, 2023
9 checks passed
@Johnnei Johnnei deleted the support-gitlab-codequality branch November 26, 2023 10:08
@gaeljw
Copy link

gaeljw commented Nov 26, 2023

Thanks @Johnnei 👍

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.

Support Gitlab / Clodeclimate report format
4 participants