Skip to content
Closed
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.90'
gem 'simplecov', '~> 0.22', require: false
gem 'yard', '~> 0.9.45'
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ 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.90.0)
json (>= 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (>= 1.10)
Expand Down Expand Up @@ -78,7 +78,7 @@ DEPENDENCIES
minitest (~> 5.25)
rake (~> 13.2)
rspec (~> 3.13)
rubocop (~> 1.80)
rubocop (~> 1.90)
simplecov (~> 0.22)
yard (~> 0.9.45)

Expand Down Expand Up @@ -106,7 +106,7 @@ CHECKSUMS
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.90.0) sha256=9eb4c065b5c5154e4ef554c547972f3905a9eb6b53e657e580b6796b54bf8242
rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
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