archunit 0.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/API.md +498 -0
- data/CHANGELOG.md +85 -0
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +75 -0
- data/GUIDE.md +804 -0
- data/README.md +224 -289
- data/SECURITY.md +64 -0
- data/SUPPORT.md +23 -0
- data/assets/logo-rounded.png +0 -0
- data/exe/archunit +7 -0
- data/lib/archunit/cli/analysis_report.rb +62 -0
- data/lib/archunit/cli/analysis_text.rb +25 -0
- data/lib/archunit/cli/baseline_context.rb +42 -0
- data/lib/archunit/cli/baseline_document.rb +58 -0
- data/lib/archunit/cli/baseline_fingerprint.rb +36 -0
- data/lib/archunit/cli/baseline_identity.rb +85 -0
- data/lib/archunit/cli/baseline_ledger.rb +38 -0
- data/lib/archunit/cli/baseline_object.rb +15 -0
- data/lib/archunit/cli/baseline_options.rb +48 -0
- data/lib/archunit/cli/baseline_run.rb +85 -0
- data/lib/archunit/cli/baseline_schema.rb +53 -0
- data/lib/archunit/cli/baseline_text.rb +31 -0
- data/lib/archunit/cli/configuration.rb +93 -0
- data/lib/archunit/cli/options.rb +117 -0
- data/lib/archunit/cli/report.rb +121 -0
- data/lib/archunit/cli/runner.rb +108 -0
- data/lib/archunit/cli.rb +15 -0
- data/lib/archunit/common/extraction/dependency_evidence.rb +44 -0
- data/lib/archunit/common/extraction/edge.rb +7 -2
- data/lib/archunit/common/extraction/import_kind.rb +4 -1
- data/lib/archunit/common/extraction/parse_diagnostic.rb +23 -0
- data/lib/archunit/common/extraction/source_exclusions.rb +43 -0
- data/lib/archunit/common/fluentapi/check_options.rb +53 -2
- data/lib/archunit/common/fluentapi/checkable.rb +25 -1
- data/lib/archunit/common/logging/check_logger.rb +8 -0
- data/lib/archunit/common/logging/inspection.rb +59 -0
- data/lib/archunit/common/logging/logging_options.rb +5 -0
- data/lib/archunit/common/pattern.rb +18 -8
- data/lib/archunit/common/projection/cycles/johnson_cycles.rb +35 -19
- data/lib/archunit/common/projection/cycles/tarjan_scc.rb +30 -10
- data/lib/archunit/error/source_parse_error.rb +38 -0
- data/lib/archunit/extraction/analysis_observer.rb +24 -0
- data/lib/archunit/extraction/analysis_profile.rb +30 -0
- data/lib/archunit/extraction/analysis_snapshot.rb +51 -0
- data/lib/archunit/extraction/arch_ignore.rb +91 -0
- data/lib/archunit/extraction/conservative_local_flow.rb +100 -0
- data/lib/archunit/extraction/constant_index.rb +110 -0
- data/lib/archunit/extraction/constant_visitor.rb +137 -0
- data/lib/archunit/extraction/dependency_context.rb +30 -0
- data/lib/archunit/extraction/discover_gemspec_load_paths.rb +96 -0
- data/lib/archunit/extraction/enumerate_source_files.rb +36 -9
- data/lib/archunit/extraction/extract_dependencies.rb +74 -15
- data/lib/archunit/extraction/extract_graph.rb +74 -40
- data/lib/archunit/extraction/extract_imports.rb +57 -124
- data/lib/archunit/extraction/extraction_profile.rb +105 -0
- data/lib/archunit/extraction/graph_assembly.rb +32 -0
- data/lib/archunit/extraction/graph_cache_key.rb +27 -0
- data/lib/archunit/extraction/import_calls.rb +93 -0
- data/lib/archunit/extraction/import_resolver.rb +65 -0
- data/lib/archunit/extraction/import_source_policy.rb +123 -0
- data/lib/archunit/extraction/import_visitor.rb +89 -0
- data/lib/archunit/extraction/load_arguments.rb +34 -0
- data/lib/archunit/extraction/local_string_tracker.rb +81 -0
- data/lib/archunit/extraction/resolve_import.rb +5 -3
- data/lib/archunit/extraction/resolve_load_paths.rb +98 -0
- data/lib/archunit/extraction/resolved_import.rb +5 -2
- data/lib/archunit/extraction/source_analysis.rb +26 -0
- data/lib/archunit/extraction/static_import_path.rb +111 -0
- data/lib/archunit/extraction/validate_extraction_paths.rb +37 -0
- data/lib/archunit/files/extraction/extract_file_info.rb +14 -5
- data/lib/archunit/files/extraction/file_info.rb +1 -2
- data/lib/archunit/files/fluentapi/depend_on_external_module_condition.rb +2 -0
- data/lib/archunit/files/fluentapi/depend_on_external_module_condition_builder.rb +2 -0
- data/lib/archunit/files/fluentapi/depend_on_file_condition.rb +6 -0
- data/lib/archunit/files/fluentapi/depend_on_file_condition_builder.rb +6 -0
- data/lib/archunit/files/fluentapi/file_condition_builder.rb +12 -0
- data/lib/archunit/files/fluentapi/file_rule_support.rb +8 -1
- data/lib/archunit/files/fluentapi/files.rb +6 -0
- data/lib/archunit/files/fluentapi/match_pattern_file_condition_builder.rb +14 -0
- data/lib/archunit/files/fluentapi/positive_match_pattern_file_condition_builder.rb +2 -0
- data/lib/archunit/graph/fluentapi/graph.rb +5 -0
- data/lib/archunit/graph/fluentapi/project_graph_builder.rb +44 -0
- data/lib/archunit/graph/projection/aggregate_edges.rb +4 -2
- data/lib/archunit/graph/projection/graph_query_options.rb +1 -2
- data/lib/archunit/graph/projection/graph_report_edge.rb +12 -2
- data/lib/archunit/graph/rendering/json_renderer.rb +3 -1
- data/lib/archunit/layers/fluentapi/architecture_preset.rb +49 -0
- data/lib/archunit/layers/fluentapi/layer_definition_builder.rb +4 -0
- data/lib/archunit/layers/fluentapi/layer_dependency_rule_builder.rb +4 -0
- data/lib/archunit/layers/fluentapi/layered_architecture.rb +5 -0
- data/lib/archunit/layers/fluentapi/layers.rb +5 -0
- data/lib/archunit/layers/fluentapi/preset_definitions.rb +39 -0
- data/lib/archunit/layers/fluentapi/preset_options.rb +69 -0
- data/lib/archunit/layers/fluentapi/preset_rule.rb +45 -0
- data/lib/archunit/metrics/extraction/extract_distance_info.rb +2 -3
- data/lib/archunit/metrics/extraction/extract_project_info.rb +14 -10
- data/lib/archunit/metrics/extraction/metric_info.rb +2 -4
- data/lib/archunit/metrics/extraction/source_metrics_visitor.rb +2 -4
- data/lib/archunit/metrics/fluentapi/custom_metric_builder.rb +2 -0
- data/lib/archunit/metrics/fluentapi/custom_metric_condition.rb +4 -1
- data/lib/archunit/metrics/fluentapi/logged_metric.rb +23 -0
- data/lib/archunit/metrics/fluentapi/metric_predicate_condition.rb +4 -1
- data/lib/archunit/metrics/fluentapi/metric_report_builder.rb +6 -3
- data/lib/archunit/metrics/fluentapi/metric_selection.rb +18 -2
- data/lib/archunit/metrics/fluentapi/metric_threshold_condition.rb +2 -1
- data/lib/archunit/metrics/fluentapi/metrics.rb +5 -0
- data/lib/archunit/metrics/fluentapi/metrics_builder.rb +18 -3
- data/lib/archunit/metrics/reporting/metrics_export_options.rb +6 -2
- data/lib/archunit/slices/fluentapi/diagram_slice_condition.rb +1 -0
- data/lib/archunit/slices/fluentapi/forbidden_slice_dependency_condition.rb +1 -0
- data/lib/archunit/slices/fluentapi/negative_slice_condition_builder.rb +2 -0
- data/lib/archunit/slices/fluentapi/positive_slice_condition_builder.rb +8 -0
- data/lib/archunit/slices/fluentapi/slice_scope_builder.rb +12 -0
- data/lib/archunit/slices/fluentapi/slices.rb +5 -0
- data/lib/archunit/testing/assert_passes.rb +4 -0
- data/lib/archunit/testing/result_factory.rb +16 -4
- data/lib/archunit/testing/rspec_adapter.rb +1 -2
- data/lib/archunit/testing.rb +7 -3
- data/lib/archunit/version.rb +1 -1
- data/lib/archunit.rb +11 -0
- metadata +67 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a48d64d371405af4f585562e9e0681d55057b0f49b538752bd48b5e8a3424a8
|
|
4
|
+
data.tar.gz: 9f757d0013a3c7aad7c8ae65614daeeaf1fa97fce26ef3d7ad12c7d1171254c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eff71dc5e9470b205772ad8fb8c39a0c4898c612cddbe3b86034bdbca57897565e96d5a25fb689ba721233dea9a0f4a96b08fec51cbd441f77aeb99641cc7433
|
|
7
|
+
data.tar.gz: a959a6f1bf867076901ebaff0515a552d2e0d5579280d4e9036ada93bd8e51ba3f00af09ec61eecd412faa917b99e23085e24e5e182dbe9963fe56ab37637c64
|
data/API.md
ADDED
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
# ArchUnitRuby API Guide
|
|
2
|
+
|
|
3
|
+
This guide is the stable map of ArchUnitRuby's public fluent API. The
|
|
4
|
+
[class and method reference](https://dragonsec-ai.github.io/ArchUnitRuby/class_list.html)
|
|
5
|
+
is generated from the source, while this page explains
|
|
6
|
+
which entry point to choose and how the stages fit together.
|
|
7
|
+
|
|
8
|
+
All rule builders are immutable and lazy. Constructing a rule does not read the project; `check`,
|
|
9
|
+
`measure`, `snapshot`, and export methods are the terminals that perform work.
|
|
10
|
+
|
|
11
|
+
This reference follows `main` and documents the 1.x API. Additions requiring 1.1 are labeled;
|
|
12
|
+
see [release status](README.md#availability) and check your installed version before copying them.
|
|
13
|
+
For recipes use the [user guide](GUIDE.md); for a first rule use the [quickstart](README.md#quickstart).
|
|
14
|
+
|
|
15
|
+
[1.x compatibility contract](#compatibility) · [Common rule shape](#grammar) · [File rules](#file-rules) · [Layer rules](#layer-rules) · [Slices and diagrams](#slices) · [Dependency graph reports](#graph-reports) · [Metrics](#metrics) · [Checking and test frameworks](#frameworks) · [Check options and logging](#check-options) · [Architecture presets (1.1+)](#presets) · [CLI contract (1.1+)](#cli) · [Errors and support](#errors)
|
|
16
|
+
|
|
17
|
+
<a id="compatibility"></a>
|
|
18
|
+
|
|
19
|
+
## 1.x compatibility contract
|
|
20
|
+
|
|
21
|
+
This guide defines the supported 1.x public surface: documented entry points, fluent methods,
|
|
22
|
+
options, public data/error types, and report formats. Additive capabilities can arrive in minor
|
|
23
|
+
versions; incompatible public API changes require a major version and migration notes. Private
|
|
24
|
+
helpers and classes marked as implementation details are not part of that compatibility promise.
|
|
25
|
+
Correctness fixes can change detected violations; compatibility is not a promise to preserve missed
|
|
26
|
+
dependencies or misleading clean results.
|
|
27
|
+
|
|
28
|
+
Static extraction remains bounded and does not execute the target application's source or gemspecs.
|
|
29
|
+
Import-only is the default; expanded constant analysis is explicit opt-in. The documented unresolved
|
|
30
|
+
lookup cases, project source/exclusion policy, strict parser failures, and explicit cache-clearing
|
|
31
|
+
behavior remain important when upgrading. See the [migration guide](GUIDE.md#migration) for changes from 0.0.1.
|
|
32
|
+
|
|
33
|
+
<a id="grammar"></a>
|
|
34
|
+
|
|
35
|
+
## Common rule shape
|
|
36
|
+
|
|
37
|
+
~~~ruby
|
|
38
|
+
rule = ArchUnit.project_files
|
|
39
|
+
.in_folder('app/api/**')
|
|
40
|
+
.should_not.depend_on_files
|
|
41
|
+
.in_folder('app/database/**')
|
|
42
|
+
|
|
43
|
+
violations = rule.check
|
|
44
|
+
~~~
|
|
45
|
+
|
|
46
|
+
| Stage | Public vocabulary | Result |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| Entry | `project_files`, `project_layers`, `project_slices`, `project_graph`, `metrics` | Immutable builder |
|
|
49
|
+
| Scope | `with_name`, `in_folder`, `in_path`, `in_file`, `for_classes_matching` | Narrower builder |
|
|
50
|
+
| Mood | `should`, `should_not` | Positive or negated predicate builder |
|
|
51
|
+
| Predicate | File, layer, slice, or metric policy | Checkable rule |
|
|
52
|
+
| Terminal | `check`, `measure`, `snapshot`, `to_*`, `export_as_*` | Data or an artifact |
|
|
53
|
+
|
|
54
|
+
String patterns are anchored globs. `*` stays inside one path segment, `**` crosses zero or more
|
|
55
|
+
segments, and `?` matches one non-separator character. A trailing folder glob such as
|
|
56
|
+
`app/api/**` includes the `app/api` folder itself and every descendant folder. Regular expressions
|
|
57
|
+
are accepted by all pattern selectors except the exact `in_file` selector.
|
|
58
|
+
|
|
59
|
+
Every pattern selector accepts `except:`. Pass a pattern, an array of patterns, or explicit selector
|
|
60
|
+
keys such as `{ in_folder: 'generated', with_name: '*_spec.rb' }`.
|
|
61
|
+
|
|
62
|
+
<a id="file-rules"></a>
|
|
63
|
+
|
|
64
|
+
## File rules
|
|
65
|
+
|
|
66
|
+
Every completed rule implementing `ArchUnit::Checkable` supports `.because(reason)`. Append it
|
|
67
|
+
after all selectors and modifiers to get a distinct frozen rule of the same type, with a trimmed,
|
|
68
|
+
immutable `rationale` string. Non-string or blank reasons raise `ArgumentError`. The original rule,
|
|
69
|
+
violations, graph cache, and `check` options are unchanged. The shared result formatter adds
|
|
70
|
+
`Because: ...` exactly once to failed framework-neutral, RSpec, and Minitest assertions, including
|
|
71
|
+
failed negated RSpec expectations. Successful assertions and raw violation formatting omit it.
|
|
72
|
+
|
|
73
|
+
Start with `ArchUnit.project_files(project_locator = nil)`; `ArchUnit.files` is its short alias.
|
|
74
|
+
Without a locator, ArchUnitRuby searches upward for a `Gemfile` or gemspec.
|
|
75
|
+
|
|
76
|
+
Discovery skips symlinked source files and directories, including aliases inside the project root.
|
|
77
|
+
Direct `FileInfo` extraction validates canonical as well as lexical containment before reading.
|
|
78
|
+
The source walker reuses a single file-status result per entry for type and symlink decisions.
|
|
79
|
+
|
|
80
|
+
The detected root's `.archignore` is applied centrally to graphs and file-based metrics. It accepts
|
|
81
|
+
blank lines, full-line `#` comments, basename globs, root-relative path globs, leading `/` anchors,
|
|
82
|
+
and trailing `/` directory patterns. Backslashes normalize to `/`. Bare names match at any depth;
|
|
83
|
+
patterns containing a separator match from the project root. A directory pattern excludes its
|
|
84
|
+
descendants but not a similarly named regular file. Nested ignore files are not read.
|
|
85
|
+
|
|
86
|
+
Repository patterns combine with defaults or explicit `exclude_patterns:`. An explicit `[]` only
|
|
87
|
+
disables defaults, never repository patterns. The normalized effective pattern set participates in
|
|
88
|
+
graph cache identity; changing the file is noticed on the next check without `clear_cache`.
|
|
89
|
+
Changing source contents still requires explicit cache clearing. Reads are bounded to 1 MiB; UTF-8
|
|
90
|
+
BOMs are accepted and invalid bytes replaced. Symlinks (including project-local ones), non-regular
|
|
91
|
+
files, negation, NUL characters, and a bare `/` are rejected. No Ruby or gemspec code is evaluated.
|
|
92
|
+
|
|
93
|
+
Since 1.1, `CheckOptions.new(source_exclusions: ['lib/templates/migration.rb'])` adds
|
|
94
|
+
immutable caller-owned globs without changing the target repository. These combine with defaults
|
|
95
|
+
and repository policy; legacy `exclude_patterns: []` still disables only defaults. The effective
|
|
96
|
+
normalized set determines graph-cache identity, including when API and legacy inputs express the
|
|
97
|
+
same policy. Source selectors do not narrow the discovery universe. Included invalid Ruby remains
|
|
98
|
+
fatal; no template directories are implicitly skipped. CLI uses repeatable `--exclude-source GLOB`.
|
|
99
|
+
Globs are project-relative (optional leading `/`); negation, traversal, drive/UNC paths, NUL/newlines
|
|
100
|
+
and empty/root-only patterns are rejected. Counts/cohesion/distance accept the same check options.
|
|
101
|
+
For metric HTML, pass `MetricsExportOptions.new(check_options: options)` to `export_as_html`.
|
|
102
|
+
|
|
103
|
+
| Scope or predicate | Purpose |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `with_name(pattern)` | Select or require a filename pattern |
|
|
106
|
+
| `in_folder(pattern)` | Select or require a project-relative directory |
|
|
107
|
+
| `in_path(pattern)` | Select or require a complete project-relative path |
|
|
108
|
+
| `in_file(path)` | Select one exact project-relative file |
|
|
109
|
+
| `have_no_cycles` | Reject cycles among selected project files |
|
|
110
|
+
| `depend_on_files` | Allow or reject dependencies matching target selectors |
|
|
111
|
+
| `depend_on_external_modules` | Allow or reject standard-library or gem imports |
|
|
112
|
+
| `adhere_to(callable, message)` | Evaluate a custom predicate over immutable `FileInfo` values |
|
|
113
|
+
|
|
114
|
+
~~~ruby
|
|
115
|
+
service_scope = ArchUnit.project_files.in_folder('app/services/**')
|
|
116
|
+
|
|
117
|
+
rules = [
|
|
118
|
+
service_scope.should.have_name('*_service.rb'),
|
|
119
|
+
service_scope.should_not.depend_on_files.in_folder('app/controllers/**'),
|
|
120
|
+
service_scope.should_not.depend_on_external_modules.matching('net/http'),
|
|
121
|
+
service_scope.should.adhere_to(
|
|
122
|
+
->(file) { file.lines_of_code < 300 },
|
|
123
|
+
'services must stay below 300 non-blank lines'
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
~~~
|
|
127
|
+
|
|
128
|
+
Positive dependency rules are allowlists: every selected dependency must match at least one target.
|
|
129
|
+
Negated dependency rules are blocklists: matching dependencies become violations.
|
|
130
|
+
|
|
131
|
+
Cycle projection uses iterative strongly-connected-component and elementary-cycle traversals, so
|
|
132
|
+
long dependency chains do not consume Ruby's call stack. It still enumerates all elementary cycles;
|
|
133
|
+
dense graphs can have exponentially many results. Scope cycle rules to meaningful components.
|
|
134
|
+
|
|
135
|
+
<a id="layer-rules"></a>
|
|
136
|
+
|
|
137
|
+
## Layer rules
|
|
138
|
+
|
|
139
|
+
Use `ArchUnit.project_layers(project_locator = nil)` to name architectural layers and then declare
|
|
140
|
+
their allowed or forbidden relationships.
|
|
141
|
+
|
|
142
|
+
~~~ruby
|
|
143
|
+
rule = ArchUnit.project_layers
|
|
144
|
+
.layer('api').defined_by('app/api/**/*.rb')
|
|
145
|
+
.layer('services').defined_by_folder('app/services/**')
|
|
146
|
+
.layer('database').defined_by('app/database/**/*.rb')
|
|
147
|
+
.where_layer('api').may_only_depend_on_layers('services')
|
|
148
|
+
.where_layer('services').may_only_depend_on_layers('database')
|
|
149
|
+
.where_layer('database').may_only_depend_on_layers
|
|
150
|
+
~~~
|
|
151
|
+
|
|
152
|
+
`may_only_depend_on_layers` creates an allowlist. Calling it without targets seals the layer.
|
|
153
|
+
`may_not_depend_on_layers` creates a blocklist and requires at least one target. Dependencies inside
|
|
154
|
+
one layer are allowed; edges with an unassigned endpoint are ignored.
|
|
155
|
+
|
|
156
|
+
<a id="slices"></a>
|
|
157
|
+
|
|
158
|
+
## Slices and diagrams
|
|
159
|
+
|
|
160
|
+
Use `ArchUnit.project_slices(project_locator = nil)` to capture one segment from project paths.
|
|
161
|
+
`(**)` is the glob capture; `defined_by_regex` uses the first regular-expression capture.
|
|
162
|
+
|
|
163
|
+
~~~ruby
|
|
164
|
+
slices = ArchUnit.project_slices.defined_by('lib/my_app/(**)/')
|
|
165
|
+
|
|
166
|
+
dependency_rule = slices.should_not.contain_dependency('api', 'database')
|
|
167
|
+
diagram_rule = slices.should
|
|
168
|
+
.ignoring_external_slices
|
|
169
|
+
.ignoring_orphan_slices
|
|
170
|
+
.adhere_to_diagram_in_file('docs/architecture.puml')
|
|
171
|
+
|
|
172
|
+
plantuml = slices.to_plantuml
|
|
173
|
+
slices.export_as_plantuml('reports/architecture.puml')
|
|
174
|
+
~~~
|
|
175
|
+
|
|
176
|
+
`adhere_to_diagram` accepts inline PlantUML. The supported subset includes components, directed
|
|
177
|
+
dependencies, comments, `@startuml`, and `@enduml`.
|
|
178
|
+
|
|
179
|
+
<a id="graph-reports"></a>
|
|
180
|
+
|
|
181
|
+
## Dependency graph reports
|
|
182
|
+
|
|
183
|
+
Use `ArchUnit.project_graph(project_locator = nil)` for queryable snapshots and reports.
|
|
184
|
+
|
|
185
|
+
~~~ruby
|
|
186
|
+
report = ArchUnit.project_graph
|
|
187
|
+
.include_external_dependencies
|
|
188
|
+
.focus_on('app/services/**', 2)
|
|
189
|
+
.collapse_to_folder_depth(2)
|
|
190
|
+
.titled('Service dependencies')
|
|
191
|
+
|
|
192
|
+
summary = report.summary
|
|
193
|
+
snapshot = report.snapshot
|
|
194
|
+
report.export_as_mermaid('reports/services.mmd')
|
|
195
|
+
report.export_as_html('reports/services.html')
|
|
196
|
+
~~~
|
|
197
|
+
|
|
198
|
+
Query modifiers are `focus_on(pattern, depth)`, `reachable_from(pattern)`, and
|
|
199
|
+
`dependents_of(pattern)`. Group nodes with `collapse_to_folder_depth` or
|
|
200
|
+
`collapse_by_pattern(pattern, replacement)`. Formats are DOT, Mermaid, D2, CSV, JSON, and
|
|
201
|
+
self-contained HTML; each provides both `to_<format>` and `export_as_<format>`.
|
|
202
|
+
|
|
203
|
+
<a id="metrics"></a>
|
|
204
|
+
|
|
205
|
+
## Metrics
|
|
206
|
+
|
|
207
|
+
Start with `ArchUnit.metrics(project_locator = nil)`. Select files with the standard file selectors
|
|
208
|
+
and classes with `for_classes_matching`.
|
|
209
|
+
|
|
210
|
+
~~~ruby
|
|
211
|
+
services = ArchUnit.metrics
|
|
212
|
+
.in_path('app/services/**/*.rb')
|
|
213
|
+
.for_classes_matching('*Service')
|
|
214
|
+
|
|
215
|
+
rules = [
|
|
216
|
+
services.count.method_count.should_be_below_or_equal(20),
|
|
217
|
+
services.lcom.lcom4.should_be(1),
|
|
218
|
+
services.distance.instability.should_be_below(0.8)
|
|
219
|
+
]
|
|
220
|
+
|
|
221
|
+
measurements = services.count.method_count.measure
|
|
222
|
+
services.count.export_as_html('reports/service-counts')
|
|
223
|
+
~~~
|
|
224
|
+
|
|
225
|
+
Count metrics cover methods, fields, lines, statements, imports, classes, and top-level functions.
|
|
226
|
+
Cohesion provides LCOM96a, LCOM96b, LCOM1-5, and LCOM*. Distance metrics include abstractness,
|
|
227
|
+
instability, main-sequence distance, normalized distance, and coupling factor.
|
|
228
|
+
|
|
229
|
+
Thresholds use exactly `should_be_below`, `should_be_above`, `should_be`,
|
|
230
|
+
`should_be_below_or_equal`, `should_be_above_or_equal`, and `should_satisfy`. Use `custom_metric`
|
|
231
|
+
for a calculation over `ClassInfo`; zone guards are `not_in_zone_of_pain` and
|
|
232
|
+
`not_in_zone_of_uselessness`.
|
|
233
|
+
|
|
234
|
+
<a id="frameworks"></a>
|
|
235
|
+
|
|
236
|
+
## Checking and test frameworks
|
|
237
|
+
|
|
238
|
+
Every architecture rule includes `ArchUnit::Checkable` and exposes `check(options = nil)`. It returns
|
|
239
|
+
an array of structured `Violation` values; an architecture disagreement is not an exception until
|
|
240
|
+
an assertion adapter translates it at the test boundary.
|
|
241
|
+
|
|
242
|
+
~~~ruby
|
|
243
|
+
violations = rule.check
|
|
244
|
+
|
|
245
|
+
expect(rule).to pass # RSpec
|
|
246
|
+
assert_passes(rule) # Minitest
|
|
247
|
+
ArchUnit.assert_passes(rule) # Framework-neutral
|
|
248
|
+
~~~
|
|
249
|
+
|
|
250
|
+
Use `ArchUnit.format_violations` or `ArchUnit::ResultFactory` when integrating with another test
|
|
251
|
+
framework or command-line interface.
|
|
252
|
+
|
|
253
|
+
<a id="check-options"></a>
|
|
254
|
+
|
|
255
|
+
## Check options and logging
|
|
256
|
+
|
|
257
|
+
`ArchUnit::CheckOptions` keeps optional execution behavior out of the fluent sentence:
|
|
258
|
+
|
|
259
|
+
~~~ruby
|
|
260
|
+
logging = ArchUnit::LoggingOptions.new(
|
|
261
|
+
level: :debug,
|
|
262
|
+
output_directory: 'tmp/archunit-logs'
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
options = ArchUnit::CheckOptions.new(
|
|
266
|
+
allow_empty_tests: false,
|
|
267
|
+
clear_cache: false,
|
|
268
|
+
load_paths: ['components/billing/lib'],
|
|
269
|
+
dependency_analysis: :imports,
|
|
270
|
+
logging: logging
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
violations = rule.check(options)
|
|
274
|
+
~~~
|
|
275
|
+
|
|
276
|
+
Zero selected subjects produce `EmptyTestViolation` by default. Set `allow_empty_tests: true` only
|
|
277
|
+
when an empty scope is intentionally valid. Set `clear_cache: true` after modifying the analyzed
|
|
278
|
+
project during one process. `load_paths` adds project-contained source roots without evaluating
|
|
279
|
+
gemspecs or running application code.
|
|
280
|
+
|
|
281
|
+
`dependency_analysis` defaults to `:imports`. Imports accept literal arguments and preceding local
|
|
282
|
+
literal-string assignments in supported straight-line scopes. Aliases, mutation/escape, closures,
|
|
283
|
+
reflection, and unsupported control flow invalidate inferred values; runtime paths are not guessed.
|
|
284
|
+
|
|
285
|
+
Since 1.1, the bounded file-relative whitelist also accepts `__FILE__`, implicit `__dir__`, literal/static
|
|
286
|
+
string `+`, `File.dirname(absolute_expression)` and `File.expand_path(path, absolute_base)`
|
|
287
|
+
(also `::File`, or one absolute operand for `expand_path`). Operands cannot contain local-variable
|
|
288
|
+
reads or arbitrary calls; the completed result may be assigned to a local. No source is evaluated.
|
|
289
|
+
Source-local core overrides/reflection disable affected inference; arbitrary cross-file core
|
|
290
|
+
monkey-patching is not modeled. See the [resolution guide](GUIDE.md#analysis) for exact limits.
|
|
291
|
+
|
|
292
|
+
Since 1.1, `rails_imports: true` separately opts into implicit/`self.require_dependency`
|
|
293
|
+
calls. Accepted paths use the same literal/local/static contract, and edges use
|
|
294
|
+
`:require_dependency`. Explicit `load_paths` are searched first for this helper only; ordinary
|
|
295
|
+
`require` resolution is unchanged. Custom receivers are ignored; local helper overrides/reflection
|
|
296
|
+
and unknown operands remain unresolved. No Rails boot or automatic autoload-root discovery occurs.
|
|
297
|
+
The option is immutable, validated and part of graph-cache identity; it composes with either
|
|
298
|
+
dependency-analysis mode. Cross-file method replacement and dynamic Rails/glob values are not modeled.
|
|
299
|
+
|
|
300
|
+
For autoloaded projects, opt into known project constant references alongside imports:
|
|
301
|
+
|
|
302
|
+
~~~ruby
|
|
303
|
+
options = ArchUnit::CheckOptions.new(dependency_analysis: :imports_and_constants)
|
|
304
|
+
violations = rule.check(options)
|
|
305
|
+
json = ArchUnit.project_graph.with_check_options(options).to_json
|
|
306
|
+
values = ArchUnit.metrics.distance.instability.measure(options)
|
|
307
|
+
~~~
|
|
308
|
+
|
|
309
|
+
Expanded analysis resolves supported lexical, compact, and root-qualified references to their
|
|
310
|
+
definition files. Explicit superclass and mixin references also contribute edges. Missing or
|
|
311
|
+
ambiguous definitions, inherited-member lookup, and dynamic metaprogramming stay unresolved under
|
|
312
|
+
the bounded contract in the main guide. Namespaces that fail to stabilize within eight index passes
|
|
313
|
+
fall back to import-only results. Unknown third-party constants do not create architecture violations.
|
|
314
|
+
|
|
315
|
+
Declarations include ordinary `=` and conditional `||=`, with lexical/qualified/root-qualified
|
|
316
|
+
ownership and definition evidence. This does not predict runtime execution or load order. Multiple
|
|
317
|
+
definition files remain ambiguous; update-only compound and multiple-assignment forms are not
|
|
318
|
+
inferred as new declaration owners.
|
|
319
|
+
|
|
320
|
+
Expanded edges include `:constant_reference` in `import_kinds` and retain `DependencyEvidence` with
|
|
321
|
+
names and source lines in `edge.evidence` and JSON reports. An import and a constant use supporting
|
|
322
|
+
the same file pair merge into one edge. Import-only edge evidence stays empty for compatibility;
|
|
323
|
+
`ArchUnit::Extraction.extract_imports` retains import call locations in both modes. The analysis
|
|
324
|
+
mode participates in graph-cache identity, and `clear_cache: true` rebuilds the symbol index.
|
|
325
|
+
|
|
326
|
+
### Semantic boundaries
|
|
327
|
+
|
|
328
|
+
Method-call restrictions, effective method/signature protocols, and semantic component selectors
|
|
329
|
+
are not provided by the current file graph or metric method facts. The bounded
|
|
330
|
+
[semantic evaluation](https://github.com/dragonsec-ai/ArchUnitRuby/blob/main/design/semantic-boundaries.md)
|
|
331
|
+
records exact comparator pins, executable probes and the compatibility/unknowns required before
|
|
332
|
+
adding such APIs. This is a technical evaluation, not a newly shipped semantic backend.
|
|
333
|
+
|
|
334
|
+
<a id="presets"></a>
|
|
335
|
+
|
|
336
|
+
## Architecture presets (1.1+)
|
|
337
|
+
|
|
338
|
+
`ArchUnit.architecture_preset(name, options = nil)` returns an immutable Checkable `PresetRule`.
|
|
339
|
+
`ArchUnit::PresetOptions.new(project_locator: nil, folders: {})` is its options bag. Names are
|
|
340
|
+
`:layered`, `:hexagonal`, or `:rails`; unknown names and malformed/duplicate override layer keys fail
|
|
341
|
+
at construction. Each folder override is a non-empty String or Array of source globs; multiple
|
|
342
|
+
patterns are ORed within one layer. No project reads occur until check.
|
|
343
|
+
|
|
344
|
+
Layered maps presentation/application/persistence to `app/api/**`, `app/services/**`, `app/db/**`,
|
|
345
|
+
allowing only presentation→application and application→persistence across layers. Hexagonal maps
|
|
346
|
+
domain/application/adapters to `app/domain/**`, `app/application/**`, `app/adapters/**`, allowing
|
|
347
|
+
application→domain and adapters→application/domain. Rails maps controllers/services/models to
|
|
348
|
+
their `app/` folders, allowing controllers→services/models and services→models. Same-layer edges
|
|
349
|
+
are allowed; the innermost layer has no allowed outgoing cross-layer edge. All mappings are
|
|
350
|
+
overridable. Unmapped files/external modules are outside this policy, not excluded from extraction.
|
|
351
|
+
|
|
352
|
+
Presets construct `LayeredArchitecture` rules and use existing assertion code. The guard rejects
|
|
353
|
+
observed files matching multiple layers with UserError; empty layers use the normal
|
|
354
|
+
EmptyTestViolation defense unless explicitly permitted. CheckOptions controls analysis, exclusions,
|
|
355
|
+
cache and logging as usual; source parse errors remain fatal. `.because` and framework matchers
|
|
356
|
+
work normally. Rails conventions do not boot Rails or automatically turn on expanded/helper modes.
|
|
357
|
+
These presets are not complete architecture/cycle/protocol verification; compose more rules or
|
|
358
|
+
build arbitrary policies with `project_layers`.
|
|
359
|
+
|
|
360
|
+
Trusted CLI configurations have `architecture_preset(name, options = nil)`, defaulting the locator
|
|
361
|
+
to their selected project root. This preserves the public locator/auto-discovery distinction.
|
|
362
|
+
|
|
363
|
+
<a id="cli"></a>
|
|
364
|
+
|
|
365
|
+
## CLI contract (1.1+)
|
|
366
|
+
|
|
367
|
+
The executable requires 1.1 or newer; it is not included in 1.0.0. It wraps
|
|
368
|
+
Checkable rules without changing RSpec/Minitest or the library's default analysis mode.
|
|
369
|
+
|
|
370
|
+
~~~sh
|
|
371
|
+
archunit init --project .
|
|
372
|
+
archunit check --project . --format json
|
|
373
|
+
archunit check --dependency-analysis imports_and_constants
|
|
374
|
+
archunit check --rails-imports --load-path app/models --load-path app/services
|
|
375
|
+
archunit explain --config ./trusted-architecture.rb
|
|
376
|
+
~~~
|
|
377
|
+
|
|
378
|
+
`init` checks the filesystem entry itself and uses exclusive creation to reject existing paths,
|
|
379
|
+
including dangling symlinks on Windows. This is not a sandbox against a hostile process concurrently
|
|
380
|
+
replacing filesystem entries. The default configuration is
|
|
381
|
+
`PROJECT/.archunit.rb`; an explicit `--config` path is relative to the invocation directory. The
|
|
382
|
+
project defaults to that working directory. Named declarations are
|
|
383
|
+
`rule('unique name') { completed_checkable }`; the configuration helpers `project_files` / `files`,
|
|
384
|
+
`project_layers` / `layers`, `project_slices`, and `metrics` use the selected root. Rules must be
|
|
385
|
+
non-empty and uniquely named. Every `check` command starts with a fresh graph cache, then shares
|
|
386
|
+
that cache across its rules.
|
|
387
|
+
|
|
388
|
+
Configuration is trusted executable Ruby, not an isolation boundary. `explain` loads the same Ruby
|
|
389
|
+
configuration but never calls its rules' `check` methods. It reports `configured` and per-rule
|
|
390
|
+
`not_checked`, not an architecture pass. It lists rule names/rationale and settings, not a full
|
|
391
|
+
semantic explanation or focused-path report. Avoid stdout writes in configuration when requesting
|
|
392
|
+
machine-readable output. No target source, Gemfile, or gemspec is automatically executed by the CLI;
|
|
393
|
+
the caller's own Bundler/configuration code retains its normal Ruby behavior.
|
|
394
|
+
|
|
395
|
+
Exit codes: **0** for a successful informational/init/explain command or all checked rules passing;
|
|
396
|
+
**1** for architecture violations; **2** for argument/configuration/analysis errors. Empty selectors
|
|
397
|
+
remain violations. Text errors go to stderr; JSON diagnostics go to stdout without color. The
|
|
398
|
+
format option applies to init/check/explain and errors; help/version remain plain text.
|
|
399
|
+
|
|
400
|
+
`--format json` produces one document with `schema_version: 1`, `archunit_version`, `command`,
|
|
401
|
+
`project_root`, `config_path`, `dependency_analysis`, `rails_imports`, `load_paths`, `source_exclusions`,
|
|
402
|
+
`status`, `rules`, `analysis`, and `summary`. The new settings/diagnostics are additive schema-1 fields.
|
|
403
|
+
Rule entries carry `name`, nullable `rationale`, `status`, `analysis`, and `violations`;
|
|
404
|
+
each violation carries its `type`,
|
|
405
|
+
shared formatter `message`, and `details`. Summary counts describe completed/listed rules and their
|
|
406
|
+
violations; an analysis error may stop later rules, so a partial summary is never a pass. An error
|
|
407
|
+
adds `error.type`, `error.message`, and nullable `error.rule_name`; a `SourceParseError` also adds
|
|
408
|
+
`error.diagnostics` with path, one-based line/column, and message. Messages/details are for people,
|
|
409
|
+
not stable violation fingerprints. The CLI implementation classes are not a new fluent API.
|
|
410
|
+
|
|
411
|
+
### Analysis diagnostics
|
|
412
|
+
|
|
413
|
+
`analysis` contains `status` (`available`, `partial`, or `unavailable`), `scopes`, and a limitations
|
|
414
|
+
`notice`. Each scope contains:
|
|
415
|
+
|
|
416
|
+
- `id`, `project_root`, `kind` (`dependency_graph` or `source_metrics`), and `status`
|
|
417
|
+
(`analyzed` or `error`). IDs are local to one invocation, not stable fingerprints.
|
|
418
|
+
- The actual `dependency_analysis`, `rails_imports`, explicit `load_paths`, and sorted
|
|
419
|
+
`effective_source_exclusions` (defaults + repository policy + caller exclusions).
|
|
420
|
+
Dependency settings are null for source-only metrics, which do not construct a dependency graph.
|
|
421
|
+
- `counters`: `source_files`, `imports`, `unresolved_imports`, `unresolved_constant_references`,
|
|
422
|
+
and `ambiguous_constant_references`. Constant counters are null in imports-only mode;
|
|
423
|
+
all counts are null when extraction fails, rather than presenting a partial parse as success.
|
|
424
|
+
- `observations`, `cache_hits`, and the `rule_names` using that snapshot. Cached graphs retain their
|
|
425
|
+
original measured counts, even if first extracted without a timing profile. Refreshed graphs
|
|
426
|
+
become separate snapshots; roots, policies, and modes are not conflated.
|
|
427
|
+
|
|
428
|
+
Each rule's `analysis` contains an availability `status` and its `scope_ids`. `explain`, `init`,
|
|
429
|
+
and custom checks doing no built-in extraction have unavailable diagnostics, not zero counts.
|
|
430
|
+
Mixed measured/unobserved rules produce partial availability. Analysis scopes are not summed:
|
|
431
|
+
multiple roots can overlap, and a metric pass and a graph pass can inspect the same files.
|
|
432
|
+
`source_files` counts all included sources before fluent selectors, not matched rule subjects.
|
|
433
|
+
Scopes describe synchronous built-in extraction in the current check, not arbitrary user work
|
|
434
|
+
started in other threads/fibers.
|
|
435
|
+
|
|
436
|
+
`imports` counts accepted static import expressions, including external imports.
|
|
437
|
+
Unresolved imports count unsupported/dynamic import expressions; literal external gem imports are
|
|
438
|
+
not counted as unresolved expressions. Unresolved/ambiguous constant observations can include
|
|
439
|
+
external symbols, unsupported Ruby lookup, or definitions reopened across files. They are neither
|
|
440
|
+
proven missed internal dependencies nor a semantic-completeness percentage. They do not change
|
|
441
|
+
exit status; included parse failures remain errors. A passing policy only describes the statically
|
|
442
|
+
resolved graph, not proof of complete runtime architecture. Warm timing profiles still measure
|
|
443
|
+
actual work (zero repeated cold counters); diagnostic snapshots are separate from those profiles.
|
|
444
|
+
|
|
445
|
+
<a id="baselines"></a>
|
|
446
|
+
|
|
447
|
+
### Explicit violation baselines (1.1+)
|
|
448
|
+
|
|
449
|
+
`archunit baseline --output FILE.json` evaluates every rule and atomically writes an explicitly
|
|
450
|
+
reviewable accepted-debt document. It refuses existing output without `--force`, non-JSON output
|
|
451
|
+
names, empty-selection violations, custom/unknown violation types, and unobserved scopes. No output
|
|
452
|
+
is written until all rules finish; parse/configuration failures never replace existing debt.
|
|
453
|
+
`archunit check --baseline FILE` remains read-only. All sources/rules are still checked; it returns
|
|
454
|
+
0 only when there are no new violations or stale entries. A run with accepted violations has
|
|
455
|
+
`status: accepted`, not `passed`. Baseline creation has `status: baseline_created`, not an
|
|
456
|
+
architecture pass. Without either flag/command normal strict checks are unchanged.
|
|
457
|
+
|
|
458
|
+
The document has `schema_version: 1`, `fingerprint_version: 1`, and `entries`. Each entry contains
|
|
459
|
+
`fingerprint` (SHA256 of canonical rule/type/data/context), positive occurrence `count`, `rule`,
|
|
460
|
+
`type`, structured `data`, and scope `context`. Input validates schema, duplicate fingerprints,
|
|
461
|
+
counts, fingerprint/data consistency, size (2 MB), nesting (32) and entry limit (10,000). Paths are
|
|
462
|
+
project-relative; regex source/options are data. Line evidence, formatter wording, object identity,
|
|
463
|
+
graph counters/cache state and checkout absolute paths are not identity. Actual source policies and
|
|
464
|
+
dependency-analysis settings are included, so a different mode/policy cannot silently reuse debt.
|
|
465
|
+
Deleted/renamed rules leave stale entries. Counts are matched one-to-one, not set membership.
|
|
466
|
+
|
|
467
|
+
Built-in file/external dependencies, patterns, simple directed cycles, layer/slice dependencies,
|
|
468
|
+
and numeric metric thresholds have explicit adapters. Metric predicates/zones, custom violations,
|
|
469
|
+
empty selectors and unsupported types are never auto-recorded; under an existing baseline they
|
|
470
|
+
remain new violations. There is no generic `inspect`/formatted-message fallback. Public Checkable
|
|
471
|
+
results are unchanged; this first delivery is CLI-only.
|
|
472
|
+
|
|
473
|
+
Schema-1 CLI output adds `baseline` metadata. During check it contains `status: checked`, `path`,
|
|
474
|
+
`accepted_count`, `new_count`, `stale_count` and `stale_entries`; every raw violation retains its
|
|
475
|
+
original type/message/details and adds `baseline.status` (`accepted` / `new`) and nullable
|
|
476
|
+
`baseline.fingerprint`. Per-rule status can be `accepted`. Existing summary violation counts remain
|
|
477
|
+
raw counts, not just new debt. Invalid input/IO/analysis exits 2, new/stale debt exits 1. Atomic
|
|
478
|
+
creation uses a same-directory hard link (unsupported filesystems fail closed); force replacement
|
|
479
|
+
uses rename after rejecting non-regular paths. Concurrent hostile filesystem mutation is outside
|
|
480
|
+
this library's isolation guarantees. Do not blindly regenerate baselines in CI.
|
|
481
|
+
|
|
482
|
+
<a id="errors"></a>
|
|
483
|
+
|
|
484
|
+
## Errors and support
|
|
485
|
+
|
|
486
|
+
Invalid API input raises `ArchUnit::UserError` or `ArgumentError`; library or environment failures
|
|
487
|
+
raise `ArchUnit::TechnicalError`. Rule failures remain violation data.
|
|
488
|
+
|
|
489
|
+
Malformed included Ruby raises `ArchUnit::SourceParseError`, a `TechnicalError`, during graph or
|
|
490
|
+
AST-metric extraction. No partial graph is returned or cached. `error.diagnostics` is an immutable
|
|
491
|
+
array of `ArchUnit::ParseDiagnostic` values with `path`, one-based `line`/`column`, and `message`;
|
|
492
|
+
each value supports `to_h`. RSpec/Minitest assertions propagate this technical failure instead of
|
|
493
|
+
reporting a pass or an ordinary architecture violation. Excluded files are not parsed. The profile's
|
|
494
|
+
`malformed_files` counter records a rejected file; existing cache-clearing rules still apply.
|
|
495
|
+
|
|
496
|
+
See the [quickstart](README.md#quickstart) and [user guide](GUIDE.md) for complete examples, [SUPPORT.md](https://github.com/dragonsec-ai/ArchUnitRuby/blob/main/SUPPORT.md)
|
|
497
|
+
for help, and [SECURITY.md](https://github.com/dragonsec-ai/ArchUnitRuby/blob/main/SECURITY.md) for
|
|
498
|
+
responsible vulnerability reporting.
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.0 - 2026-11-23
|
|
4
|
+
|
|
5
|
+
Additive release over 1.0.0. Import-only analysis remains the default; the CLI and Rails helpers
|
|
6
|
+
are opt-in. Existing RSpec/Minitest rules keep the 1.x API contract. Correctness fixes can reveal
|
|
7
|
+
previously missed dependencies, so review newly detected violations rather than suppressing them.
|
|
8
|
+
|
|
9
|
+
- Rework getting-started documentation with a concise README, preserved user guide, explicit
|
|
10
|
+
published/development availability, canonical organization URLs and executable example/link checks.
|
|
11
|
+
|
|
12
|
+
- Compose layered, hexagonal and Rails folder presets from existing layer rules, with immutable
|
|
13
|
+
pattern overrides, CLI integration, overlap errors and unchanged empty/source-analysis defenses.
|
|
14
|
+
|
|
15
|
+
- Add explicit CLI accepted-debt baselines with versioned structured fingerprints, one-to-one
|
|
16
|
+
occurrence matching, stale-entry failures, strict JSON validation and safe explicit output.
|
|
17
|
+
|
|
18
|
+
- Expose additive CLI analysis scopes with source/uncertainty counts, truthful warm-cache reuse,
|
|
19
|
+
unavailable values for unperformed/failed analysis, and explicit static-analysis limitations.
|
|
20
|
+
|
|
21
|
+
- Add immutable caller-owned source exclusions and CLI `--exclude-source`, applied consistently
|
|
22
|
+
to graphs, source/coupling metrics and reports without editing target repositories.
|
|
23
|
+
|
|
24
|
+
- Add explicit static Rails `require_dependency` imports, separate helper search-root priority,
|
|
25
|
+
and CLI `--rails-imports` / repeatable `--load-path` options without booting Rails.
|
|
26
|
+
|
|
27
|
+
- Fold a bounded, source-aware whitelist of file-relative import expressions without evaluating
|
|
28
|
+
source, including RestClient-style `File.dirname(__FILE__) + '/feature'` imports.
|
|
29
|
+
|
|
30
|
+
- Record namespace-owner dependencies in qualified class/module declarations and constant writes
|
|
31
|
+
in expanded analysis, preserving lexical lookup, ambiguity handling, and source evidence.
|
|
32
|
+
|
|
33
|
+
- Recognize `load(path, wrap)` dependencies and count dynamic/variadic wrapped paths as unresolved,
|
|
34
|
+
without reusing stale local strings across effectful wrap expressions or block conversions.
|
|
35
|
+
|
|
36
|
+
- Add an opt-in `archunit` executable with non-destructive configuration initialization, named
|
|
37
|
+
Checkable rules, check/explain commands, text or versioned JSON diagnostics, and explicit
|
|
38
|
+
success/violation/error exit codes.
|
|
39
|
+
|
|
40
|
+
- Add isolated Linux performance studies and a bounded semantic evaluation for maintainers;
|
|
41
|
+
these do not add a runtime analyzer dependency or claim full method/protocol semantics.
|
|
42
|
+
|
|
43
|
+
## 1.0.0 - 2026-10-26
|
|
44
|
+
|
|
45
|
+
First stable API baseline. The previously unreleased 0.0.2 development work is included here;
|
|
46
|
+
0.0.1 remains the preceding published version. See the user guide's migration notes before upgrading.
|
|
47
|
+
|
|
48
|
+
- Fail closed on malformed included Ruby in dependency graphs and AST metrics, with structured
|
|
49
|
+
source diagnostics and profile counters instead of silently treating incomplete analysis as clean.
|
|
50
|
+
|
|
51
|
+
- Add development-only locked dependency scanning with advisory refresh, fail-closed health checks,
|
|
52
|
+
Windows path normalization, and retained CI reports.
|
|
53
|
+
|
|
54
|
+
- Avoid stack overflows in strongly-connected-component detection, elementary-cycle traversal,
|
|
55
|
+
and blocked-vertex propagation on deep dependency graphs.
|
|
56
|
+
- Skip symlinked source entries and enforce canonical project boundaries for direct file metadata.
|
|
57
|
+
- Reuse source-entry file status instead of repeating separate directory and file probes.
|
|
58
|
+
- Validate version/changelog/lock consistency in CI and require prepared release metadata before
|
|
59
|
+
RubyGems publication.
|
|
60
|
+
- Enforce the unchanged coverage thresholds on runtime library source only, with a real-report
|
|
61
|
+
regression check that excludes loaded specs, benchmarks, and scripts from the denominator.
|
|
62
|
+
|
|
63
|
+
- Apply bounded project-root `.archignore` exclusions consistently to dependency graphs and metrics,
|
|
64
|
+
with cache invalidation, cross-platform glob handling, and configuration safety checks.
|
|
65
|
+
|
|
66
|
+
- Add immutable `.because(...)` explanations to every executable rule and shared assertion output.
|
|
67
|
+
|
|
68
|
+
- Add opt-in debug inspection of project roots, graphs, and selected files on cold and cached checks.
|
|
69
|
+
- Log passing metric values without repeating custom calculations.
|
|
70
|
+
- Document verbosity, CI log artifacts, and existing colored violation reports.
|
|
71
|
+
|
|
72
|
+
- Add opt-in project constant-reference dependencies with lexical lookup and conservative ambiguity handling.
|
|
73
|
+
- Index lexical, qualified, and root-qualified `||=` declarations in expanded analysis without
|
|
74
|
+
executing source or changing import-only mode.
|
|
75
|
+
- Infer import paths from safely known local literal strings without evaluating application code.
|
|
76
|
+
- Preserve dependency source evidence in expanded mode through graph merging and JSON reporting,
|
|
77
|
+
while keeping import-only edge values compatible with existing consumers.
|
|
78
|
+
- Support check options on metric measurements and add installed-gem extraction regression checks.
|
|
79
|
+
- Make trailing folder globs such as `app/api/**` include the named folder itself.
|
|
80
|
+
- Validate the README quickstart as a passing and failing end-to-end architecture test.
|
|
81
|
+
- Add a curated API guide, reliable Markdown rendering, responsive documentation navigation, and
|
|
82
|
+
documentation quality checks.
|
|
83
|
+
- Add the ArchUnitRuby family logo, social preview, and repository community health files.
|
|
84
|
+
- Discover adjacent `lib` directories in multi-gemspec repositories without evaluating gemspecs.
|
|
85
|
+
- Support validated, project-local custom load paths through `CheckOptions`.
|
|
86
|
+
- Add cold/warm extraction profiling, a reproducible benchmark, and resolution caching.
|
|
87
|
+
|
|
3
88
|
## 0.0.1 - 2026-08-11
|
|
4
89
|
|
|
5
90
|
Initial executable prototype.
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our pledge
|
|
4
|
+
|
|
5
|
+
We pledge to make participation in this project a harassment-free experience for everyone,
|
|
6
|
+
regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics,
|
|
7
|
+
gender identity and expression, level of experience, education, socioeconomic status, nationality,
|
|
8
|
+
personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
9
|
+
|
|
10
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive,
|
|
11
|
+
and healthy community.
|
|
12
|
+
|
|
13
|
+
## Our standards
|
|
14
|
+
|
|
15
|
+
Examples of behavior that contributes to a positive environment include demonstrating empathy,
|
|
16
|
+
respecting differing viewpoints, giving and accepting constructive feedback, taking responsibility
|
|
17
|
+
for mistakes, and focusing on what is best for the community.
|
|
18
|
+
|
|
19
|
+
Unacceptable behavior includes sexualized language or attention, trolling or insulting comments,
|
|
20
|
+
harassment, publishing another person's private information without permission, and other conduct
|
|
21
|
+
that could reasonably be considered inappropriate in a professional setting.
|
|
22
|
+
|
|
23
|
+
## Enforcement responsibilities
|
|
24
|
+
|
|
25
|
+
Project maintainers may clarify and enforce these standards and may remove, edit, or reject
|
|
26
|
+
comments, commits, code, issues, and other contributions that do not align with this Code of
|
|
27
|
+
Conduct. Moderation decisions should explain the reason when appropriate.
|
|
28
|
+
|
|
29
|
+
## Scope and reporting
|
|
30
|
+
|
|
31
|
+
This Code applies in project spaces and when someone officially represents the project. Report
|
|
32
|
+
abusive or harassing GitHub content through GitHub's reporting tools and contact a maintainer
|
|
33
|
+
privately through the contact options on their GitHub profile. Reports will be reviewed promptly and
|
|
34
|
+
handled with appropriate confidentiality.
|
|
35
|
+
|
|
36
|
+
## Attribution
|
|
37
|
+
|
|
38
|
+
This Code of Conduct is adapted from the
|
|
39
|
+
[Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
|
|
40
|
+
|