-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactoring and enhancements for codebase excellence #97
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Deleted all properties files * Initial new property file called `setup.properties` * Now all setup properties will be in `setup.properties` file and no longer used the XML file
* Deleted the `OSUtils.java` (this class are no longer used) * Moved all internal classes to directory (package) called `internal` * Renamed the `Options` class to `JMatrixUtils`, improving clarity
* Changed the main class to `MainClass.java` * Introduced a new final class called `ArgumentsParser` in main class * Added several new methods to `ArgumentsParser` class, including: - `contains` - `get` - `getArguments` - `iterator` (from `Iterable` interface)
This class provides methods to parse the properties file with ease. Please note, do not use constructor to create an instance of this class, use the `load(String)` (static) method instead and use the `getProperties` method (after created the instance class) to get the instance of Properties (including all properties data) from this instance. For example: PropertiesParser propsParser = PropertiesParser.load("config.properties"); Properties configProps = propsParser.getProperties();
This class provides access to get the database from the setup properties file. This class is designed to be synchronized and thread-safe. Its access modifier is "package" and will only be visible to the package it is stored in. The setup properties are retrieved from the file statically using the `static` block, which means that when the program starts it will immediately retrieve the properties from the file. So this class only provides access to the property data. Example usage: Properties setupProps = SetupProperties.getSetupProperties();
* Added javadocs for all classes in `PropertiesParser.java` * Added and updated some javadoc in `MainClass.java` * Removed test code in `main` method
Decativated due to maintaining the internal code. This CI will also be improved to support with future changes.
The errors is occurred due to missing some variables, error imports, and etc.
Removed several checks from checking the setup properties file This will only occurs error because the `File` class checks the file from the current directory. Replaced by checking the `InputStream` whether it is null, null is indicates that InputStream cannot found the specified file inside JAR's directory tree.
The setup properties parser has improved in several factors, one of which is checking the existence of the file.
* Added new method called `getFirstArgument` that gets the first known argument. The known arguments in this changes (the arguments are not different with the previous ones): "-V", "--version", "ver", "version" : Display the JMatrix version "-cr", "--copyright", "copyright" : Display the copyright and license * Added several necessary private members
* Added documentations for undocumented members * Bump version for classes that has been modified For `ArgumentsParser` class, it has been modified but forgot to bump the version. See 3415b74
Deleted `build.resources` (default) and replaced to use the Maven Resources Plugin for reliability and ensure the properties encoding are specified with `propertiesEncoding` configuration. Additionally, all necessary files also would be copied during validation using of goal `copy-resources`.
We resolved this by adding a new file to separate SetupProperties class from the public one, its name the same as its contained class.
Now it uses the SetupProperties class to get the program name instead. In addition, we also added the Javadoc for undocumented variables.
* Added a new variable to holds several help arguments * Included the `helpArgs` to all known arguments in `getFirstArgument` method * Introduced a new private function to print the help message
* If no arguments specified, print the help message then return * Implemented the help arguments checker * Added a capability to print the version only by specifying "--version-only" as first argument
* Removed old Python files and replaced with the new builder * Now the builder will not inside 'src/main/python', instead it moved to 'tools' directory, which more concise directory name. * Removed the 'requirements.txt' in the root directory, replaced with the JMBuilder's one (within its root directory) Repo: https://github.com/mitsuki31/JMBuilder.git Pages: https://mitsuki31.github.io/JMBuilder
Several changes and overrides configuration has been made which from .pylintrc of JMBuilder package
This module includes functions to calculate MD5 hashes, verify hashes, set up and retrieve information from a parsed POM file, and handle the main execution of the script to retrieve and print values based on user input. Syntax: $ python scripts/retriever.py <KEY> Example: $ python scripts/retriever.py project.name JMatrix
* The properties setup now utilizes the 'scripts/retriever.py' Python script to retrieve necessary project information * Replaced the `$(shell pwd)` code to get the current directory with CURDIR variable instead * Initialization of required files, e.g. MANIFEST.MF, has been added and its utilizes the JMBuilder to initiate and fix that files * Further improvements and refactors also has been made to make the Makefiles compatible with the new builder and works as expected
Added imports checker when importing the Setup.mk, this way the module will be imported only when the user only when the user specifies targets, excluding 'help', or when specified nothing. This approach optimizes performance. In addition with this commit, refactored the 'help' rule, added 'Makefile' to .PHONY target, and also added license information on the header message.
Introduced two method to convert ISO formatted date to local date: * dateISOToLocal(String, String) * dateISOToLocal(String)
* Updated the copyright year * Added the built time on version information
* Updated and improved several info message for clarity * Refactored all custom flags to use ";" instead of "@:" to define empty rule * Now the 'clean' target will use all cleaners, this to make the output directory of generated HTML docs is also completely deleted during cleaning the project
Replaced the "com.mitsuki.jmatrix.util" with "com.mitsuki.jmatrix.internal". And also changed the assignment operator for all internal options.
We also updated the excluded packages to "com.mitsuki.jmatrix.internal".
* Now both tests (Maven and Make) will runs on 3 platforms, they are Ubuntu, Windows, and MacOS. * Refactored and improved jobs setup * Updated several dependencies to the latest major version * Several changes and improvements
The implemented code inside Makefiles are intended to run only in UNIX systems, as we got some errors on Windows system. For across platform, you can take the Maven to build the project.
mitsuki31
added
documentation
Improvements or additions to documentation
enhancement
Enhancing existing features
lang:java
Some changes on Java code
lang:python
Some changes on Python code
minor
Minor update
feature
Add new features to improve the project
labels
Feb 1, 2024
2 tasks
mitsuki31
removed
chore
Maintenance updates (e.g Github Actions)
documentation
Improvements or additions to documentation
labels
Feb 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
Enhancing existing features
feature
Add new features to improve the project
lang:java
Some changes on Java code
lang:python
Some changes on Python code
minor
Minor update
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request incorporates a comprehensive set of refactoring, optimization, and enhancement initiatives designed to elevate the codebase in terms of clarity, maintainability, testing resilience, documentation, and overall performance.
Changes Made
Structural Refactoring for Enhanced Logic and Efficiency:
Comprehensive Testing and Cross-Platform Compatibility:
Robust Documentation for Clarity and Guidance:
Streamlined Development with Upgraded Builder:
Performance Optimization for Enhanced Responsiveness:
Improved Argument Parsing for Flexibility and Ease of Use:
Additional Refinements for Code Integrity and Maintainability
Absolute paths have been strategically replaced with relative paths in Makefiles imports, promoting more efficient imports and reducing potential module conflicts, ensuring smooth code execution and collaboration.
Warnings due to unspecified encoding have been proactively addressed to ensure code consistency and maintainability, adhering to best practices and preventing future issues.
Setup properties have been consolidated into a single, centralized file (
setup.properties
) for better organization and clarity, fostering easier configuration and management.Changelogs
Each commit within this pull request addresses a specific aspect of the aforementioned changes. Please refer to the accompanying changelog for detailed commit descriptions.
Changelogs: cb7e47f...2a2f7ad
Summary
This pull request signifies a significant step forward in codebase quality and maintainability. The implemented enhancements ensure a more logical structure, robust testing, improved performance, clear documentation, and a streamlined development experience.