Skip to content

Conversation

@peter-lawrey
Copy link
Member

@peter-lawrey peter-lawrey commented Oct 26, 2025

This PR polishes user-facing docs, introduces an opt-in code-review profile with Chronicle’s standard quality toolchain, strengthens path handling and immutability in the analytics core, and broadens test coverage—without changing the public API or runtime behaviour.


Why

  • Bring this repo in line with Chronicle’s doc-first + quality gate workflow.
  • Make the README cleaner and consistent (badges, code fences, wrapping).
  • Reduce risk around client-ID file handling.
  • Improve test confidence and explicitly validate async HTTP behaviour.

What changed

Docs & housekeeping

  • README.adoc

    • Fixed badge link spacing and formatting.
    • Normalised prose line-wrapping and [source,java] markers.
    • Minor grammar/spacing clean-ups.
  • New project docs under src/main/adoc/:

    • project-requirements.adoc (Nine-Box catalogue, CA-* IDs).
    • security-review.adoc (data flows, risks, mitigations).
  • Copyright headers updated to 2016–2025.

  • module-info.java.txt header year updated.

  • Removed a few stray trailing spaces/formatting inconsistencies.

Build & quality (opt-in profile)

  • Parent POM aligned to net.openhft:java-parent-pom:1.27ea0.

  • Added shared properties for Checkstyle, SpotBugs/FindSecBugs, PMD, JaCoCo, and Chronicle rules.

  • code-review profile:

    • Checkstyle (Chronicle rules), SpotBugs(+FindSecBugs), PMD, JaCoCo check with current project gates:

      • Line coverage 0.898, Branch coverage 0.7142857.
  • Dependencies:

    • spotbugs-annotations (provided) and junit-vintage-engine (tests).
  • Local scaffolding for suppressions:

    • src/main/config/spotbugs-exclude.xml (narrow, documented matches).
    • src/main/config/pmd-exclude.properties (empty by default).

Core code safety & clarity

  • FilesUtil

    • Added sanitize(String) → normalises to absolute path and rejects .. segments.
    • lastPath() now uses a normalised ${user.home}.
    • Narrowed exception handling around I/O; improved debug logging.
  • AnalyticsConfiguration: tidy method layout/spacing (no behaviour change).

  • GoogleAnalytics3/4: continue to extend AbstractGoogleAnalytics (no functional change); minor import tidy.

  • VanillaAnalyticsBuilder

    • Returns defensive copies for userProperties() / eventParameters().
    • Minor clean-ups to builder logic/formatting.
  • Analytics: minor Javadoc formatting.

  • HttpUtil.Sender: trivial style compacting (no functional change).

  • JUnitUtil and package-info tidy-ups only.

Tests (coverage uplift)

  • AnalyticsTest: new case validating additional parameters pass-through.
  • ClientIdUtilTest: uses JUnit @TempDir; validates debug messages and re-use of generated ID.
  • HttpUtilTest: new test asserts background executor sends and reports without blocking.
  • GoogleAnalytics3Test: reflects the internal payload builder and verifies merged parameters/user properties.

How to run

# Standard build + tests
mvn -q clean verify

# Opt-in quality gates (Checkstyle, SpotBugs/FindSecBugs, PMD, JaCoCo check)
mvn -q -Pcode-review verify

@peter-lawrey peter-lawrey changed the title Adv/code review Document analytics requirements, harden GA3 coverage, and stabilise parent POM Oct 26, 2025
@peter-lawrey peter-lawrey changed the title Document analytics requirements, harden GA3 coverage, and stabilise parent POM Add code-review profile (Checkstyle/PMD/SpotBugs/JaCoCo), raise coverage, and harden Chronicle Analytics Oct 27, 2025
- enforce 89.8% line and 71.42857% branch coverage\n- suppress expected PATH_TRAVERSAL_IN warnings for sanitized client-id paths
- Tighten the code-review Jacoco gates to 91.02% line / 71.43% branch
- Drop Jacoco from the default build so coverage runs live only in the review profile
- Bring HttpUtil.java’s Chronicle header forward to 2025
- Relax FilesUtil.sanitize so legacy '../' client-id paths resolve again
- Guard the behaviour with a regression test that exercises parent segments
- Add FilesUtil coverage for error handling to keep Jacoco gates passing
@sonarqubecloud
Copy link

@peter-lawrey peter-lawrey marked this pull request as draft November 3, 2025 10:36
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.

3 participants