Repository navigation
Released: StructArmed 0.22.0
StructArmed 0.22.0 introduces new summary reporting, easier preset management, improved baseline diagnostics, additional PER Coding Style enforcement, and better visibility into the active configuration.
This release introduces:
- the new
--report=summaryand--summaryoptions for displaying violation counts per rule; - the new
appendcommand for adding presets to existing configurations; - the new
--baseline-infooption for identifying filtered and outdated baseline violations; - active configuration file visibility in console, summary, GitHub, and PHPUnit extension reports;
- the new fixable
AttributeMayNotHaveEmptyParenthesesRulein the PER preset; - improved missing baseline handling, allowing analysis to continue with a warning;
- the new
no-cacheparameter for disabling caching in the PHPUnit extension; - improved CLI help support with
-hand--helpafter commands.
New Summary Report
StructArmed introduces a new summary report for displaying violation counts grouped by rule instead of listing every individual violation.
Run:
vendor/bin/structarmed analyse --report=summaryExample output:
Rule Count
ββββββββββββββββββββββββββββββββββββββββββββ
source.must_declare_method_visibility 12
layer.may_not_depend_on 3
ββββββββββββββββββββββββββββββββββββββββββββ
15 violation(s) found in 2 rule(s) β’ 0.34s
The summary is sorted by violation count, with the most frequently violated rules appearing first.
You can also append a summary to an existing report:
vendor/bin/structarmed analyse --summaryThe --summary option is supported by console, GitHub, and JSON reports.
For JSON output, the summary is included as a structured summary field:
{
"violations": [],
"summary": {
"source.must_declare_method_visibility": 12,
"layer.may_not_depend_on": 3
},
"total": 15,
"passed": false,
"elapsed": 0.34
}The standalone summary report returns a non-zero exit code when violations are found, just like the console report.
New Append Command
StructArmed introduces a new append command for adding presets to an existing architecture configuration.
Previously, init was intended for creating a new configuration. With append, additional presets can be enabled without manually editing the existing file.
For example:
vendor/bin/structarmed append --preset=codequalityOr append all missing presets:
vendor/bin/structarmed append --preset=allThe command adds the corresponding ->withPreset(...) calls to the existing Architecture configuration chain while preserving the rest of the file.
Presets already enabled in the configuration are skipped, preventing duplicate entries.
The init command also provides guidance to use append when an existing configuration is detected.
New Baseline Diagnostics
StructArmed introduces the --baseline-info option to help identify how existing baseline entries match the current analysis results.
Run:
vendor/bin/structarmed analyse --baseline-infoExample output:
Baseline [structarmed-baseline.php]: 46 violation(s) filtered out, 0 no longer found.
When previously baselined violations are no longer found, StructArmed displays a warning:
Warning: Baseline [structarmed-baseline.php]: 46 violation(s) filtered out, 2 no longer found.
This helps identify outdated baseline entries that can be removed when regenerating the baseline.
For JSON reports, the information is available through a structured baseline field:
{
"violations": [],
"baseline": {
"file": "structarmed-baseline.php",
"filtered_out": 46,
"no_longer_found": 2
},
"total": 0,
"passed": true,
"elapsed": 0.34
}When analyzing only selected paths, the number of no-longer-found violations cannot be determined reliably, so only the filtered count is reported.
The option does not change the analysis exit code.
Active Configuration File Visibility
StructArmed now displays the absolute path of the active configuration file in analysis reports.
For example:
StructArmed 0.22.0 - Architecture Enforcement
================================================
Configuration: /path/to/project/structarmed.php
No violations found. (0.34s)
This helps identify which configuration is being used, particularly when working with multiple configuration files or passing a custom --config option.
The configuration path is displayed in console, summary, GitHub, and PHPUnit extension reports.
Both automatically discovered and explicitly configured files are supported.
PER Coding Style Improvements
The PER preset now includes the new AttributeMayNotHaveEmptyParenthesesRule, requiring attributes without arguments to omit unnecessary empty parentheses.
For example:
#[SomeAttribute()]
final class Example
{
}The rule supports automatic fixing:
vendor/bin/structarmed analyse --fixResult:
#[SomeAttribute]
final class Example
{
}Attributes containing comments inside their parentheses are preserved to avoid removing meaningful source content.
The rule is automatically available through Preset::PER().
Missing Baseline File Handling
A configured baseline file that does not exist no longer blocks analysis for non-JSON reports.
Instead, StructArmed continues the analysis without baseline filtering and displays a warning:
Warning: Baseline file [structarmed-baseline.php] does not exist, violations are reported without baseline filtering.
The analysis exit code continues to depend on the reported violations.
For JSON reports, a missing baseline remains an error to preserve valid machine-readable output.
PHPUnit Extension Improvements
The PHPUnit extension now supports disabling analysis caching through the no-cache parameter:
<extensions>
<bootstrap class="Boundwize\StructArmed\PHPUnit\StructArmedExtension">
<parameter name="no-cache" value="true"/>
</bootstrap>
</extensions>When enabled, StructArmed skips file hashing and does not read or write cache entries.
The existing cache remains untouched.
This provides the same behavior as the CLI --no-cache option and can be useful when testing without cached analysis results.
CLI Help Improvements
Help options can now be provided after a command:
vendor/bin/structarmed analyse --help
vendor/bin/structarmed init -hBoth -h and --help are supported, making command usage easier to discover.
What's Changed
- feat: Add summary report and --summary option for violation count per rule in #603.
- feat: Add
appendcommand to add a preset to an existing config file in #607. - feat: Print the configuration file used in console, summary, and github reports in #611.
- feat: Warn instead of blocking analyse when baseline file does not exist on non-json report in #613.
- feat: Allow disabling cache in StructArmedExtension via no-cache config in #616.
- feat: Add HelpCommand to show usage on -h|--help after a command in #617.
- feat: Add fixable AttributeMayNotHaveEmptyParenthesesRule to PER preset in #620.
- feat: Add --baseline-info option to analyse to show filtered and no longer found baseline violations in #623.
- Prepare for 0.22.0 in #608.
Full Changelog: 0.21.30...0.22.0