archspec 0.3.0 → 0.5.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/README.md +30 -11
- data/lib/archspec/analyzer.rb +224 -59
- data/lib/archspec/architectures.rb +134 -28
- data/lib/archspec/cli.rb +42 -88
- data/lib/archspec/component_spec.rb +3 -0
- data/lib/archspec/definition.rb +12 -4
- data/lib/archspec/diagnostic.rb +7 -1
- data/lib/archspec/dsl.rb +220 -16
- data/lib/archspec/evaluator.rb +4 -3
- data/lib/archspec/formatters/explanation.rb +93 -0
- data/lib/archspec/model.rb +61 -13
- data/lib/archspec/rules/component_rules.rb +2 -0
- data/lib/archspec/rules/concern_rules.rb +67 -0
- data/lib/archspec/rules/cycle_rule.rb +2 -0
- data/lib/archspec/rules/dependency_rules.rb +65 -0
- data/lib/archspec/rules/naming_rules.rb +209 -0
- data/lib/archspec/rules/privacy_rule.rb +81 -0
- data/lib/archspec/rules/protocol_rules.rb +62 -13
- data/lib/archspec/{baseline.rb → todo.rb} +5 -1
- data/lib/archspec/version.rb +1 -1
- data/lib/archspec.rb +40 -3
- metadata +21 -5
- data/lib/archspec/presets.rb +0 -11
- data/lib/archspec/rules/zeitwerk_rule.rb +0 -27
data/lib/archspec/presets.rb
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module ArchSpec
|
|
4
|
-
module Rules
|
|
5
|
-
class ZeitwerkNamingRule
|
|
6
|
-
def id
|
|
7
|
-
'zeitwerk.naming'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def evaluate(graph)
|
|
11
|
-
graph.files.values.filter_map do |file|
|
|
12
|
-
next unless file.expected_constant
|
|
13
|
-
|
|
14
|
-
defined = graph.constants_for_path(file.path).map(&:name)
|
|
15
|
-
next if defined.include?(file.expected_constant)
|
|
16
|
-
|
|
17
|
-
Diagnostic.new(
|
|
18
|
-
rule: id,
|
|
19
|
-
message: "#{file.relative_path} should define #{file.expected_constant}",
|
|
20
|
-
location: SourceLocation.new(file.path, 1, 1),
|
|
21
|
-
evidence: "defined constants: #{defined.empty? ? '(none)' : defined.join(', ')}"
|
|
22
|
-
)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|