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 severity to CodeClimate export #3356

Merged
merged 1 commit into from
Jun 18, 2021

Conversation

jmalmari
Copy link

As requested in #3342 (comment)

Copy link
Contributor

@csordasmarton csordasmarton left a comment

Choose a reason for hiding this comment

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

Thank you for this patch 😊 I have some comments on it. If these are fixed and test cases are passed we can merge it.

@@ -638,7 +638,7 @@ def parse_convert_reports(input_dirs: List[str],

number_of_reports = len(all_reports)
if out_format == "codeclimate":
return codeclimate.convert(all_reports), number_of_reports
return codeclimate.convert(all_reports, severity_map), number_of_reports
Copy link
Contributor

Choose a reason for hiding this comment

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

Pylint complains that this line is too long:

codechecker_analyzer/cmd/parse.py:641:80: E501 line too long (80 > 79 characters)
make[1]: *** [pycodestyle] Error 1

Could you please fix this problem?

Copy link
Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 29 to 33
'UNDEFINED': 'info',
'LOW': 'minor',
'STYLE': 'minor',
'MEDIUM': 'high',
'HIGH': 'critical',
Copy link
Contributor

Choose a reason for hiding this comment

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

We have the following severity levels:

  • Critical
  • High
  • Medium
  • Low
  • Style
  • Unspecified

So I recommend to change this map to this one:

Suggested change
'UNDEFINED': 'info',
'LOW': 'minor',
'STYLE': 'minor',
'MEDIUM': 'high',
'HIGH': 'critical',
'CRITICAL': 'critical',
'HIGH': 'major',
'MEDIUM': 'minor',
'LOW': 'minor',
'STYLE': 'info',
'UNSPECIFIED': 'info'

What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, thanks. I have no idea where I got the high from.

Copy link
Author

Choose a reason for hiding this comment

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

fixed

"""Convert a Report to Code Climate format."""
return {
"type": "issue",
"check_name": report.check_name,
"description": report.description,
"categories": ["Bug Risk"],
"fingerprint": report.report_hash,
"severity": __codeclimate_severity_map.get(
Copy link
Contributor

Choose a reason for hiding this comment

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

Some test cases are failed.

Could you please fix these test cases?

Copy link
Author

Choose a reason for hiding this comment

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

fixed, though I couldn't run test_functional all the way. I don't have db set up for it.

@@ -638,7 +638,7 @@ def parse_convert_reports(input_dirs: List[str],

number_of_reports = len(all_reports)
if out_format == "codeclimate":
return codeclimate.convert(all_reports), number_of_reports
return codeclimate.convert(all_reports, severity_map), number_of_reports
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the convert function here with the serverity map:

cc_reports = codeclimate.convert(reports)

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@jmalmari jmalmari force-pushed the codeclimate-severity branch from ca9f933 to 45dfd69 Compare June 11, 2021 18:42
@csordasmarton csordasmarton added analyzer 📈 Related to the analyze commands (analysis driver) CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands labels Jun 14, 2021
@csordasmarton csordasmarton added this to the release 6.17.0 milestone Jun 14, 2021
Copy link
Contributor

@csordasmarton csordasmarton left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you very much for your time and your patch. We really appreciate it 😊

@csordasmarton csordasmarton merged commit 96578ba into Ericsson:master Jun 18, 2021
bachp pushed a commit to bachp/meta-codechecker that referenced this pull request Aug 11, 2021
The severity field is needed by Gitlab-CI to process codeclimate
report. This commit patch the current version of codechecker with
the change introduced upstream with this pull request:
Ericsson/codechecker#3356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📈 Related to the analyze commands (analysis driver) CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants