Random code cleanup tasks
See original GitHub issueHere is a list of code quality improvements/checks that I had in my todo list. I’ve purposely kept them in one issue because we have a lot of issues already. Feel free to add to this or provide feedback.
-
Verify that calls to
addListener
have a correspondingremoveListener
-
Replace
Exceptions.printStackTrace
traces withjava.util.logger
-
Replace numbers with constants that call
Insets
method and perhaps make them available in a utility class so others can -
Review methods and arguement naming conventions in
StringUtilities
- havingString string
may be undesirable -
Make a utility class to display
DialogDisplayer
errors instead of doing this for example:
final NotifyDescriptor nd = new NotifyDescriptor.Message("The provided URL is invalid.", NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(nd);
- Use
StringUtils.isBlank()
instead of the following:
!= null && !.isEmpty() everywhere.
isEmptyOrNull()
- Search replace “,” with SeperatorConstants.COMMA etc.
Annotate @nothreadsafe methods- Not currently looking to pursue this throughout the whole codebase - new PRs can try to stick to this style if it helps dev.Integrate JSR-305~~* use @notnull etc ~~SonarQube suggestions- Removed from list as this is covered in other Sonar related tickets.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Clean Code Cleanups - 10Pines | Blog
Code cleanup goes smoothly if we have a strategy. If you start deleting code randomly, it's very likely to leave things out.
Read more >Code Cleanup: When Your Work Is Undoing Other People's ...
My general advice for such cases is: Do Not Over-cleanup. This whole work is a tradeoff — you'll clean up 100 more lines...
Read more >Code Cleanup: 7 Simple Daily Steps That Pay off in the End
We'll present seven simple code cleanup tasks that you can perform daily, to keep your codebase readable, easy to navigate, and maintain. We...
Read more >7 Tips To Write Clean And Better Code in 2020 - GeeksforGeeks
How to Write Clean and Better Code? 1. Use Meaningful Names. You will be writing a lot of names for variables, functions, classes, ......
Read more >Clean Code Cheat Sheet - planetgeek.ch
Isolated testee: Clear where the failure happened. Isolated test: No dependency between tests (random order). Repeatable. +. No assumed initial state ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@aldebaran30701 actually my motivation was GC/memory/performance related. If I do a search for
addListener
in the code base I get 179 results andremoveListener
has just 25 occurrences. I’m uneasy about those numbers. Following on from memory cleanup work a while back, I noticed that if I closed a view like the Attribute Editor, not all of the memory it has been using is released, even if you wait for GC to do it’s thing. I’d like to explore the idea of removing Listeners when the views are closed and see if that helps.Noted that the memory myth looks busted in their example but our code base in way more complicated and my thought is that we can help Java a bit my removing listeners when we don’t need them. I could be wrong though because I’m not an expert on this topic.
This issue is stale because it has been open for 6 months with no activity. Consider reviewing and taking an action on this issue.