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

Turn on additional IntelliJ inspections and fix violations. #1323

Open
motlin opened this issue Apr 16, 2022 · 1 comment
Open

Turn on additional IntelliJ inspections and fix violations. #1323

motlin opened this issue Apr 16, 2022 · 1 comment
Assignees

Comments

@motlin
Copy link
Contributor

motlin commented Apr 16, 2022

It's been a while since we turned on additional IntelliJ inspections. There are many newly created inspections that are worth adding. Older inspections that were buggy have been fixed or got new options so we can configure them to have no false positives.

When turning on inspections, we currently have to make changes in two profiles, which correspond with two config files.

  1. Turn on the new inspection in .idea/inspectionProfiles/IDE.xml at the INSPECTION or WARNING severity. This makes the warnings visible in the text editor.
  2. Turn on the new inspection in one of .idea/inspectionProfiles/{1_Severe.xml,2_Inconsistent_Constructs.xml,3_Consistent_Style.xml,4_No_Auto_fix.xml} at the ERROR severity. This makes the error appear in one of the four relevant TeamCity builds.

There are a ew ways to approach the work. We could turn on the inspections one at a time. Alternatively, we could turn them all on at the WARNING severity first so the violations appear in TeamCity right away, then fix the violations, then change the severity to ERROR.

1_Severe.xml
This profile contains a few severe inspections.

2_Inconsistent_Constructs.xml

This profile contains inspections which flag constructs that are pointless, or a little bit wrong.

Add:

  • Method is identical to its super method
  • Constant on wrong side of comparison (constants go on the right)
  • Unused assignment
  • Redundant type cast
  • Collection declared by class, not interface
  • Type may be weakened (configured with our interfaces as stop classes)
  • Interface may be annotated as ‘@FunctionalInterface
  • ‘size() == 0’ can be replaced with ‘isEmpty()’

3_Consistent_Style.xml

This profile contains inspections which flag constructs that are redundant or inconsistent. There is plenty over overlap with profile (2). When in doubt, inspections that affect the bytecode go into (2) and inspections that don't go into (3).

Add:

  • Explicit type argument T can be replaced with <>
  • Missing ‘@OverRide’ annotation
  • Commented out code
  • ‘if’ statement can be replaced with conditional or boolean expression
  • Redundant ‘if’ statement

4_No_Auto_fix.xml

This profile contains inspections which have warnings but no auto-fixes. These are more difficult to fix and must be used sparingly. Examples include naming conventions, where an author has to stop and pick a name.

@goldbal330
Copy link
Contributor

I could work on it.

@motlin motlin assigned motlin and goldbal330 and unassigned motlin Apr 25, 2022
goldbal330 added a commit to goldbal330/eclipse-collections that referenced this issue Apr 25, 2022
…ollections#1323

Signed-off-by: Alexander Goldberg <alexander.goldberg@bnymellon.com>
donraab added a commit that referenced this issue Apr 26, 2022
Turn on additional IntelliJ inspections and fix violations. #1323
goldbal330 added a commit to goldbal330/eclipse-collections that referenced this issue Dec 5, 2022
… identical to its super method). eclipse-collections#1323

Signed-off-by: Alexander Goldberg <alexander.goldberg@bnymellon.com>
goldbal330 added a commit to goldbal330/eclipse-collections that referenced this issue Dec 5, 2022
… identical to its super method). eclipse-collections#1323

Signed-off-by: Alexander Goldberg <alexander.goldberg@bnymellon.com>
goldbal330 added a commit to goldbal330/eclipse-collections that referenced this issue Dec 5, 2022
… identical to its super method). eclipse-collections#1323

Signed-off-by: Alexander Goldberg <alexander.goldberg@bnymellon.com>
goldbal330 added a commit to goldbal330/eclipse-collections that referenced this issue Dec 9, 2022
… out code). eclipse-collections#1323

Signed-off-by: Alexander Goldberg <alexander.goldberg@bnymellon.com>
goldbal330 added a commit to goldbal330/eclipse-collections that referenced this issue Jan 4, 2023
… out code). eclipse-collections#1323

Signed-off-by: Alexander Goldberg <alexander.goldberg@bnymellon.com>
goldbal330 added a commit to goldbal330/eclipse-collections that referenced this issue Jan 13, 2023
…f). eclipse-collections#1323

Signed-off-by: Alexander Goldberg <alexander.goldberg@bnymellon.com>
goldbal330 added a commit to goldbal330/eclipse-collections that referenced this issue Jan 13, 2023
…lse). eclipse-collections#1323

Signed-off-by: Alexander Goldberg <alexander.goldberg@bnymellon.com>
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

No branches or pull requests

2 participants