Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ metadata check does not publish a gem. Do not dispatch `Release` for a dry run:
to RubyGems and creates the version tag. Keep publication behind explicit maintainer authorization.

1. Update `ArchUnit::VERSION` in `lib/archunit/version.rb` and add the release to `CHANGELOG.md`.
2. Refresh the local gem's `Gemfile.lock` entry, date the changelog heading as
2. Refresh the local gem entries in `Gemfile.lock` and `benchmark/study/Gemfile.lock`, date the changelog heading as
`## <version> - YYYY-MM-DD`, and update the README installation example to `~> <version>`.
3. Ensure `main` is green and run `bundle exec ruby scripts/check_release_metadata.rb --release`.
The development check permits an unreleased heading; the publishing check deliberately does not.
Expand Down
30 changes: 17 additions & 13 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The source walker owns a pruned iterative traversal and reuses one status per en
come from directory child components under the canonical root, not unchecked absolute-prefix
slicing; the final source list is sorted once. Included entry/listing failures raise
`TechnicalError`, including unreadable or disappearing directories; they are not silently skipped.
This stricter listing-error handling is part of unreleased 1.1.1. Excluded directories are pruned
This stricter listing-error handling starts in 1.2. Excluded directories are pruned
before their children are listed. Concurrent hostile filesystem mutation is not sandboxed.

The detected root's `.archignore` is applied centrally to graphs and file-based metrics. It accepts
Expand Down Expand Up @@ -137,11 +137,11 @@ Cycle projection uses iterative traversals. By default, it enumerates all elemen
graphs can have exponentially many results. To report one reproducible closed path per cyclic group,
pass `CheckOptions.new(cycle_reporting: :witness)` to the check. Both modes decide whether the
entire selected file graph is acyclic; the witness list is not a count of all paths.
`CycleViolation#witness?` distinguishes a witness from an exhaustive result.
`CycleViolation#witness?` distinguishes a witness from an exhaustive result (1.2+).

<a id="layer-rules"></a>
<a id="named-method-calls"></a>

### Named method calls (unreleased)
### Named method calls (1.2+)

Use `should_not.contain_calls_named(:delete_all)` or pass a nonempty array of exact names. The
optional `ArchUnit::NamedCallOptions.new(receiver: :bare)` limits the rule to calls with no
Expand All @@ -165,6 +165,8 @@ don't change or reuse the dependency graph: a mixed graph and call suite has sep
Use `clear_cache: true` or `ArchUnit.clear_graph_cache` after source edits in a long-lived process.
Included parse errors fail the check, even when the malformed file isn't selected by the rule.

<a id="layer-rules"></a>

## Layer rules

Use `ArchUnit.project_layers(project_locator = nil)` to name architectural layers and then declare
Expand Down Expand Up @@ -262,9 +264,9 @@ Thresholds use exactly `should_be_below`, `should_be_above`, `should_be`,
for a calculation over `ClassInfo`; zone guards are `not_in_zone_of_pain` and
`not_in_zone_of_uselessness`.

<a id="frameworks"></a>
<a id="class-declarations"></a>

## Class declaration selection (unreleased)
## Class declaration selection (1.2+)

~~~ ruby
selection = ArchUnit.project_classes(root)
Expand All @@ -289,7 +291,7 @@ selector covers all in-scope declaration sites for a class, not a particular fol
Use `CheckOptions.new(source_exclusions: ...)` to limit the source set. Cached declaration facts
refresh with `clear_cache: true` or `ArchUnit.clear_graph_cache`.

### Declared method signatures (unreleased)
### Declared method signatures (1.2+)

~~~ ruby
shape = ArchUnit::MethodSignature.new(name: :call, positional: 1, keywords: %i[actor request_id])
Expand Down Expand Up @@ -320,6 +322,8 @@ Confirmed failures can use baselines; the fingerprint includes the normalized se
expected shape. Unknowns fail a plain CLI check (exit 1) and reject baseline creation or use
before any accepted-debt write (exit 2).

<a id="frameworks"></a>

## Checking and test frameworks

Every architecture rule includes `ArchUnit::Checkable` and exposes `check(options = nil)`. It returns
Expand Down Expand Up @@ -384,7 +388,7 @@ and unknown operands remain unresolved. No Rails boot or automatic autoload-root
The option is immutable, validated and part of graph-cache identity; it composes with either
dependency-analysis mode. Cross-file method replacement and dynamic Rails/glob values are not modeled.

### Explicit Rails associations (unreleased)
### Explicit Rails associations (1.2+)

`CheckOptions.new(rails_associations: true)` independently enables dependencies from supported
Rails model calls such as `belongs_to :store, class_name: '::Storage::Store'`. It can be combined
Expand Down Expand Up @@ -424,11 +428,11 @@ mode participates in graph-cache identity, and `clear_cache: true` rebuilds the

### Semantic boundaries

Method-call restrictions, effective method/signature protocols, and semantic component selectors
are not provided by the current file graph or metric method facts. The bounded
The separate [named-call rules](#named-method-calls) and [declared-class rules](#class-declarations)
check source syntax, not runtime dispatch. Inherited, mixed-in, aliased, or generated methods do
not satisfy a declared signature rule. The earlier
[semantic evaluation](https://github.com/dragonsec-ai/ArchUnitRuby/blob/main/design/semantic-boundaries.md)
records exact comparator pins, executable probes and the compatibility/unknowns required before
adding such APIs. This is a technical evaluation, not a newly shipped semantic backend.
records comparator pins, executable probes, and open decisions for modeling effective methods.

<a id="presets"></a>

Expand Down Expand Up @@ -539,7 +543,7 @@ multiple roots can overlap, and a metric pass and a graph pass can inspect the s
Scopes describe synchronous built-in extraction in the current check, not arbitrary user work
started in other threads/fibers.

In the development version, `analysis.advisories` is an optional schema-1 array. Each entry has
As of 1.2, `analysis.advisories` is an optional schema-1 array. Each entry has
a stable `code`, affected `rule_names`, and the same `message` as the text report. The
`rails_no_scoped_imports` hint applies only to passing, populated Rails presets in imports mode
with zero cross-file imports among their selected files. It does not count skipped constants or
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog

## 1.1.1 (unreleased)
## 1.2.0 - 2026-11-28

Additive release over 1.1.0. Existing import-only checks and exhaustive cycle reporting remain
the defaults. The new class and call rules read source without running the application.

- Add file-scoped named method-call restrictions, with an optional bare-call mode, source
coordinates in test and CLI output, and explicit occurrence-based baseline support.
Expand Down Expand Up @@ -29,6 +32,8 @@
imports connect the selected files. Default rules, baselines and exit codes are unchanged.
- Add opt-in file cycle witnesses: one concrete path per cyclic group without enumerating all
paths. Exhaustive output stays the default and is required for path-based baselines.
- Help readers choose an analysis mode, fix Reference navigation and narrow-screen code/contents
layout in the documentation, and make the linked demo usable with the published gem.

## 1.1.0 - 2026-11-23

Expand Down
8 changes: 4 additions & 4 deletions GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ArchUnitRuby user guide

Recipes and operational details for the 1.x API, including the additions in 1.1.
Recipes and operational details for the 1.x API, including the additions in 1.1 and 1.2.
Start with the [README](README.md#quickstart), use this guide for complete workflows, and consult
the [API contract](API.md) for exact semantics. The documentation site follows `main`, not the
published gem. CLI, baselines, presets, Rails helper imports and caller-owned exclusions require
Expand Down Expand Up @@ -171,7 +171,7 @@ rule = ArchUnit.project_files.in_folder('app/services/**')
)
~~~

### Keep write calls out of query files (unreleased)
### Keep write calls out of query files (1.2+)

~~~ruby
rule = ArchUnit.project_files.in_path('app/queries/**')
Expand Down Expand Up @@ -503,7 +503,7 @@ This compatibility option models existing legacy/engine code, not complete Rails

<a id="rails-associations"></a>

### Explicit Rails association class names (unreleased, opt-in)
### Explicit Rails association class names (1.2+, opt-in)

An association may name a model in a string, with no import or ordinary constant reference:

Expand Down Expand Up @@ -774,7 +774,7 @@ ArchUnit.assert_passes(rule, options)
For a CLI-configured preset use `bundle exec archunit check --dependency-analysis imports_and_constants`.
Neither option boots Rails or reproduces its runtime autoloading.

In the development version, a passing imports-only Rails preset gets a CLI hint if all its
As of 1.2, a passing imports-only Rails preset gets a CLI hint if all its
layers contain files but no cross-file import connects any two selected files. A genuinely
independent set of files can also trigger the hint. It is not a violation or a count of missed
references, and it does not change the exit code. Plain Ruby, RSpec and Minitest checks stay silent.
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
archunit (1.1.1)
archunit (1.2.0)
csv (>= 3.3, < 4.0)
json (>= 2.7, < 3.0)
prism (>= 1.0, < 2.0)
Expand Down Expand Up @@ -114,7 +114,7 @@ DEPENDENCIES
yard (~> 0.9.45)

CHECKSUMS
archunit (1.1.1)
archunit (1.2.0)
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
bundler-audit (0.9.3) sha256=81c8766c71e47d0d28a0f98c7eed028539f21a6ea3cd8f685eb6f42333c9b4e9
csv (3.3.7) sha256=15a3f16f6628da8664d455eb634e7f22031bcf53044923caf56975109e71b9f8
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ of the [ArchUnitEverything family](#community), inspired by—but not affiliated
| --- | --- |
| `1.0` | Fluent file/layer/slice rules, cycles and naming, metrics, graph/diagram exports, RSpec/Minitest integrations, opt-in constant-file analysis |
| `1.1` | Everything in 1.0, plus CLI, analysis diagnostics, accepted-debt baselines, architecture presets, Rails helper imports, caller-owned source exclusions, and further extraction fixes |
| `1.2` | Named-call rules, selectors for declared classes, method-signature rules, compact cycle reports, and opt-in Rails association analysis |

This guide and its installation example target the **1.1 series**. Check
This guide and its installation example target the **1.2 series**. Check
[RubyGems](https://rubygems.org/gems/archunit) for published versions; the documentation site
follows `main` and can be ahead of the registry during release preparation.
Installing 1.0.0 does not provide the CLI or other 1.1 additions. See the
Expand All @@ -56,7 +57,7 @@ Ruby 3.3+ is required. Add ArchUnitRuby to your test dependencies:
~~~ruby
# Gemfile
group :test do
gem 'archunit', '~> 1.1.0'
gem 'archunit', '~> 1.2.0'
gem 'rspec' # Omit this line if RSpec is already in your bundle.
end
~~~
Expand Down Expand Up @@ -131,7 +132,9 @@ In a long-lived process, clear the graph cache after source edits; separate RSpe
| Capability | Public entry point | Details |
| --- | --- | --- |
| File boundaries, external modules, naming, locations, custom predicates | `project_files` | [File rules](API.md#file-rules) |
| Directed dependency cycles | `project_files.should.have_no_cycles` | [Rule recipes](GUIDE.md#recipes) |
| Directed dependency cycles, with compact witnesses in 1.2 | `project_files.should.have_no_cycles` | [Cycle checks](API.md#file-rules) |
| Restrict calls by name in selected files | `should_not.contain_calls_named` — **1.2+** | [Named-call rules](API.md#named-method-calls) |
| Select declared classes and require specific method signatures | `project_classes` — **1.2+** | [Class and method rules](API.md#class-declarations) |
| Named-layer allowlists and blocklists | `project_layers` | [Layer rules](API.md#layer-rules) |
| Component slices and PlantUML conformance | `project_slices` | [Slices and diagrams](API.md#slices) |
| Mermaid, DOT, D2, JSON, CSV, and offline HTML reports | `project_graph` | [Graph reports](API.md#graph-reports) |
Expand Down
4 changes: 2 additions & 2 deletions benchmark/study/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ../..
specs:
archunit (1.1.1)
archunit (1.2.0)
csv (>= 3.3, < 4.0)
json (>= 2.7, < 3.0)
prism (>= 1.0, < 2.0)
Expand Down Expand Up @@ -32,7 +32,7 @@ DEPENDENCIES

CHECKSUMS
archspec (1.1.0) sha256=861d4869c81617139ea9e42e6de1456ba00d0538f3994476073829de223a754d
archunit (1.1.1)
archunit (1.2.0)
csv (3.3.7) sha256=15a3f16f6628da8664d455eb634e7f22031bcf53044923caf56975109e71b9f8
json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
Expand Down
2 changes: 1 addition & 1 deletion lib/archunit/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ArchUnit
VERSION = '1.1.1'
VERSION = '1.2.0'
end