Skip to content

ci: establish GitHub Actions CI workflow and fix code quality issues - #12

Merged
szkiba merged 2 commits into
mainfrom
refactor-establish-ci-workflow
Feb 1, 2026
Merged

szkiba merged 2 commits into
mainfrom
refactor-establish-ci-workflow

Conversation

@szkiba

@szkiba szkiba commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR establishes a comprehensive CI pipeline with automated code quality checks and fixes existing violations identified by static analysis tools.

Changes

CI/CD Infrastructure

  • ✅ Add GitHub Actions CI workflow (.github/workflows/ci.yml)
    • Triggers on push to main and pull requests
    • Ignores changes in docs/ folder only
    • Uses commit hashes for action pinning (security best practice)
    • Runs Maven verify with ci profile
    • Uploads test results and reports as artifacts

Build Configuration

  • ✅ Add ci profile to pom.xml with quality gates:
    • SpotBugs analysis (Max effort, Medium threshold)
    • PMD code analysis with failing error reporting
    • CPD (copy-paste detection) with 150 token minimum
    • All checks fail build on violations
  • ✅ Configure Spotless formatting enforcement in verify phase

Code Quality Fixes

  • ✅ Fix CT_CONSTRUCTOR_THROW security vulnerabilities
    • Make Ini, Options, Reg classes final to prevent finalizer attacks
    • Secure constructors that throw exceptions during initialization
  • ✅ Modernize JUnit test assertions
    • Replace try-catch-fail patterns with assertThrows
    • Update BeanToolTest, BasicOptionMapTest to modern JUnit 4 style
    • Remove unnecessary @SuppressWarnings annotations
  • ✅ Fix PMD violations
    • Remove unused imports and variables
    • Improve exception handling patterns

Formatting

  • ✅ Reformat all XML files with Spotless eclipseWtp formatter
  • ✅ Java files remain Google Java Style compliant

Testing

  • ✅ All 206 tests passing
  • ✅ SpotBugs: No violations
  • ✅ PMD: No violations
  • ✅ CPD: No violations (with 150 token threshold)
  • ✅ Checkstyle: Clean

Related Issues

Closes #11

Breaking Changes

None - all changes are non-functional improvements to code quality and CI infrastructure.

Relates to Phase 2 of the v0.6.0 roadmap.

Add comprehensive CI pipeline with code quality checks:

- Add .github/workflows/ci.yml workflow
  * Triggers on push to main and pull requests
  * Ignores changes in docs/ folder
  * Uses commit hashes for action pinning (security best practice)
  * Runs Maven verify with ci profile
  * Uploads test results and reports as artifacts

- Add ci profile to pom.xml with quality gates:
  * SpotBugs analysis (Max effort, Medium threshold)
  * PMD code analysis with failing error reporting
  * CPD (copy-paste detection) with 150 token minimum
  * All checks fail build on violations

- Configure Spotless formatting enforcement in verify phase

This establishes automated code quality checks on every push and PR,
ensuring consistent code standards and catching issues early.
Fix code quality issues identified by static analysis tools and apply
consistent formatting across the codebase.

**Code Quality Fixes:**

- Fix CT_CONSTRUCTOR_THROW in Ini, Options, Reg classes
  * Make classes final to prevent finalizer attacks
  * Secure constructors that throw exceptions during initialization

- Modernize JUnit test assertions
  * Replace try-catch-fail patterns with assertThrows
  * Update BeanToolTest, BasicOptionMapTest to modern JUnit 4 style
  * Remove @SuppressWarnings("empty-statement") annotations

- Fix PMD violations
  * Remove unused imports and variables
  * Improve exception handling patterns
  * Clean up code structure

**Formatting Changes:**

- Reformat all XML files with Spotless eclipseWtp formatter
  * Consistent indentation (4 spaces)
  * Trim trailing whitespace
  * End files with newline

- Java files remain Google Java Style compliant (no changes needed)

All changes are non-functional - tests remain passing (206/206).
Prepares codebase for automated CI quality gates.
@szkiba szkiba linked an issue Feb 1, 2026 that may be closed by this pull request
13 tasks
@szkiba
szkiba merged commit f987e6f into main Feb 1, 2026
1 check passed
@szkiba
szkiba deleted the refactor-establish-ci-workflow branch February 1, 2026 15:56
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.

Establish CI Workflow with Static Analysis (SpotBugs & PMD)

1 participant