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

Code cleanup #133

Merged
merged 91 commits into from
May 15, 2024
Merged

Code cleanup #133

merged 91 commits into from
May 15, 2024

Conversation

lesquoyb
Copy link
Contributor

@lesquoyb lesquoyb commented Mar 20, 2024

I'm currently cleaning the code base helped by spotbugs and other code-analysis tools.
Feel free to participate if you want.
Also the scope of this rework is super wide so do not hesitate to review the parts of the code you have some knowledge over as I may (and surely will) introduce new bugs.

lesquoyb added 30 commits March 12, 2024 15:35
- Force typing instead of Object everywhere
- test for NPE in some forgotten cases
- Fix cast to NormStatement instead of Norm which resulted in runtime errors in probabilistic mode
Removes useless casts
- change division types inside Math.round to double so it's floating point division and not int
- convert Math.round results from long to int to fit the rest of the program
- removes useless Math.round (Once used as a cast to an int and the others probably as legacy)
- uses the equals method to compare objects of class Double instead of ==
- changes hard to read streams to get min and max by Collections.min and Collections.max
- avoid NPE in some cases
- move the code outside of any condition so the vertexSpecies is set no matter what
Because we already have the clone method so there's no reason not using the known interface
- use standard java casing
- some light comments improvements
- use of a record instead of a class for DisplayParametersStructure
- adding some final modifiers when it makes sense
- revert the record to use a static class instead
- renaming to follow java conventions
- "optimize" float parsing
- simplifies some code
- use StringBuilder in loops
- replace new String() by constant ""
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 116 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 118 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

lesquoyb added 2 commits May 14, 2024 10:32
- prevents a potential NPE + fixes a logical bug in bdi
- iterates over sets with entrySet instead of keySet when values are needed
- removes an unused variable in imagelayer
- switches a boxed variable to int in masked_by operator
- removes the fake bug for spotbugs to pickup on in LoopStatement
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 118 findings(s) 🚩
  • Improving Code Health: 238 findings(s) ✅
  • Affected Hotspots: 8 files(s) 🔥

View detailed results in CodeScene

@lesquoyb lesquoyb merged commit e335255 into 2024-06 May 15, 2024
4 of 5 checks passed
@lesquoyb lesquoyb deleted the code-cleanup branch May 15, 2024 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤗 Enhancement This is a request for enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants