Skip to content
Open
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 Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ gem 'kramdown', '~> 2.5.2'
gem 'minitest', '~> 5.25'
gem 'rake', '~> 13.2'
gem 'rspec', '~> 3.13'
gem 'rubocop', '~> 1.80'
gem 'rubocop', '~> 1.92'
gem 'simplecov', '~> 0.22', require: false
gem 'yard', '~> 0.9.45'
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ GEM
language_server-protocol (3.17.0.6)
lint_roller (1.1.0)
minitest (5.27.0)
parallel (2.1.0)
parallel (2.3.0)
parser (3.3.12.0)
ast (~> 2.4.1)
racc
prism (1.9.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.4.2)
regexp_parser (2.12.0)
regexp_parser (2.13.1)
rexml (3.4.4)
rspec (3.13.2)
rspec-core (~> 3.13.0)
Expand All @@ -42,14 +42,14 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.7)
rubocop (1.89.0)
json (~> 2.3)
rubocop (1.92.0)
json (>= 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (>= 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
regexp_parser (>= 2.11.3, < 3.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
Expand All @@ -63,9 +63,9 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.2)
simplecov_json_formatter (0.1.4)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
unicode-display_width (3.3.0)
unicode-emoji (~> 4.3)
unicode-emoji (4.3.0)
yard (0.9.45)

PLATFORMS
Expand All @@ -78,7 +78,7 @@ DEPENDENCIES
minitest (~> 5.25)
rake (~> 13.2)
rspec (~> 3.13)
rubocop (~> 1.80)
rubocop (~> 1.92)
simplecov (~> 0.22)
yard (~> 0.9.45)

Expand All @@ -93,27 +93,27 @@ CHECKSUMS
language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5
parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
parallel (2.3.0) sha256=f75a3e904101ce6a1ccb6b8dc800cbafd42166d83330192438dcf29395167a6f
parser (3.3.12.0) sha256=21a6d7f755d5a24dfbdc6e6b772e4e879a52e7631a88bc5a3a134606052c9828
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
regexp_parser (2.13.1) sha256=5aedb6b7c35688f51e86eef17a15374dfd287c83f4ca644b2c5f3ec50a33b44b
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
rubocop (1.89.0) sha256=4dee8e3ee9c45e474834efd9e8d6fd031e8331c8dacdff0de4ad65ae0a6faae7
rubocop (1.92.0) sha256=2af68041fb2e70bd9321d0479b49fad07f8008a3d0758c83347b4917128c56e0
rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
unicode-display_width (3.3.0) sha256=4b7aa66a4b11db50f6f7e98411215cd0dd10eaecb665d36eec5bcacb3fa0b613
unicode-emoji (4.3.0) sha256=11c02fa73290378c066bb0562cd4c87d8e1b706fbbe0059ca12746a4244de8ce
yard (0.9.45) sha256=52e211493f7cb8a3ebf7e104a25a1e73937a3103092545d34cb88fafebb3dc51

BUNDLED WITH
Expand Down
3 changes: 1 addition & 2 deletions lib/archunit/files/extraction/file_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Extraction
FileInfo = Data.define(
:path, :name, :extension, :directory, :content, :lines_of_code
) do
# rubocop:disable Metrics/ParameterLists -- FileInfo has six required public fields.
# rubocop:disable-next Metrics/ParameterLists -- FileInfo has six required public fields.
def initialize(path:, name:, extension:, directory:, content:, lines_of_code:)
path = immutable_string(path, :path, allow_empty: false, normalize_path: true)
name = immutable_string(name, :name, allow_empty: false)
Expand All @@ -20,7 +20,6 @@ def initialize(path:, name:, extension:, directory:, content:, lines_of_code:)
lines_of_code = non_negative_integer(lines_of_code)
super
end
# rubocop:enable Metrics/ParameterLists

private

Expand Down
3 changes: 1 addition & 2 deletions lib/archunit/graph/projection/graph_query_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def self.resolve(value)
end

# The options bag deliberately mirrors the eight independent fluent modifiers.
# rubocop:disable Metrics/ParameterLists
# rubocop:disable-next Metrics/ParameterLists
def initialize(
include_external_dependencies: false, include_self_dependencies: false,
focus: nil, focus_depth: 1, reachable_from: nil, dependents_of: nil,
Expand All @@ -37,7 +37,6 @@ def initialize(
title = immutable_title(title)
super
end
# rubocop:enable Metrics/ParameterLists

def with(**overrides)
self.class.new(**to_h, **overrides)
Expand Down
3 changes: 1 addition & 2 deletions lib/archunit/metrics/extraction/extract_distance_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def build_distance_infos(project, outgoing, incoming)
end
private_class_method :build_distance_infos

# rubocop:disable Metrics/AbcSize -- Both directional indexes are built in one graph pass.
# rubocop:disable-next Metrics/AbcSize -- Both directional indexes are built in one graph pass.
def coupling_indexes(graph, file_paths)
outgoing = Hash.new { |hash, key| hash[key] = [] }
incoming = Hash.new { |hash, key| hash[key] = [] }
Expand All @@ -43,7 +43,6 @@ def coupling_indexes(graph, file_paths)
end
[outgoing, incoming]
end
# rubocop:enable Metrics/AbcSize
private_class_method :coupling_indexes
end
end
Expand Down
3 changes: 1 addition & 2 deletions lib/archunit/metrics/extraction/extract_project_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def visitor_counts(visitor)
end
private_class_method :visitor_counts

# rubocop:disable Metrics/MethodLength -- The state tracks Ruby's =begin/=end comments.
# rubocop:disable-next Metrics/MethodLength -- The state tracks Ruby's =begin/=end comments.
def lines_of_code(source)
in_block_comment = false
source.each_line.count do |line|
Expand All @@ -70,7 +70,6 @@ def lines_of_code(source)
end
end
end
# rubocop:enable Metrics/MethodLength
private_class_method :lines_of_code

def source_path(value)
Expand Down
6 changes: 2 additions & 4 deletions lib/archunit/metrics/extraction/metric_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def initialize(name:, accessed_by: [])
end

# Static information about one Ruby class declaration.
# rubocop:disable Lint/DataDefineOverride -- `methods` is the established metric vocabulary.
# rubocop:disable-next Lint/DataDefineOverride -- `methods` is the established metric vocabulary.
ClassInfo = Data.define(:name, :file_path, :methods, :fields) do
include ValueValidation

Expand All @@ -86,7 +86,6 @@ def identifier
"#{file_path}:#{name}"
end
end
# rubocop:enable Lint/DataDefineOverride

# Static counts and class declarations extracted from one Ruby source file.
FileInfo = Data.define(
Expand All @@ -102,7 +101,7 @@ def identifier
) do
include ValueValidation

# rubocop:disable Metrics/MethodLength, Metrics/ParameterLists -- Independent count facts.
# rubocop:disable-next Metrics/MethodLength, Metrics/ParameterLists -- Independent count facts.
def initialize(
path:,
lines_of_code:,
Expand Down Expand Up @@ -131,7 +130,6 @@ def initialize(

super
end
# rubocop:enable Metrics/MethodLength, Metrics/ParameterLists

def identifier
path
Expand Down
6 changes: 2 additions & 4 deletions lib/archunit/metrics/extraction/source_metrics_visitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module ArchUnit
module Metrics
module Extraction
# Collects Ruby-specific count and class-cohesion facts from a Prism tree.
# rubocop:disable Metrics/ClassLength -- One visitor owns the state of a single AST walk.
# rubocop:disable-next Metrics/ClassLength -- One visitor owns the state of a single AST walk.
class SourceMetricsVisitor < Prism::Visitor
IMPORT_METHODS = %i[autoload load require require_relative].freeze
ATTRIBUTE_METHODS = %i[attr_accessor attr_reader attr_writer].freeze
Expand Down Expand Up @@ -82,7 +82,7 @@ def visit_singleton_class_node(node)
@singleton_class_depth -= 1
end

# rubocop:disable Metrics/MethodLength -- The ensure keeps nested visitor state balanced.
# rubocop:disable-next Metrics/MethodLength -- The ensure keeps nested visitor state balanced.
def visit_def_node(node)
active_class = active_class_accumulator
unless active_class
Expand All @@ -97,7 +97,6 @@ def visit_def_node(node)
ensure
@method_stack.pop if active_class
end
# rubocop:enable Metrics/MethodLength

INSTANCE_VARIABLE_NODES.each do |visitor_method|
define_method(visitor_method) do |node|
Expand Down Expand Up @@ -271,7 +270,6 @@ def build_field_infos(methods)
end
end
end
# rubocop:enable Metrics/ClassLength
private_constant :SourceMetricsVisitor
end
end
Expand Down
3 changes: 1 addition & 2 deletions lib/archunit/testing/rspec_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ def matches?(rule)
end

# RSpec's matcher protocol fixes this method name.
# rubocop:disable Naming/PredicatePrefix
# rubocop:disable-next Naming/PredicatePrefix
def does_not_match?(rule)
matches_expectation?(rule, expected_to_pass: false)
end
# rubocop:enable Naming/PredicatePrefix

def failure_message
result.message
Expand Down
3 changes: 1 addition & 2 deletions spec/metrics/calculation/distance_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

RSpec.describe ArchUnit::DistanceMetrics do
# rubocop:disable Metrics/ParameterLists -- Named fixture dimensions keep formulas readable.
# rubocop:disable-next Metrics/ParameterLists -- Named fixture dimensions keep formulas readable.
def distance_info(
types: 1, abstract_types: 0, incoming: 0, outgoing: 0, files: 1, lines: 0
)
Expand All @@ -15,7 +15,6 @@ def distance_info(
efferent_coupling: outgoing, project_file_count: files
)
end
# rubocop:enable Metrics/ParameterLists

def values_for(info)
described_class::CALCULATIONS.to_h do |name, _calculation|
Expand Down
6 changes: 2 additions & 4 deletions spec/metrics/fluentapi/metrics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def write_source(root, relative_path, source)
File.write(path, source)
end

# rubocop:disable Metrics/MethodLength -- Both small files form one reusable fixture project.
# rubocop:disable-next Metrics/MethodLength -- Both small files form one reusable fixture project.
def build_project(root)
write_source(root, 'lib/models/order.rb', <<~RUBY)
class Sales::Order
Expand All @@ -26,9 +26,8 @@ def call
end
RUBY
end
# rubocop:enable Metrics/MethodLength

# rubocop:disable Metrics/MethodLength -- Four files create both distance zones.
# rubocop:disable-next Metrics/MethodLength -- Four files create both distance zones.
def build_distance_project(root)
write_source(root, 'lib/stable.rb', <<~RUBY)
class Stable
Expand All @@ -50,7 +49,6 @@ def perform
end
RUBY
end
# rubocop:enable Metrics/MethodLength

it 'builds immutable selectors without touching the filesystem' do
allow(ArchUnit::MetricExtraction).to receive(:extract_project_info).and_call_original
Expand Down
Loading