archunit 1.0.0 → 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 +213 -5
- data/CHANGELOG.md +41 -1
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +75 -0
- data/GUIDE.md +804 -0
- data/README.md +198 -562
- data/SECURITY.md +64 -0
- data/SUPPORT.md +23 -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/import_kind.rb +3 -1
- data/lib/archunit/common/extraction/source_exclusions.rb +43 -0
- data/lib/archunit/common/fluentapi/check_options.rb +13 -3
- 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/constant_visitor.rb +8 -0
- data/lib/archunit/extraction/dependency_context.rb +30 -0
- data/lib/archunit/extraction/enumerate_source_files.rb +17 -5
- data/lib/archunit/extraction/extract_dependencies.rb +5 -14
- data/lib/archunit/extraction/extract_graph.rb +45 -55
- data/lib/archunit/extraction/extract_imports.rb +11 -14
- 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 +11 -2
- data/lib/archunit/extraction/import_source_policy.rb +123 -0
- data/lib/archunit/extraction/import_visitor.rb +31 -46
- data/lib/archunit/extraction/load_arguments.rb +34 -0
- data/lib/archunit/extraction/local_string_tracker.rb +4 -3
- data/lib/archunit/extraction/resolve_load_paths.rb +5 -0
- data/lib/archunit/extraction/source_analysis.rb +26 -0
- data/lib/archunit/extraction/static_import_path.rb +111 -0
- data/lib/archunit/layers/fluentapi/architecture_preset.rb +49 -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 +1 -1
- data/lib/archunit/metrics/extraction/extract_project_info.rb +8 -4
- data/lib/archunit/metrics/fluentapi/metric_report_builder.rb +4 -3
- data/lib/archunit/metrics/fluentapi/metrics_builder.rb +3 -3
- data/lib/archunit/metrics/reporting/metrics_export_options.rb +6 -2
- data/lib/archunit/version.rb +1 -1
- data/lib/archunit.rb +2 -0
- metadata +48 -8
|
@@ -6,6 +6,7 @@ require_relative '../../error/technical_error'
|
|
|
6
6
|
require_relative '../../error/source_parse_error'
|
|
7
7
|
require_relative '../../extraction/enumerate_source_files'
|
|
8
8
|
require_relative '../../extraction/locate_project'
|
|
9
|
+
require_relative '../../extraction/source_analysis'
|
|
9
10
|
require_relative 'metric_info'
|
|
10
11
|
require_relative 'source_metrics_visitor'
|
|
11
12
|
|
|
@@ -15,12 +16,15 @@ module ArchUnit
|
|
|
15
16
|
module Extraction
|
|
16
17
|
module_function
|
|
17
18
|
|
|
18
|
-
def extract_project_info(project_locator = nil, exclude_patterns: nil)
|
|
19
|
+
def extract_project_info(project_locator = nil, exclude_patterns: nil, options: nil)
|
|
19
20
|
root = Pathname.new(ArchUnit::Extraction.locate_project(project_locator))
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
discovery = ArchUnit::Extraction.discover_source_files(root, exclude_patterns:, options:)
|
|
22
|
+
ArchUnit::Extraction::SourceAnalysis.observe(discovery) do
|
|
23
|
+
files = discovery.files.map do |path|
|
|
24
|
+
extract_file_info(root.join(path), relative_path: path)
|
|
25
|
+
end
|
|
26
|
+
ProjectInfo.new(project_root: root.to_s, files:)
|
|
22
27
|
end
|
|
23
|
-
ProjectInfo.new(project_root: root.to_s, files:)
|
|
24
28
|
end
|
|
25
29
|
|
|
26
30
|
def extract_file_info(source_file, relative_path: nil)
|
|
@@ -12,15 +12,16 @@ module ArchUnit
|
|
|
12
12
|
# @return [nil]
|
|
13
13
|
def export_as_html(output_path, options = nil)
|
|
14
14
|
options = Reporting::MetricsExportOptions.resolve(options).with(output_path:)
|
|
15
|
-
|
|
15
|
+
data = metric_report_data(options.check_options)
|
|
16
|
+
Reporting::MetricsExporter.export_as_html(data, options)
|
|
16
17
|
nil
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
private
|
|
20
21
|
|
|
21
|
-
def metric_report_data
|
|
22
|
+
def metric_report_data(check_options = nil)
|
|
22
23
|
report_metrics.group_by(&:subject_type).each_with_object({}) do |(type, metrics), data|
|
|
23
|
-
subjects = scope.__send__(:subjects_for, type)
|
|
24
|
+
subjects = scope.__send__(:subjects_for, type, options: check_options)
|
|
24
25
|
metrics.each { |metric| add_metric_values(data, subjects, metric) }
|
|
25
26
|
end.freeze
|
|
26
27
|
end
|
|
@@ -69,8 +69,8 @@ module ArchUnit
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
# @return [MetricProjectInfo] extracted files and classes in this scope
|
|
72
|
-
def analyze
|
|
73
|
-
project = Extraction.extract_project_info(project_locator)
|
|
72
|
+
def analyze(options = nil)
|
|
73
|
+
project = Extraction.extract_project_info(project_locator, options:)
|
|
74
74
|
selected_files = project.files.filter_map { |file| selected_file_info(file) }
|
|
75
75
|
Common::Logging::Inspection.selection('metric file', selected_files, &:path)
|
|
76
76
|
Extraction::ProjectInfo.new(project_root: project.project_root, files: selected_files)
|
|
@@ -85,7 +85,7 @@ module ArchUnit
|
|
|
85
85
|
def subjects_for(subject_type, options: nil)
|
|
86
86
|
return distance_subjects(options:) if subject_type == Extraction::DistanceInfo
|
|
87
87
|
|
|
88
|
-
project = analyze
|
|
88
|
+
project = analyze(options)
|
|
89
89
|
return project.files if subject_type == Extraction::FileInfo
|
|
90
90
|
return project.classes if subject_type == Extraction::ClassInfo
|
|
91
91
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative '../../common/fluentapi/check_options'
|
|
4
|
+
|
|
3
5
|
module ArchUnit
|
|
4
6
|
module Metrics
|
|
5
7
|
# Self-contained metrics report rendering and export.
|
|
6
8
|
module Reporting
|
|
7
9
|
# Immutable options for one metrics HTML report.
|
|
8
10
|
MetricsExportOptions = Data.define(
|
|
9
|
-
:output_path, :title, :include_timestamp, :custom_css
|
|
11
|
+
:output_path, :title, :include_timestamp, :custom_css, :check_options
|
|
10
12
|
) do
|
|
11
13
|
def self.resolve(value)
|
|
12
14
|
return new if value.nil?
|
|
@@ -19,7 +21,8 @@ module ArchUnit
|
|
|
19
21
|
output_path: nil,
|
|
20
22
|
title: 'ArchUnitRuby Metrics Report',
|
|
21
23
|
include_timestamp: true,
|
|
22
|
-
custom_css: nil
|
|
24
|
+
custom_css: nil,
|
|
25
|
+
check_options: nil
|
|
23
26
|
)
|
|
24
27
|
output_path = optional_path(output_path)
|
|
25
28
|
title = immutable_string(title, :title)
|
|
@@ -28,6 +31,7 @@ module ArchUnit
|
|
|
28
31
|
end
|
|
29
32
|
|
|
30
33
|
custom_css = optional_string(custom_css, :custom_css)
|
|
34
|
+
check_options = Common::FluentApi::CheckOptions.resolve(check_options)
|
|
31
35
|
super
|
|
32
36
|
end
|
|
33
37
|
|
data/lib/archunit/version.rb
CHANGED
data/lib/archunit.rb
CHANGED
|
@@ -36,6 +36,7 @@ require_relative 'archunit/extraction/extract_dependencies'
|
|
|
36
36
|
require_relative 'archunit/extraction/extract_graph'
|
|
37
37
|
require_relative 'archunit/files/fluentapi/files'
|
|
38
38
|
require_relative 'archunit/layers/fluentapi/layers'
|
|
39
|
+
require_relative 'archunit/layers/fluentapi/architecture_preset'
|
|
39
40
|
require_relative 'archunit/slices/fluentapi/slices'
|
|
40
41
|
require_relative 'archunit/graph/fluentapi/graph'
|
|
41
42
|
require_relative 'archunit/metrics/fluentapi/metrics'
|
|
@@ -68,6 +69,7 @@ module ArchUnit
|
|
|
68
69
|
CustomFileViolation = Files::Assertion::CustomFileViolation
|
|
69
70
|
LayerDefinition = Layers::Assertion::LayerDefinition
|
|
70
71
|
LayerDependencyViolation = Layers::Assertion::LayerDependencyViolation
|
|
72
|
+
PresetOptions = Layers::FluentApi::PresetOptions
|
|
71
73
|
SliceProjection = Slices::Projection::SliceProjection
|
|
72
74
|
SliceProjections = Slices::Projection
|
|
73
75
|
SliceDependencyViolation = Slices::Assertion::SliceDependencyViolation
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: archunit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ArchUnitRuby contributors
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
@@ -70,16 +70,40 @@ dependencies:
|
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
71
|
version: '2.0'
|
|
72
72
|
description: Define and enforce software architecture rules as ordinary Ruby tests.
|
|
73
|
-
executables:
|
|
73
|
+
executables:
|
|
74
|
+
- archunit
|
|
74
75
|
extensions: []
|
|
75
76
|
extra_rdoc_files: []
|
|
76
77
|
files:
|
|
77
78
|
- API.md
|
|
78
79
|
- CHANGELOG.md
|
|
80
|
+
- CODE_OF_CONDUCT.md
|
|
81
|
+
- CONTRIBUTING.md
|
|
82
|
+
- GUIDE.md
|
|
79
83
|
- LICENSE
|
|
80
84
|
- README.md
|
|
85
|
+
- SECURITY.md
|
|
86
|
+
- SUPPORT.md
|
|
81
87
|
- assets/logo-rounded.png
|
|
88
|
+
- exe/archunit
|
|
82
89
|
- lib/archunit.rb
|
|
90
|
+
- lib/archunit/cli.rb
|
|
91
|
+
- lib/archunit/cli/analysis_report.rb
|
|
92
|
+
- lib/archunit/cli/analysis_text.rb
|
|
93
|
+
- lib/archunit/cli/baseline_context.rb
|
|
94
|
+
- lib/archunit/cli/baseline_document.rb
|
|
95
|
+
- lib/archunit/cli/baseline_fingerprint.rb
|
|
96
|
+
- lib/archunit/cli/baseline_identity.rb
|
|
97
|
+
- lib/archunit/cli/baseline_ledger.rb
|
|
98
|
+
- lib/archunit/cli/baseline_object.rb
|
|
99
|
+
- lib/archunit/cli/baseline_options.rb
|
|
100
|
+
- lib/archunit/cli/baseline_run.rb
|
|
101
|
+
- lib/archunit/cli/baseline_schema.rb
|
|
102
|
+
- lib/archunit/cli/baseline_text.rb
|
|
103
|
+
- lib/archunit/cli/configuration.rb
|
|
104
|
+
- lib/archunit/cli/options.rb
|
|
105
|
+
- lib/archunit/cli/report.rb
|
|
106
|
+
- lib/archunit/cli/runner.rb
|
|
83
107
|
- lib/archunit/common/assertion/empty_test_violation.rb
|
|
84
108
|
- lib/archunit/common/assertion/violation.rb
|
|
85
109
|
- lib/archunit/common/extraction/dependency_evidence.rb
|
|
@@ -87,6 +111,7 @@ files:
|
|
|
87
111
|
- lib/archunit/common/extraction/graph.rb
|
|
88
112
|
- lib/archunit/common/extraction/import_kind.rb
|
|
89
113
|
- lib/archunit/common/extraction/parse_diagnostic.rb
|
|
114
|
+
- lib/archunit/common/extraction/source_exclusions.rb
|
|
90
115
|
- lib/archunit/common/filter.rb
|
|
91
116
|
- lib/archunit/common/fluentapi/check_options.rb
|
|
92
117
|
- lib/archunit/common/fluentapi/checkable.rb
|
|
@@ -108,23 +133,34 @@ files:
|
|
|
108
133
|
- lib/archunit/error/source_parse_error.rb
|
|
109
134
|
- lib/archunit/error/technical_error.rb
|
|
110
135
|
- lib/archunit/error/user_error.rb
|
|
136
|
+
- lib/archunit/extraction/analysis_observer.rb
|
|
137
|
+
- lib/archunit/extraction/analysis_profile.rb
|
|
138
|
+
- lib/archunit/extraction/analysis_snapshot.rb
|
|
111
139
|
- lib/archunit/extraction/arch_ignore.rb
|
|
112
140
|
- lib/archunit/extraction/conservative_local_flow.rb
|
|
113
141
|
- lib/archunit/extraction/constant_index.rb
|
|
114
142
|
- lib/archunit/extraction/constant_visitor.rb
|
|
143
|
+
- lib/archunit/extraction/dependency_context.rb
|
|
115
144
|
- lib/archunit/extraction/discover_gemspec_load_paths.rb
|
|
116
145
|
- lib/archunit/extraction/enumerate_source_files.rb
|
|
117
146
|
- lib/archunit/extraction/extract_dependencies.rb
|
|
118
147
|
- lib/archunit/extraction/extract_graph.rb
|
|
119
148
|
- lib/archunit/extraction/extract_imports.rb
|
|
120
149
|
- lib/archunit/extraction/extraction_profile.rb
|
|
150
|
+
- lib/archunit/extraction/graph_assembly.rb
|
|
151
|
+
- lib/archunit/extraction/graph_cache_key.rb
|
|
152
|
+
- lib/archunit/extraction/import_calls.rb
|
|
121
153
|
- lib/archunit/extraction/import_resolver.rb
|
|
154
|
+
- lib/archunit/extraction/import_source_policy.rb
|
|
122
155
|
- lib/archunit/extraction/import_visitor.rb
|
|
156
|
+
- lib/archunit/extraction/load_arguments.rb
|
|
123
157
|
- lib/archunit/extraction/local_string_tracker.rb
|
|
124
158
|
- lib/archunit/extraction/locate_project.rb
|
|
125
159
|
- lib/archunit/extraction/resolve_import.rb
|
|
126
160
|
- lib/archunit/extraction/resolve_load_paths.rb
|
|
127
161
|
- lib/archunit/extraction/resolved_import.rb
|
|
162
|
+
- lib/archunit/extraction/source_analysis.rb
|
|
163
|
+
- lib/archunit/extraction/static_import_path.rb
|
|
128
164
|
- lib/archunit/extraction/validate_extraction_paths.rb
|
|
129
165
|
- lib/archunit/files/assertion/custom_file_condition.rb
|
|
130
166
|
- lib/archunit/files/assertion/cycle_free.rb
|
|
@@ -173,11 +209,15 @@ files:
|
|
|
173
209
|
- lib/archunit/layers/assertion/layer_definition.rb
|
|
174
210
|
- lib/archunit/layers/assertion/layer_dependencies.rb
|
|
175
211
|
- lib/archunit/layers/assertion/layer_dependency_violation.rb
|
|
212
|
+
- lib/archunit/layers/fluentapi/architecture_preset.rb
|
|
176
213
|
- lib/archunit/layers/fluentapi/layer_definition_builder.rb
|
|
177
214
|
- lib/archunit/layers/fluentapi/layer_dependency_rule_builder.rb
|
|
178
215
|
- lib/archunit/layers/fluentapi/layered_architecture.rb
|
|
179
216
|
- lib/archunit/layers/fluentapi/layered_architecture_values.rb
|
|
180
217
|
- lib/archunit/layers/fluentapi/layers.rb
|
|
218
|
+
- lib/archunit/layers/fluentapi/preset_definitions.rb
|
|
219
|
+
- lib/archunit/layers/fluentapi/preset_options.rb
|
|
220
|
+
- lib/archunit/layers/fluentapi/preset_rule.rb
|
|
181
221
|
- lib/archunit/metrics/assertion/custom_metric.rb
|
|
182
222
|
- lib/archunit/metrics/assertion/metric_predicate.rb
|
|
183
223
|
- lib/archunit/metrics/assertion/metric_threshold.rb
|
|
@@ -239,14 +279,14 @@ files:
|
|
|
239
279
|
- lib/archunit/testing/test_violation.rb
|
|
240
280
|
- lib/archunit/testing/violation_factory.rb
|
|
241
281
|
- lib/archunit/version.rb
|
|
242
|
-
homepage: https://github.com/
|
|
282
|
+
homepage: https://github.com/dragonsec-ai/ArchUnitRuby
|
|
243
283
|
licenses:
|
|
244
284
|
- MIT
|
|
245
285
|
metadata:
|
|
246
|
-
source_code_uri: https://github.com/
|
|
247
|
-
documentation_uri: https://
|
|
248
|
-
bug_tracker_uri: https://github.com/
|
|
249
|
-
changelog_uri: https://github.com/
|
|
286
|
+
source_code_uri: https://github.com/dragonsec-ai/ArchUnitRuby
|
|
287
|
+
documentation_uri: https://dragonsec-ai.github.io/ArchUnitRuby/
|
|
288
|
+
bug_tracker_uri: https://github.com/dragonsec-ai/ArchUnitRuby/issues
|
|
289
|
+
changelog_uri: https://github.com/dragonsec-ai/ArchUnitRuby/blob/main/CHANGELOG.md
|
|
250
290
|
allowed_push_host: https://rubygems.org
|
|
251
291
|
rubygems_mfa_required: 'true'
|
|
252
292
|
rdoc_options: []
|