Codeac Auto-Include: Will All Maven Modules Be Validated?
0 reputation · 27 Mar 2022, 09:49 UTC
0 reputation · 27 Mar 2022, 09:49 UTC
When running Codeac locally the tool automatically includes every Maven module in the analysis scope. In a production CI pipeline the same flag may cause modules to be omitted due to restricted file‑system permissions, potentially leading to missing annotation detection failures.
Codeac’s configuration file defaults to $HOME/.codeac/config.yaml locally, but CI environments look for /etc/codeac/config.yaml unless overridden. The --auto-include flag is enabled by default, yet its behavior when the tool cannot read certain module directories is not documented. Additionally, the environment variable CODEAC_SKIP_DUPLICATES is often set to true in CI, altering duplicate detection logic.
--auto-include flag guarantee that every Maven module is validated for missing annotations when the tool runs under restricted file‑system access?CODEAC_SKIP_DUPLICATES=true in CI unintentionally mask duplicate annotation errors that would otherwise surface locally?No. The --auto-include flag does **not** guarantee that every Maven module will be validated when Codeac runs with restricted file‑system access. If a module directory cannot be read, Codeac silently skips it during auto‑include.
Codeac builds its analysis scope by querying Maven’s reactor (the list of modules that mvn would build). It then attempts to read each module’s pom.xml and source files. When the process lacks read permission for a module’s directory, the file‑system call fails, Codeac treats the module as unavailable, and it is omitted from the analysis without emitting an error by default.
<modules> section are included unless they have <skip>true</skip> or are excluded by an active Maven profile.<modules>) or is marked as skipped, Codeac will not validate it.CODEAC_SKIP_DUPLICATES=true changes duplicate‑detection logic: duplicate annotations are ignored rather than reported, which can mask errors that would appear locally.grep -A 20 '<modules>' pom.xmlmvn help:effective-pom | grep -A 5 -B 5 '<skip>'codeac --verbose analyze Look for lines like Processing module: my-module or warnings about inaccessible directories.mvn help:evaluate -Dexpression=reactorProjects -q -DforceStdout.--verbose or --debug flags; Codeac will log "Skipping module X due to insufficient permissions" when it cannot read a directory.find . -type d -name '*' -exec test -r {} \\; -print to verify readability of each module directory.CODEAC_SKIP_DUPLICATES=trueWhen this environment variable is set to true, Codeac’s duplicate‑annotation detector treats subsequent occurrences as non‑errors and does not report them. This can hide genuine duplicate‑annotation problems that would be surfaced locally where the variable is unset or false. To avoid masking, either unset the variable in CI or run a separate analysis pass with it disabled to verify duplicate detection.
Can you confirm whether the CI runner has read access to **all** module directories? If any directory is unreadable, the auto‑include flag will skip those modules, and you must adjust permissions or explicitly list the modules in the configuration.
Use comments to ask for clarification. Post a solution as an answer.
34,275 reputation · 27 Mar 2022, 10:21 UTC
When --auto-include omits modules absent from the Maven reactor, the pool of checked annotations shrinks accordingly. In CI, if a profile excludes certain modules or the reactor is limited via -pl, Codeac will not process them, reducing the annotation set that CODEAC_SKIP_DUPLICATES operates on. This can make duplicate‑detection settings appear less impactful than in a full local build.
codeac --verbose analyze 2>&1 | grep -i "module"
Cross‑reference the output with mvn help:effective-pom to verify which modules Codeac actually processes versus those declared in the parent POM.