scss_lint 0.40.0 → 0.40.1

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
  SHA1:
3
- metadata.gz: 2875735c6ff15b0a0c04496ae19043825c289c95
4
- data.tar.gz: abf49a6521c68efcedcf413a15208983bd116914
3
+ metadata.gz: 3d64ee14edbfefaee47bcf0b30500c2ee83231c0
4
+ data.tar.gz: 513d15bc52ea0f5d854972d661053c6ccc79f855
5
5
  SHA512:
6
- metadata.gz: f14a4ee19fc7124cadc19e33fa9f3ee8232f9b34c27bb2824100d4400d998e590004b214ccefc3b37b97490f167aef0950dc1775467e84d5fe2fa63ad6f37798
7
- data.tar.gz: 56abaad1303a536a32d57a6cfc3862144c05e5a4c6140e377745a7a801bbd9ba9bd43fdb397527532918aa3203579473dcd0336f0e387e15e223d7194eef8628
6
+ metadata.gz: 60cff3d31434509cb38dcee086f0f877f4346f5c9cb060d26897193e02b21e5c5109fe68dbc53f3bd99c4ca31ec09746a698ae5b8eed9ede9f57dd1dbf494777
7
+ data.tar.gz: 386501b6cb355a6924e1e2f6c0741a68dd54a7245fd28f7b71dac6488c32e79322d435bb1f5d69a419b680bdc30aefca0bfe604b104f697054e5ae6cc81a98ec
@@ -208,7 +208,18 @@ module SCSSLint
208
208
  end
209
209
 
210
210
  def load_plugins
211
- load_plugins_and_merge_config.tap { ensure_plugins_have_default_options }
211
+ previous_linters = LinterRegistry.linters
212
+ plugins = SCSSLint::Plugins.new(self).load
213
+ new_linters = LinterRegistry.linters - previous_linters
214
+
215
+ plugins.each do |plugin|
216
+ # Have the plugin options be overrideable by the local configuration
217
+ @options = self.class.send(:smart_merge, plugin.config.options, @options)
218
+ end
219
+
220
+ # We only want to set defaults for linters introduced via plugins,
221
+ # otherwise we'll accidentally enable some linters
222
+ ensure_linters_have_default_options(new_linters)
212
223
  end
213
224
 
214
225
  def enabled_linters
@@ -218,7 +229,7 @@ module SCSSLint
218
229
  end
219
230
 
220
231
  def linter_enabled?(linter)
221
- linter_options(linter)['enabled']
232
+ (linter_options(linter) || {}).fetch('enabled', false)
222
233
  end
223
234
 
224
235
  def enable_linter(linter)
@@ -236,7 +247,7 @@ module SCSSLint
236
247
  end
237
248
 
238
249
  def linter_options(linter)
239
- @options['linters'][self.class.linter_name(linter)]
250
+ @options['linters'].fetch(self.class.linter_name(linter), {})
240
251
  end
241
252
 
242
253
  def excluded_file?(file_path)
@@ -289,15 +300,8 @@ module SCSSLint
289
300
  end
290
301
  end
291
302
 
292
- def load_plugins_and_merge_config
293
- SCSSLint::Plugins.new(self).load.each do |plugin|
294
- # Have the plugin options be overrideable by the local configuration
295
- @options = self.class.send(:smart_merge, plugin.config.options, @options)
296
- end
297
- end
298
-
299
- def ensure_plugins_have_default_options
300
- LinterRegistry.linters.each do |linter|
303
+ def ensure_linters_have_default_options(linters)
304
+ linters.each do |linter|
301
305
  if linter_options(linter).nil?
302
306
  @options['linters'].merge!(default_plugin_options(linter))
303
307
  end
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module SCSSLint
3
- VERSION = '0.40.0'
3
+ VERSION = '0.40.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scss_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.0
4
+ version: 0.40.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brigade Engineering