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

Fixed some SonarCloud issues from the complete code analysis #49

Merged
merged 53 commits into from
Apr 2, 2024

Conversation

JonasSchaub
Copy link
Collaborator

No description provided.

@JonasSchaub JonasSchaub self-assigned this Mar 4, 2024
@JonasSchaub JonasSchaub mentioned this pull request Mar 7, 2024
* production:
  Fix javadoc
  Add try-catch-block to sorting method
  Refine javadoc
  Add javadoc
  Fix Spotless requirements
  Optimize imports
  Change SortType to boolean
  Add enums to TableViews
  Add javadoc
  Add enum for data model properties
  Fix javadoc
  Change sort type to enum of TableColumn

# Conflicts:
#	src/main/java/de/unijena/cheminf/mortar/controller/HistogramViewController.java
…ewToolsManager, making fields in MainMenuBar and FragmentsdataTableView final, adjusting some regex patterns, some manual linting, more documentation on how reflection is used to fill the data tables;
@@ -252,7 +251,7 @@ public static void guiBindControlSizeToParentPane(Pane aParentPane, Control aChi
* @return GUI input pattern for integer values
*/
public static Pattern getIntegerPattern(){
return Pattern.compile("-?(([1-9][0-9]*)|0)?");
return Pattern.compile("-?(([1-9]\\d*)|0)?");
Copy link
Owner

Choose a reason for hiding this comment

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

Be careful with this, [0-9] is not always equivalent to \d

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for noticing! I think I'm going to reverse this anyway since [0-9] is more straightforward for people not dealing with regex every day (i.e. me and potential students)...

…c display name of an enum constant; prepared the property-using classes like fragmenters, settings container, and view tools for its usage, i.e. no enum.valueof() calls anymore;
…wraps an enum constant with associated display name and tooltip to be used in the GUI; started replacing SimpleEnumConstantNameProperty settings with the new property;
…layEnumConstantProperty settings; implemented a central method for tooltip generation with max width and text wrap;
…enceContainer.delete(String); switched FileUtil.deleteFile() to nio files; changed fail behaviour of time stamp methods;
…s and check of properties for preference restrictions to PreferenceUtil for SettingsContainer, FragmentationService, and ViewToolsManager;
@JonasSchaub
Copy link
Collaborator Author

To do: Write changelog and then merge.

@JonasSchaub JonasSchaub marked this pull request as ready for review March 27, 2024 16:21
…te about JavaFx info message in log file when reducing the rows per page setting;
@JonasSchaub
Copy link
Collaborator Author

To do: separate names and display names of fragmenters.

Copy link

sonarcloud bot commented Apr 2, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
81 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
2.1% Duplication on New Code

See analysis details on SonarCloud

@JonasSchaub
Copy link
Collaborator Author

Complete changelog of this branch / pull request:

  • Fixed all the "bugs" that SonarCloud reported (https://sonarcloud.io/summary/overall?id=FelixBaensch_MORTAR): putting readers and writers in try-with-resources blocks, logic error in PreferenceContainer.addWithoutChecks(), retrieval of example parent molecule in FragmentDataModel, preventing possible division by zero in FragmentationService, better handling of InterruptedExceptions at ExecutorService shutdown
  • Went through the issues / code smells SonarCloud detected (https://sonarcloud.io/project/issues?resolved=false&types=CODE_SMELL&id=FelixBaensch_MORTAR) one-by-one in the following
  • Most strings like log messages are now formatted correctly instead of using string concatenation
  • Improved casting and typing in most places
  • Corrected some variable naming in HistogramViewController
  • Introduced a configuration properties file to read resource paths from, e.g. for the MORTAR logo or settings dir
  • throwing defined exception types instead of general ones in some places
  • Manual code linting and additional documentation
  • Removed unused param according to Unused parameter #52
  • Made sure all buttons have the same sizes
  • Defined general font size
  • Abbreviated export button labels and exchanged histogram button label with plot
  • Renamed and restructured method to get items of active tab in MainViewController
  • Encapsulated the custom pagination with suitable page count creation into a separate method in MainViewController
  • Separated overview view setting for first structure highlight and jumping to molecule in molecules tab enabled in OverviewViewController
  • made many class variables explicitly final that could be final anyway
  • Added more assertions to test classes
  • Added check for successful initialization of Configuration to MainApp.start()
  • Fixed bug that items tab was not sortable by name (unmodifiable list in the background)
  • Refactored DepictionUtil.depictBufferedImageWithZoom()
  • Overhaul of exporter, mostly exception treatment (more is passed on to export thread now, so that it fails properly)
  • CSV export methods return list of faulty molecules now as well
  • Fixed bug in items tab PDF export, number of fragments in header was not correct but same as number of molecules
  • A few changes and additions in headers of exported files
  • Changed CSV export separator char from being set directly to an enum constant defining the character
  • Introduced separate display names for settings (general and for fragmenters)
  • Defined fixed size for combo boxes in the settings views
  • Added SimpleIDisplayEnumConstantProperty as new JavaFX property that wraps an enum constant with associated display name and tooltip to be used in the GUI and replaced all SimpleEnumConstantNameProperty settings with SimpleIDisplayEnumConstantProperty settings
  • Implemented a central method for tooltip generation with max width and text wrap
  • Updated spotless
  • Moved openFilePathInExplorer() to FileUtil
  • Added a MORTARException class but ended up not using it yet
  • Fixed possible eternal loop in PreferenceContainer.delete(String)
  • Switched FileUtil.deleteFile() to nio files
  • Changed fail behaviour of time stamp methods
  • Reduced duplication by moving translation of preferences to properties and check of properties for preference restrictions to PreferenceUtil for SettingsContainer, FragmentationService, and ViewToolsManager
  • Added separate display names to fragmenters for usage in GUI
  • Changed integer and double filters of settings view text fields to positive value filter including zero

@JonasSchaub JonasSchaub merged commit 9652b9d into production Apr 2, 2024
2 checks passed
@JonasSchaub JonasSchaub deleted the sonar-issues-fix branch April 2, 2024 12:21
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.

2 participants