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

Refactoring and enhancements for codebase excellence #97

Merged
merged 37 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cb7e47f
Reorganize the properties files
mitsuki31 Sep 14, 2023
8a62268
Deletion, rename and reorganize the internal packages
mitsuki31 Sep 16, 2023
bcf1f17
Refactor the main class
mitsuki31 Sep 16, 2023
49266ca
Introduce `PropertiesParser` a new parser class
mitsuki31 Sep 16, 2023
51c8d88
Introduce `SetupProperties` subclass in `PropertiesParser`
mitsuki31 Sep 16, 2023
3415b74
Javadocs addition and changes
mitsuki31 Sep 17, 2023
ae0eb2d
Temporarily deactivate the `tests` CI
mitsuki31 Sep 17, 2023
7deda92
Fix several errors during compilation
mitsuki31 Sep 17, 2023
bd8d304
Fix errors during properties initializer
mitsuki31 Sep 17, 2023
bcd0b0e
Enhance the setup properties parser
mitsuki31 Sep 17, 2023
edc1672
Refactor the main method on parsing several arguments
mitsuki31 Sep 17, 2023
20935c6
Add the javadocs for undocumented members
mitsuki31 Sep 17, 2023
c32307d
Fix warning due to unspecified encoding
mitsuki31 Dec 12, 2023
86bbddd
Fix main class attempt to access package-private
mitsuki31 Dec 12, 2023
120e588
Refactor the `JMatrixUtils` class
mitsuki31 Dec 12, 2023
d34c165
Introduce a new list of help args and function
mitsuki31 Dec 12, 2023
ce3b224
Refactor the command-line arguments checker
mitsuki31 Dec 12, 2023
de53e2b
Add link reference for issues on help message
mitsuki31 Dec 13, 2023
2f257e6
Install the JMBuilder as project builder utilizes Python
mitsuki31 Jan 5, 2024
9d7c485
Update the PyLint config file
mitsuki31 Jan 5, 2024
12a8ffb
feat: Add retriever module for POM information retrieval
mitsuki31 Jan 6, 2024
645299d
refactor: Update the internal Makefiles in make directory
mitsuki31 Jan 7, 2024
f5a768f
refactor: Add imports checker in Makefile to optimize performance
mitsuki31 Jan 7, 2024
add3ccf
feat: Add some method for date utilities
mitsuki31 Jan 8, 2024
9e733e5
refactor: Add the inception year property
mitsuki31 Jan 8, 2024
9a37144
refactor: Add some new information on message
mitsuki31 Jan 8, 2024
10a4f22
refactor: Update and refine the help message
mitsuki31 Jan 8, 2024
4d44f4c
Refactor and update the info message
mitsuki31 Jan 8, 2024
f596e91
docs: Update and improve the docs of `dateISOToLocal`
mitsuki31 Jan 9, 2024
464f09f
fix: Replace absolute to relative path for imports efficiency
mitsuki31 Jan 10, 2024
533f6fe
refactor: Update the excluded packages list
mitsuki31 Jan 10, 2024
813fafb
refactor: Delete and add some properties
mitsuki31 Jan 11, 2024
6145636
ci: Reactivate and improve the Test workflow
mitsuki31 Jan 11, 2024
42f40a9
Fix CI tests error and invalid workflow
mitsuki31 Jan 31, 2024
e5e93e5
Fix unrecognized Java semVer and improve deps caching
mitsuki31 Jan 31, 2024
2a2f7ad
Make tests only for *NIX systems
mitsuki31 Jan 31, 2024
ee404ab
Merge branch 'master' and resolve conflicts
mitsuki31 Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 59 additions & 79 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Project Tester
name: Test

on:
# Run on push, pull request, and manual trigger
push:
# Only run when the specific files are changed
paths:
- 'src/**/*.java' # Java files
- 'src/**/*.py' # Python files
- '**/*.java' # Java files
- '**/*.py' # Python files

# Unlike push, the workflow always runs on pull requests
pull_request:
Expand All @@ -20,20 +20,34 @@ on:
required: false
type: boolean

# Environment variables definitions
env:
## For Java installation
java-dist: temurin

## For Python installation
arch: x64

## Other environments
debug: ${{ inputs.debug }}
deps: requirements.txt

jobs:
# ::---:: Maven Test ::---:: #
maven-test:
name: Maven Test / ${{ matrix.os }}
name: Maven Test / ${{ matrix.os }} / ${{ matrix.java-ver }}
runs-on: ${{ matrix.os }}-latest

env:
java-ver: 11
java-dist: temurin
DEBUG: ${{ inputs.debug }}
# Maven's debug flag (`-X`)
mvnDebugFlag: ${{ inputs.debug == true && '-X' || '' }}

strategy:
# Set to maximum number of processes to speed up jobs run
max-parallel: 6
matrix:
os: [Ubuntu, Windows]
os: [Ubuntu, Windows, macOS]
java-ver: [11, 17, 20] # JDK 11, 17 & 20

steps:
# Checkout repository
Expand All @@ -46,89 +60,70 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-jdk-${{ matrix.java-ver }}-${{ env.java-dist }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-maven-
${{ runner.os }}-jdk-${{ matrix.java-ver }}-${{ env.java-dist }}-maven-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-jdk-${{ matrix.java-ver }}-${{ env.java-dist }}-maven-

# Setup Java
- name: Setup Java / ${{ matrix.os }}
- name: Setup Java / ${{ matrix.os }} / ${{ matrix.java-ver }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.java-ver }}
java-version: ${{ matrix.java-ver }}
distribution: ${{ env.java-dist }}
cache: 'maven'
cache-dependency-path: '**/pom.xml'

# Install deps
- name: Install dependencies
if: ${{ steps.cache-maven.outputs.cache-hit != true && env.DEBUG != true }}
run: mvn install -DskipTests

- name: Install dependencies (Debug)
if: ${{ steps.cache-maven.outputs.cache-hit != true && env.DEBUG == true }}
run: mvn install -DskipTests -X

# Packaging with source files
- name: Package source
if: ${{ env.DEBUG != true }}
run: mvn package -P include-src

- name: Package source (Debug)
if: ${{ env.DEBUG == true }}
run: mvn package -P include-src -X

# Test
- name: Test project
if: ${{ env.DEBUG != true }}
run: mvn test

- name: Test project (Debug)
if: ${{ env.DEBUG == true }}
run: mvn test -X
# Build the project
- name: Build with Maven
run: mvn -B package -P include-src -P lint ${{ env.mvnDebugFlag }}
shell: bash

# Clean up
- name: Clean up the project
run: mvn clean
run: mvn clean ${{ env.mvnDebugFlag }}
shell: bash


# ::---:: Make Test ::---:: #
make-test:
name: Make Test
name: Make Test / Ubuntu / ${{ matrix.py-ver }}
runs-on: ubuntu-latest
continue-on-error: true

env:
MAKE: ${{ inputs.debug == true && 'make -d' || 'make' }}

strategy:
# Set to maximum number of processes to speed up jobs run
max-parallel: 6
matrix:
py-ver: ['3.7', '3.x']

env:
arch: x64
DEPS_FILE: 'requirements.txt'
DEBUG: ${{ inputs.debug }}
py-ver: [3.7, 3.x] # Python 3.7 & latest of version 3

steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v4

# Setup Python
- name: Setup Python ${{ matrix.py-ver }}
- name: Setup Python / Ubuntu / ${{ matrix.py-ver }}
id: setup-py
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py-ver }}
architecture: ${{ env.arch }}
cache: 'pip'
cache-dependency-path: '**/${{ env.DEPS_FILE }}'
cache: pip
cache-dependency-path: '**/${{ env.deps }}'

# Install deps
- name: Install dependencies
- name: Install Python dependencies
if: ${{ steps.setup-py.outputs.cache-hit != true }}
run: |
if [ $DEBUG = 'true' ]; then
python -m pip install -r $DEPS_FILE --debug
if [ $debug = 'true' ]; then
python -m pip install -r $(git ls-files **/$deps) --debug
else
python -m pip install -r $DEPS_FILE
python -m pip install -r $(git ls-files **/$deps)
fi
shell: bash

# Sadly, Make cannot tests the project thoroughly due to unavailability
# of necessary packages (e.g "org.junit"), so here it just tests
Expand All @@ -137,31 +132,16 @@ jobs:
# Compile
- name: Compile the project
run: |
[ -d target/classes ] && make clean
make compile VERBOSE=$DEBUG LINT=true

# Package
- name: Packaging the project
run: |
make package VERBOSE=$DEBUG

- name: Packaging the project (with source)
run: |
make package INCLUDE-SRC=true VERBOSE=$DEBUG
[ -d target ] && make clean > /dev/null
$MAKE compile LINT=true VERBOSE=$debug
shell: bash

# Build docs
- name: Build the docs
run: |
# Build docs
# For more information on debugging, we prefer to change it
# to "all" mode.
if [ $DEBUG = 'true' ]; then
make build-docs VERBOSE=all
else
make build-docs
fi
# Build
- name: Build with Make
run: $MAKE package INCLUDE_SRC=true VERBOSE=$debug
shell: bash

# Clean up
- name: Clean up the project
run: |
[ -d target ] && echo "Clean the project" && make clean
run: $MAKE clean VERBOSE=$debug
shell: bash
30 changes: 17 additions & 13 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ extension-pkg-whitelist=
fail-on=

# Specify a score threshold under which the program will exit with error.
fail-under=10
fail-under=0.7

# Interpret the stdin as a python script, whose filename needs to be passed as
# the module_or_package argument.
#from-stdin=

# Files or directories to be skipped. They should be base names, not paths.
ignore=CVS
ignore=CVS,
venv,
.venv,
docs

# Add files or directories matching the regular expressions patterns to the
# ignore-list. The regex matches against paths and can be in Posix or Windows
Expand All @@ -72,7 +75,7 @@ ignored-modules=
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use, and will cap the count on Windows to
# avoid hangs.
jobs=1
jobs=0

# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
Expand All @@ -88,10 +91,10 @@ persistent=yes

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.11
py-version=3.7

# Discover python modules and packages in the file system subtree.
recursive=no
recursive=yes

# Add paths to the list of the source roots. Supports globbing patterns. The
# source root is an absolute path or a path relative to the current working
Expand Down Expand Up @@ -189,6 +192,7 @@ good-names=i,
j,
k,
v,
e,
ex,
Run,
_
Expand Down Expand Up @@ -289,16 +293,16 @@ ignored-parents=
max-args=5

# Maximum number of attributes for a class (see R0902).
max-attributes=10
max-attributes=7

# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5

# Maximum number of branch for function / method body.
max-branches=35
max-branches=12

# Maximum number of locals for function / method body.
max-locals=25
max-locals=15

# Maximum number of parents for a class (see R0901).
max-parents=7
Expand All @@ -310,10 +314,10 @@ max-public-methods=20
max-returns=6

# Maximum number of statements in function / method body.
max-statements=80
max-statements=50

# Minimum number of public methods for a class (see R0903).
min-public-methods=1
min-public-methods=2


[EXCEPTIONS]
Expand Down Expand Up @@ -362,7 +366,7 @@ allow-any-import-level=
allow-reexport-from-package=no

# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=yes
allow-wildcard-with-all=no

# Deprecated modules which should not be used, separated by a comma.
deprecated-modules=
Expand Down Expand Up @@ -459,7 +463,7 @@ notes-rgx=
[REFACTORING]

# Maximum number of nested blocks for function / method body
max-nested-blocks=6
max-nested-blocks=5

# Complete name of functions that never returns. When checking for
# inconsistent-return-statements if a never returning function is called then
Expand Down Expand Up @@ -499,7 +503,7 @@ score=yes
ignore-comments=yes

# Docstrings are removed from the similarity computation
ignore-docstrings=no
ignore-docstrings=yes

# Imports are removed from the similarity computation
ignore-imports=yes
Expand Down
Loading
Loading