slim_lint 0.32.1 → 0.32.2

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: 7bb0508b633b0d797349808a09eb0c7e084abf03136bf28155d3bfd927149f86
4
- data.tar.gz: 8202662b68b499ee1488c79ab65b8231803f2c23f90314bd3f127581341af43a
3
+ metadata.gz: fd046a032cb7d554e447d0e2ef1a790ff22f163eb734450d330ab1fc769c575b
4
+ data.tar.gz: 676860f6eb8fce36a54d82efab06fbf38dab1a68139ce330dbd16b4cdc42d7d5
5
5
  SHA512:
6
- metadata.gz: '024763359c3de59b1ea5015dd9aabff5f5623ef4dbf37a12d09eeb232e0972fa184a8b59e56098bdc5dfdaf2b6dfa95f2da886b662fa5cb2095cf6470a7f056e'
7
- data.tar.gz: 6aadfc640e92aa731591d293b32bcb2e3d2b1113a8d066abe796ca48cfa011154a50e6782192bd48aa4e7196b4224d912b430f1502b4eaa115f24a6a847175af
6
+ metadata.gz: d81d8c6bcc920c6d3c676da85d87d7c1792468428bfa3045af11bf45222ee70faf12d4d8383e30889453eb0f08d0fce7b43b65cb8ad7c1fadcd0da27ac4262b6
7
+ data.tar.gz: 887d73d3cec672e79987668bd733ae90a2c60d505b17ba6a7bcb7cf5ffcd71a43fbc5b501b2d51032945d4612baf7a85d57803a6e07c7c56af0e06f4425558bb
@@ -11,6 +11,14 @@ module SlimLint
11
11
  class Linter::RuboCop < Linter
12
12
  include LinterRegistry
13
13
 
14
+ # Initializes a RuboCop linter with the specified configuration.
15
+ #
16
+ # @param config [Hash] configuration for this linter
17
+ def initialize(config)
18
+ super(config)
19
+ @rubocop = ::RuboCop::CLI.new
20
+ end
21
+
14
22
  on_start do |_sexp|
15
23
  processed_sexp = SlimLint::RubyExtractEngine.new.call(document.source)
16
24
 
@@ -31,22 +39,19 @@ module SlimLint
31
39
  # @param source_map [Hash] map of Ruby code line numbers to original line
32
40
  # numbers in the template
33
41
  def find_lints(ruby, source_map)
34
- rubocop = ::RuboCop::CLI.new
35
-
36
42
  filename = document.file ? "#{document.file}.rb" : 'ruby_script.rb'
37
43
 
38
44
  with_ruby_from_stdin(ruby) do
39
- extract_lints_from_offenses(lint_file(rubocop, filename), source_map)
45
+ extract_lints_from_offenses(lint_file(filename), source_map)
40
46
  end
41
47
  end
42
48
 
43
49
  # Defined so we can stub the results in tests
44
50
  #
45
- # @param rubocop [RuboCop::CLI]
46
51
  # @param file [String]
47
52
  # @return [Array<RuboCop::Cop::Offense>]
48
- def lint_file(rubocop, file)
49
- rubocop.run(rubocop_flags << file)
53
+ def lint_file(file)
54
+ @rubocop.run(rubocop_flags << file)
50
55
  OffenseCollector.offenses
51
56
  end
52
57
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module SlimLint
5
- VERSION = '0.32.1'
5
+ VERSION = '0.32.2'
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slim_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.1
4
+ version: 0.32.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-04 00:00:00.000000000 Z
10
+ date: 2025-03-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rexml