Skip to content

Commit 166ee62

Browse files
authored
Merge pull request #1588 from bibonix/add-architecture-section
Add Architecture section to README.md
2 parents 24510e9 + f72c3ac commit 166ee62

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,83 @@ works fine. To use it just add `-Dhttp.proxyHost=HOST -Dhttp.proxyPort=PORT`
7070
to your `MAVEN_OPTS` environment variable or to Maven command, e.g.
7171
`mvn clean verify -Dhttp.proxyHost=HOST -Dhttp.proxyPort=PORT`.
7272

73+
## Architecture
74+
75+
Qulice aggregates [Checkstyle](https://checkstyle.sourceforge.io/),
76+
[PMD](https://pmd.github.io/), and
77+
[ErrorProne](https://errorprone.info/) behind a single
78+
[Maven](https://maven.apache.org/) `verify`-phase goal, `check`.
79+
Unlike running each tool as a separate Maven plugin with its own
80+
configuration file, Qulice requires no per-tool setup in `pom.xml`.
81+
The bundled rule sets are locked: all adopting projects share the same
82+
[Checkstyle](https://checkstyle.sourceforge.io/) and
83+
[PMD](https://pmd.github.io/) configuration.
84+
This differs from [Spotless](https://github.com/diffplug/spotless)
85+
or the [Checkstyle Maven Plugin][csmp] used standalone, both of
86+
which allow per-project rule customization.
87+
88+
The [Checkstyle](https://checkstyle.sourceforge.io/) configuration
89+
(`checks.xml`) and [PMD](https://pmd.github.io/) ruleset
90+
(`ruleset.xml`) ship as classpath resources inside the Qulice JAR
91+
and cannot be overridden by the adopting project.
92+
Projects may suppress specific checks only via the `<excludes>`
93+
parameter; they cannot add or redefine rules.
94+
This trades flexibility for consistency: code review style expectations
95+
are identical across every repository that uses Qulice.
96+
97+
The `com.qulice.spi` package defines the extension boundary between
98+
Maven and the linting logic.
99+
`Environment` exposes project structure (base directory, classpath,
100+
source files, exclude patterns) without leaking Maven internals,
101+
enabling validators to be unit-tested without a Maven runtime.
102+
`ResourceValidator` accepts a `Collection<File>` and returns
103+
`Collection<Violation>`; `Validator` consumes the full `Environment`
104+
for checks that require broader project context.
105+
106+
[Checkstyle](https://checkstyle.sourceforge.io/),
107+
[PMD](https://pmd.github.io/), and
108+
[ErrorProne](https://errorprone.info/) run concurrently inside a
109+
five-thread `ExecutorService` in `CheckMojo`.
110+
Each validator is submitted as a `Callable<Collection<Violation>>`
111+
and results are collected via `Future`.
112+
A configurable timeout (default ten minutes, overridable via
113+
`qulice.check-timeout`) prevents a hung validator from blocking
114+
the build indefinitely.
115+
116+
[ErrorProne](https://errorprone.info/) requires `--add-exports` and
117+
`--add-opens` JVM flags to access internal `jdk.compiler` APIs.
118+
Rather than injecting those flags into Maven's own JVM (which
119+
would require a `.mvn/jvm.config` in every adopting project),
120+
Qulice forks a separate `javac` process via
121+
[Jaxec](https://github.com/yegor256/jaxec).
122+
The flags apply only to the forked process; Maven's JVM is unchanged.
123+
124+
After parallel linting, five Maven-specific validators run
125+
sequentially: `PomXpathValidator` checks `pom.xml` against
126+
user-supplied [XPath](https://www.w3.org/TR/xpath/) expressions;
127+
`EnforcerValidator` delegates to [maven-enforcer-plugin][mep] to
128+
verify JDK and Maven versions; `DependenciesValidator` uses
129+
[maven-dependency-analyzer][mda] to find unused or undeclared
130+
compile-scope dependencies; `DuplicateFinderValidator` detects
131+
duplicate classes across classpath JARs; and `SnapshotsValidator`
132+
rejects SNAPSHOT dependencies in production builds.
133+
134+
Both [Checkstyle](https://checkstyle.sourceforge.io/) and
135+
[PMD](https://pmd.github.io/) are extended with custom rules.
136+
The `com.qulice.checkstyle` package contains roughly forty custom
137+
`AbstractCheck` implementations (e.g., `ConstructorsOrderCheck`,
138+
`IfThenThrowElseCheck`) covering constraints absent from the
139+
standard [Checkstyle](https://checkstyle.sourceforge.io/) catalog.
140+
The `com.qulice.pmd.rules` package adds custom `AbstractJavaRule`
141+
implementations (e.g., `UnitTestContainsTooManyAssertsRule`,
142+
`ProhibitPlainJunitAssertionsRule`) that replace upstream
143+
[PMD](https://pmd.github.io/) rules with known false-positive
144+
defects filed in the upstream tracker.
145+
146+
[csmp]: https://maven.apache.org/plugins/maven-checkstyle-plugin/
147+
[mep]: https://maven.apache.org/plugins/maven-enforcer-plugin/
148+
[mda]: https://maven.apache.org/shared/maven-dependency-analyzer/
149+
73150
## How to contribute
74151

75152
Fork repository, make changes, send us a pull request. We will review

0 commit comments

Comments
 (0)