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

Deprecate rules overlapping with SQ or deprecated in SpotBugs #386

Merged
merged 7 commits into from
Nov 22, 2021

Conversation

gtoison
Copy link
Contributor

@gtoison gtoison commented Sep 2, 2021

The spotbugs rules metadata contains an optional 'deprecated' flag but it is currently ignored by the plugin.
SQ rules have a 'status' attribute which can be set to DEPRECATED.

The purpose of this PR is to set the status to DEPRECATED for deprecated spotbugs rules.
Apparently there are no deprecated rules in FB-contrib or FSB

  • Read the 'deprecated' rules in the spotbugs metadata and add a SQ
    status for deprecated rule
  • Regenerated the rules metadata
  • Added a unit test to check that the status is read from the metadata

gtoison and others added 3 commits September 2, 2021 19:44
- Read the 'deprecated' rules in the spotbugs metadata and add a SQ
status for deprecated rule
- Regenerated the rules metadata
- Added a unit test to check that the status is read from the metadata
Mark rules as deprecated when there's a native SonarQube rule providing
overlapping function. Update the description to include a link to the
SonarQube rule
@gtoison
Copy link
Contributor Author

gtoison commented Sep 7, 2021

Hello,

I've added changes to address issue #304 by marking some issues as deprecated, there's a link pointing to the native SonarQube rule in the description:
image

@KengoTODA I also took the liberty to incorporate commit 22f3eab , it was never merged into the master but it makes the update of the rules metadata easier.

I think this PR can be reviewed at this point, let me know if this needs further work

@gtoison gtoison changed the title Issue #366 deprecated rules Deprecate rules overlapping with SQ or deprecated in SpotBugs Sep 7, 2021
@reitzmichnicht
Copy link

I think the replacement rules description all have to change from squid: to java:, otherwise at least with modern sonarqube versions the links might not work

@gtoison
Copy link
Contributor Author

gtoison commented Sep 18, 2021

@reitzmichnicht I think you're right I've tested by adding the SQ java plugin (on a bare SQ) and it worked but when testing with SQ + built-in plugins it should be java: and not squid:
SonarSource seems to using the language key, not squid: for instance here: https://github.com/SonarSource/sonar-php/blob/master/php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S2277.html

USBR_UNNECESSARY_STORE_BEFORE_RETURN has false positives with instanceof
pattern matching: if (x instanceof ABC a) return a;
@gtoison gtoison requested a review from pethers November 22, 2021 11:56
@gtoison gtoison merged commit 2a1cbcd into spotbugs:master Nov 22, 2021
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