rubycritic 4.10.0 → 4.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffa925049a3ca35743b419abfa744f93b7a4c7f3a5c6ee702703eff959c05177
4
- data.tar.gz: 1349a8bf0b72de99e5d7415dc3fd59dbacfe93683a20c5e7c25285243a11f28e
3
+ metadata.gz: 157017151022a109530d1ffcd1e5dfba4426bc52402374b9c18783557babf73b
4
+ data.tar.gz: b131aa27676576517687cf8cbc32c1fa0faf99f309cb2c5dd398ec5e8d704ccb
5
5
  SHA512:
6
- metadata.gz: b7487d521e1c7070d3cb30430e8d5ea023a2baad07a69a2d0e540ba28c014d7caef9b9727585b0731775281cde5a31f1f7a20fb46112e4eb86c6938f2b249fe2
7
- data.tar.gz: eb343b8c57606946ccc3439275eb829c06cf52c3557f63661c85923a4b1a7babc587ba3bcdabf3297adc69a725ad62fde6c2cc0634890ba24176d89c599e9145
6
+ metadata.gz: 4c7278a159f2fb51b0f1398a38388c0e54ad2164c5ea35c34c5dad38d07219e09c63f92d3038fd091d786a1055e1df9f9bf8854139c6512177ac9068d8e9e131
7
+ data.tar.gz: 864313501b155e876fdb8b83c6cf9f079eb22c2b706ff1d7f93239b03069d965dc1bbc1250e05bd46bf716437f15a2a063cb6f83990c2e9ce849345d7eadf9a1
data/CHANGELOG.md CHANGED
@@ -1,4 +1,24 @@
1
- # main [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.9.2...main)
1
+ # main [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.11.0...main)
2
+
3
+ * [CHANGE] ...
4
+ * [BUGFIX] ...
5
+ * [CHORE] ...
6
+ * [FEATURE] ...
7
+
8
+ # v4.12.0 / 2026-01-25 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.11.0...v4.12.0)
9
+
10
+ * [CHANGE] Bump cucumber dependency (by [@faisal][])
11
+ * [BUGFIX] Fixed regression in compatibility with Flog 4.9.0 (by [@faisal][])
12
+ * [CHANGE] Bump mocha dependency (by [@faisal][])
13
+ * [CHORE] Update CI checkout action to v6 (by [@faisal][]])
14
+ * [CHORE] Uses prism instead of parser for Ruby 3.4 and above (by [@torresga][] and [@julioalucero][])
15
+ * [BUGFIX] Respect excluded paths from .reek configuration file during reek analysis (by [@fbuys][])
16
+
17
+ # v4.11.0 / 2025-10-15 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.10.0...v4.11.0)
18
+
19
+ * [CHANGE] Bump cucumber dependency (by [@faisal][])
20
+ * [CHANGE] Performance improvement for churn calculation: Memoize call to `git rev-parse --show-toplevel` for churn calculations (by [@mateusdeap][])
21
+ * [CHANGE] Bump minitest dependency. (by [@faisal][])
2
22
 
3
23
  # v4.10.0 / 2025-07-30 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.9.2...v4.10.0)
4
24
 
@@ -23,6 +43,8 @@
23
43
  * [CHANGE] Fix some typos (by [@jbampton][])
24
44
  * [FEATURE] Add coverage_path configuration option (by [@exoego][])
25
45
 
46
+ * [CHANGE] Add support for wildcard entries to the paths option in rubycritic.yml (by [@rishiain][])
47
+
26
48
  # v4.9.0 / 2023-10-18 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.8.1...v4.9.0)
27
49
 
28
50
  * [CHANGE] Bump aruba, cucumber, fakefs, flog, mdl, minitest, and rubocop dependencies (by [@faisal][])
data/README.md CHANGED
@@ -154,6 +154,7 @@ minimum_score: 95 # default is 0
154
154
  paths: # Files to analyse. Churn calculation is scoped to these files when using Git SCM.
155
155
  - 'app/controllers/'
156
156
  - 'app/models/'
157
+ - 'lib/**' # Wildcard patterns are supported (excludes tmp directories automatically)
157
158
  ```
158
159
 
159
160
  ### Analyzer Configuration
@@ -243,9 +244,9 @@ RubyCritic is supporting Ruby versions:
243
244
  | 2.4 | [v4.7.0](https://github.com/whitesmith/rubycritic/tree/v4.7.0) |
244
245
  | 2.5 | [v4.7.0](https://github.com/whitesmith/rubycritic/tree/v4.7.0) |
245
246
  | 2.6 | [v4.7.0](https://github.com/whitesmith/rubycritic/tree/v4.7.0) |
246
- | 2.7 | [v4.9.x](https://github.com/whitesmith/rubycritic/tree/v4.9.1) |
247
- | 3.0 | latest |
248
- | 3.1 | latest |
247
+ | 2.7 | [v4.9.1](https://github.com/whitesmith/rubycritic/tree/v4.9.1) |
248
+ | 3.0 | [v4.9.2](https://github.com/whitesmith/rubycritic/tree/v4.9.1) |
249
+ | 3.1 | [v4.12.0](https://github.com/whitesmith/rubycritic/tree/v4.12.0) |
249
250
  | 3.2 | latest |
250
251
  | 3.3 | latest |
251
252
 
@@ -11,7 +11,7 @@ module RubyCritic
11
11
  }.freeze
12
12
 
13
13
  def initialize
14
- super(DEFAULT_OPTIONS)
14
+ super(DEFAULT_OPTIONS.clone(freeze: false))
15
15
  end
16
16
  end
17
17
  end
@@ -1,14 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'parser/current'
4
- require 'rubycritic/analysers/helpers/ast_node'
5
-
6
3
  module RubyCritic
7
4
  module Parser
8
5
  def self.parse(content)
9
- ::Parser::CurrentRuby.parse(content) || AST::EmptyNode.new
6
+ parser = parser_class
7
+ require 'rubycritic/analysers/helpers/ast_node'
8
+ parser.parse(content) || AST::EmptyNode.new
10
9
  rescue ::Parser::SyntaxError
11
10
  AST::EmptyNode.new
12
11
  end
12
+
13
+ def self.parser_class
14
+ return @parser_class if defined?(@parser_class) && @parser_class
15
+
16
+ @parser_class =
17
+ if Gem::Version.new(RUBY_VERSION) <= '3.3'
18
+ require 'parser/current'
19
+ ::Parser::CurrentRuby
20
+ else
21
+ require 'prism'
22
+ ::Prism::Translation::ParserCurrent
23
+ end
24
+ end
25
+ private_class_method :parser_class
13
26
  end
14
27
  end
@@ -10,7 +10,7 @@ module RubyCritic
10
10
  include Colorize
11
11
 
12
12
  def initialize(analysed_modules)
13
- @analysed_modules = analysed_modules
13
+ @analysed_modules = analysed_modules.reject { Reek.configuration.path_excluded?(_1.pathname) }
14
14
  end
15
15
 
16
16
  def run
@@ -21,11 +21,16 @@ module RubyCritic
21
21
  self.no_browser = options[:no_browser]
22
22
  self.coverage_path = options[:coverage_path]
23
23
  self.threshold_score = options[:threshold_score].to_i
24
+ setup_paths_for_targets(options) if options[:paths]
24
25
  setup_analysis_targets(options)
25
26
  setup_version_control(options)
26
27
  setup_formats(options)
27
28
  end
28
29
 
30
+ def setup_paths_for_targets(options)
31
+ options[:paths] = find_directories(options[:paths])
32
+ end
33
+
29
34
  def setup_analysis_targets(options)
30
35
  self.paths = options[:paths] || ['.']
31
36
  self.ruby_extensions = options[:ruby_extensions] || %w[.rb .rake .thor]
@@ -51,6 +56,20 @@ module RubyCritic
51
56
  source_control_system &&
52
57
  !source_control_system.is_a?(SourceControlSystem::Double)
53
58
  end
59
+
60
+ private
61
+
62
+ def find_directories(paths)
63
+ expanded_paths = paths.flat_map do |path|
64
+ if path.include?('**')
65
+ search_pattern = File.join(path)
66
+ Dir.glob(search_pattern).select { |tmp_path| File.directory?(tmp_path) && !tmp_path.start_with?('tmp') }
67
+ else
68
+ path
69
+ end
70
+ end
71
+ expanded_paths
72
+ end
54
73
  end
55
74
 
56
75
  module Config
@@ -123,7 +123,7 @@ module RubyCritic
123
123
  # :reek:DuplicateMethodCall
124
124
  def filename_for_subdirectory(filename)
125
125
  if @git_root == Dir.pwd
126
- git_path = Git.git('rev-parse --show-toplevel')
126
+ git_path = git_top_level
127
127
  cd_path = Dir.pwd
128
128
  if cd_path.length > git_path.length
129
129
  filename = filename.sub(/^#{Regexp.escape("#{File.basename(cd_path)}/")}/, '')
@@ -134,6 +134,10 @@ module RubyCritic
134
134
  end
135
135
  end
136
136
 
137
+ def git_top_level
138
+ @git_top_level ||= Git.git('rev-parse --show-toplevel').strip
139
+ end
140
+
137
141
  def process_file(filename)
138
142
  record_commit(renames.current(filename), @date)
139
143
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyCritic
4
- VERSION = '4.10.0'
4
+ VERSION = '4.12.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.10.0
4
+ version: 4.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Simoes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-30 00:00:00.000000000 Z
11
+ date: 2026-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flay
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.3.0.5
69
+ - !ruby/object:Gem::Dependency
70
+ name: prism
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.6.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.6.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rainbow
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -230,20 +244,20 @@ dependencies:
230
244
  requirements:
231
245
  - - "~>"
232
246
  - !ruby/object:Gem::Version
233
- version: 10.0.0
234
- - - "!="
247
+ version: 10.2.0
248
+ - - ">="
235
249
  - !ruby/object:Gem::Version
236
- version: 9.0.0
250
+ version: 10.1.0
237
251
  type: :development
238
252
  prerelease: false
239
253
  version_requirements: !ruby/object:Gem::Requirement
240
254
  requirements:
241
255
  - - "~>"
242
256
  - !ruby/object:Gem::Version
243
- version: 10.0.0
244
- - - "!="
257
+ version: 10.2.0
258
+ - - ">="
245
259
  - !ruby/object:Gem::Version
246
- version: 9.0.0
260
+ version: 10.1.0
247
261
  - !ruby/object:Gem::Dependency
248
262
  name: diff-lcs
249
263
  requirement: !ruby/object:Gem::Requirement
@@ -312,7 +326,7 @@ dependencies:
312
326
  requirements:
313
327
  - - "~>"
314
328
  - !ruby/object:Gem::Version
315
- version: 5.25.2
329
+ version: 5.26.0
316
330
  - - ">="
317
331
  - !ruby/object:Gem::Version
318
332
  version: 5.3.0
@@ -322,7 +336,7 @@ dependencies:
322
336
  requirements:
323
337
  - - "~>"
324
338
  - !ruby/object:Gem::Version
325
- version: 5.25.2
339
+ version: 5.26.0
326
340
  - - ">="
327
341
  - !ruby/object:Gem::Version
328
342
  version: 5.3.0
@@ -352,14 +366,14 @@ dependencies:
352
366
  requirements:
353
367
  - - "~>"
354
368
  - !ruby/object:Gem::Version
355
- version: 2.7.1
369
+ version: 2.8.0
356
370
  type: :development
357
371
  prerelease: false
358
372
  version_requirements: !ruby/object:Gem::Requirement
359
373
  requirements:
360
374
  - - "~>"
361
375
  - !ruby/object:Gem::Version
362
- version: 2.7.1
376
+ version: 2.8.0
363
377
  - !ruby/object:Gem::Dependency
364
378
  name: ostruct
365
379
  requirement: !ruby/object:Gem::Requirement
@@ -627,7 +641,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
627
641
  - !ruby/object:Gem::Version
628
642
  version: '0'
629
643
  requirements: []
630
- rubygems_version: 3.5.22
644
+ rubygems_version: 3.3.26
631
645
  signing_key:
632
646
  specification_version: 4
633
647
  summary: RubyCritic is a Ruby code quality reporter