slim_lint 0.33.0 → 0.34.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: '08768fa2264ad994c53a3e0f993fa0caa38e300c77ae64d5531e972c440aeaaf'
4
- data.tar.gz: bff84f96661b0c46c2a5445b37da6932b00ee2e2fa56e2ed1e8e76228db98bf5
3
+ metadata.gz: 3586e4fdad857cd9982603d97fd17acca434ef45caabe63ad6df523d1ca7ed76
4
+ data.tar.gz: 56bf2830ea686935a7ab26b6128fc4a3aa367ddb0de20a0ed6cbcd3f1b771338
5
5
  SHA512:
6
- metadata.gz: 763da1e8ccb05a25e7c54813363fa86ad340d387a3dedf1b3a41ef8f0cada1e413861e7159bda4931bbe45150ae11314c79e51233ac054eb9f7684245d8b0091
7
- data.tar.gz: a5eb859a052ff7276ecef9718b4a0952aa8ddc77738313a047c67773ae7b1556e49a051f101e30de92014f26e8e894b1733e30eacbe4b28b452c9ea0124226f5
6
+ metadata.gz: 0b8b60196d99f38fff022cd248b40bfbcd5ce7d0fd82ce2ff8eb3e1e1bdf1a7582537e7d4b2a2c9c9eb7713d0dc6f58a002e029889a11f69d76b7d0b61636d4c
7
+ data.tar.gz: 324ef5fbb06bf9b81134ff9fbf698bf02482f66ab0f42f10f2685f06524a6d2b1353310a5c9fe4feb001bffcd541c99036904bc4501f9af9607bf9cf6b68bbdc
data/lib/slim_lint/cli.rb CHANGED
@@ -65,7 +65,7 @@ module SlimLint
65
65
  # exception.
66
66
  def handle_exception(exception)
67
67
  case exception
68
- when SlimLint::Exceptions::ConfigurationError
68
+ when SlimLint::Exceptions::ConfigurationError, SlimLint::NoSuchLinter
69
69
  log.error exception.message
70
70
  EX_CONFIG
71
71
  when SlimLint::Exceptions::InvalidCLIOption
@@ -82,9 +82,25 @@ module SlimLint
82
82
  def validate
83
83
  ensure_exclude_option_array_exists
84
84
  ensure_linter_section_exists
85
+ ensure_linter_names_are_valid
85
86
  ensure_linter_include_exclude_arrays_exist
86
87
  end
87
88
 
89
+ # Ensures all linter names in the configuration are valid.
90
+ def ensure_linter_names_are_valid
91
+ return if @hash['linters'].nil?
92
+
93
+ valid_names = SlimLint::LinterRegistry.linter_names
94
+ return if valid_names.empty? # Skip if linters not yet loaded
95
+
96
+ @hash['linters'].each_key do |linter_name|
97
+ next if valid_names.include?(linter_name)
98
+
99
+ raise SlimLint::NoSuchLinter,
100
+ "No such linter: #{linter_name}. Available: #{valid_names.join(', ')}"
101
+ end
102
+ end
103
+
88
104
  # Ensures the `exclude` global option is an array.
89
105
  def ensure_exclude_option_array_exists
90
106
  @hash['exclude'] = Array(@hash['exclude'])
@@ -11,6 +11,13 @@ module SlimLint
11
11
  # List of all registered linters.
12
12
  attr_reader :linters
13
13
 
14
+ # Returns the short names of all registered linters.
15
+ #
16
+ # @return [Array<String>]
17
+ def linter_names
18
+ @linters.map { |linter| linter.name.split('::').last }
19
+ end
20
+
14
21
  # Executed when a linter includes the {LinterRegistry} module.
15
22
  #
16
23
  # This results in the linter being registered with the registry.
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module SlimLint
5
- VERSION = '0.33.0'
5
+ VERSION = '0.34.0'
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.33.0
4
+ version: 0.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-21 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rexml
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  requirements: []
185
- rubygems_version: 3.6.2
185
+ rubygems_version: 3.6.9
186
186
  specification_version: 4
187
187
  summary: Slim template linting tool
188
188
  test_files: []