scss_lint 0.57.0 → 0.60.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.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/MIT-LICENSE +1 -2
  3. data/data/properties.txt +28 -0
  4. data/data/property-sort-orders/smacss.txt +5 -0
  5. data/data/pseudo-elements.txt +2 -0
  6. data/lib/scss_lint/cli.rb +4 -4
  7. data/lib/scss_lint/config.rb +2 -5
  8. data/lib/scss_lint/constants.rb +1 -1
  9. data/lib/scss_lint/engine.rb +5 -5
  10. data/lib/scss_lint/linter/chained_classes.rb +1 -1
  11. data/lib/scss_lint/linter/color_variable.rb +0 -3
  12. data/lib/scss_lint/linter/disable_linter_reason.rb +3 -3
  13. data/lib/scss_lint/linter/hex_length.rb +1 -1
  14. data/lib/scss_lint/linter/hex_notation.rb +1 -1
  15. data/lib/scss_lint/linter/hex_validation.rb +2 -2
  16. data/lib/scss_lint/linter/indentation.rb +1 -1
  17. data/lib/scss_lint/linter/leading_zero.rb +1 -1
  18. data/lib/scss_lint/linter/length_variable.rb +1 -1
  19. data/lib/scss_lint/linter/property_units.rb +1 -1
  20. data/lib/scss_lint/linter/selector_depth.rb +1 -1
  21. data/lib/scss_lint/linter/shorthand.rb +1 -1
  22. data/lib/scss_lint/linter/space_around_operator.rb +1 -1
  23. data/lib/scss_lint/linter/space_between_parens.rb +2 -2
  24. data/lib/scss_lint/linter/string_quotes.rb +2 -2
  25. data/lib/scss_lint/linter/trailing_semicolon.rb +1 -1
  26. data/lib/scss_lint/linter/trailing_whitespace.rb +1 -1
  27. data/lib/scss_lint/linter/trailing_zero.rb +1 -1
  28. data/lib/scss_lint/linter/unnecessary_mantissa.rb +2 -2
  29. data/lib/scss_lint/linter/url_format.rb +2 -2
  30. data/lib/scss_lint/linter/url_quotes.rb +2 -2
  31. data/lib/scss_lint/linter/vendor_prefix.rb +1 -1
  32. data/lib/scss_lint/linter/zero_unit.rb +1 -1
  33. data/lib/scss_lint/linter.rb +1 -1
  34. data/lib/scss_lint/options.rb +3 -3
  35. data/lib/scss_lint/rake_task.rb +1 -1
  36. data/lib/scss_lint/runner.rb +8 -8
  37. data/lib/scss_lint/utils.rb +1 -1
  38. data/lib/scss_lint/version.rb +1 -1
  39. data/spec/scss_lint/linter/duplicate_property_spec.rb +1 -1
  40. data/spec/scss_lint/linter/length_variable_spec.rb +1 -1
  41. data/spec/scss_lint/plugins/linter_dir_spec.rb +1 -1
  42. metadata +83 -100
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0d1f5b2c584f66d7148053a525c0323e872fa08a
4
- data.tar.gz: 8abdb50bcfff6c9b23fe3b01dacb66d602f565d2
2
+ SHA256:
3
+ metadata.gz: 570475ca333090a33a54d608ce015b5164c56b4b195d775cb96d4e01178a5c24
4
+ data.tar.gz: 02da18b960f297a62eb8f84736452bfd2aa0107cbac27ea532fbda399dfe0300
5
5
  SHA512:
6
- metadata.gz: 30822ae6faef50aa2d253cb88c2c7afce9e0e45fcaba3a9a4d5e4d3edbdaa5618c9f2d997121a61c96a280330f9bfb51918f14da0c53bff36dc400373f8a2015
7
- data.tar.gz: 26fefc161597ed2f735e3315475c2cf70b3c780b2593ad6294ddbcee0fcad9834c2cb4e53897a0884926ffe4f756660b2fc6b1d043c7bef076a25de20dfc6603
6
+ metadata.gz: ed25ade8dbb9e0f16674924ecd7751a2a4d843ee08d1870e713623c569832c702f6a5308c31c069e71d5e8fa1e061d3469dce6995547d634a5294cb9061369a4
7
+ data.tar.gz: 5558c11fccfac36b82a6b2d20c741b9a7d2869893315da8957cde5168aa5c284ff1e2f7ad06ebcb838ef6b0d088afa1f533c5d93a5e27734379e6bfbe8192d56
data/MIT-LICENSE CHANGED
@@ -1,5 +1,4 @@
1
- Copyright (c) 2014-2015 Brigade
2
- http://www.brigade.com/
1
+ Copyright (c) Shane da Silva
3
2
 
4
3
  Permission is hereby granted, free of charge, to any person obtaining
5
4
  a copy of this software and associated documentation files (the
data/data/properties.txt CHANGED
@@ -1,4 +1,5 @@
1
1
  @keyframes
2
+ accent-color
2
3
  align-content
3
4
  align-items
4
5
  align-self
@@ -125,6 +126,7 @@ break-before
125
126
  break-inside
126
127
  buffered-rendering
127
128
  caption-side
129
+ caret-color
128
130
  clear
129
131
  clip
130
132
  clip-path
@@ -155,6 +157,8 @@ counter-increment
155
157
  counter-reset
156
158
  crop
157
159
  cursor
160
+ cx
161
+ cy
158
162
  direction
159
163
  display
160
164
  dominant-baseline
@@ -198,7 +202,9 @@ font-stretch
198
202
  font-style
199
203
  font-variant
200
204
  font-variant-ligatures
205
+ font-variant-numeric
201
206
  font-weight
207
+ gap
202
208
  glyph-orientation-horizontal
203
209
  glyph-orientation-vertical
204
210
  grid
@@ -363,6 +369,9 @@ overflow-style
363
369
  overflow-wrap
364
370
  overflow-x
365
371
  overflow-y
372
+ overscroll-behavior
373
+ overscroll-behavior-x
374
+ overscroll-behavior-y
366
375
  padding
367
376
  padding-after
368
377
  padding-before
@@ -387,11 +396,14 @@ perspective-origin
387
396
  perspective-origin-x
388
397
  perspective-origin-y
389
398
  phonemes
399
+ place-content
400
+ place-items
390
401
  pointer-events
391
402
  position
392
403
  print-color-adjust
393
404
  punctuation-trim
394
405
  quotes
406
+ r
395
407
  region-break-after
396
408
  region-break-before
397
409
  region-break-inside
@@ -409,7 +421,20 @@ ruby-align
409
421
  ruby-overhang
410
422
  ruby-position
411
423
  ruby-span
424
+ rx
425
+ ry
412
426
  scroll-behavior
427
+ scroll-margin
428
+ scroll-margin-bottom
429
+ scroll-margin-left
430
+ scroll-margin-right
431
+ scroll-margin-top
432
+ scroll-padding
433
+ scroll-padding-bottom
434
+ scroll-padding-left
435
+ scroll-padding-right
436
+ scroll-padding-top
437
+ scrollbar-width
413
438
  shape-image-threshold
414
439
  shape-inside
415
440
  shape-margin
@@ -477,6 +502,7 @@ text-stroke-width
477
502
  text-transform
478
503
  text-underline-color
479
504
  text-underline-mode
505
+ text-underline-offset
480
506
  text-underline-position
481
507
  text-underline-style
482
508
  text-underline-width
@@ -521,5 +547,7 @@ word-wrap
521
547
  wrap-flow
522
548
  wrap-through
523
549
  writing-mode
550
+ x
551
+ y
524
552
  z-index
525
553
  zoom
@@ -58,6 +58,10 @@ align-self
58
58
  justify-content
59
59
  order
60
60
 
61
+ gap
62
+ row-gap
63
+ column-gap
64
+
61
65
  width
62
66
  min-width
63
67
  max-width
@@ -222,6 +226,7 @@ text-shadow
222
226
  text-transform
223
227
  text-wrap
224
228
  word-wrap
229
+ overflow-wrap
225
230
  word-break
226
231
 
227
232
  text-emphasis
@@ -29,6 +29,7 @@
29
29
  -moz-viewport
30
30
  -moz-viewport-scroll
31
31
  -moz-xul-anonymous-block
32
+ -ms-backdrop
32
33
  -ms-browse
33
34
  -ms-check
34
35
  -ms-clear
@@ -54,6 +55,7 @@
54
55
  -webkit-datetime-edit-month-field
55
56
  -webkit-datetime-edit-text
56
57
  -webkit-datetime-edit-year-field
58
+ -webkit-details-marker
57
59
  -webkit-file-upload-button
58
60
  -webkit-full-page-media
59
61
  -webkit-inner-spin-button
data/lib/scss_lint/cli.rb CHANGED
@@ -31,8 +31,8 @@ module SCSSLint
31
31
  def run(args)
32
32
  options = SCSSLint::Options.new.parse(args)
33
33
  act_on_options(options)
34
- rescue StandardError => ex
35
- handle_runtime_exception(ex, options)
34
+ rescue StandardError => e
35
+ handle_runtime_exception(e, options)
36
36
  end
37
37
 
38
38
  private
@@ -205,9 +205,9 @@ module SCSSLint
205
205
  Array(options[:required_paths]).each do |path|
206
206
  require path
207
207
  end
208
- rescue LoadError => ex
208
+ rescue LoadError => e
209
209
  raise SCSSLint::Exceptions::RequiredLibraryMissingError,
210
- "Required library not found: #{ex.message}"
210
+ "Required library not found: #{e.message}"
211
211
  end
212
212
 
213
213
  def load_reporters(options)
@@ -64,9 +64,9 @@ module SCSSLint
64
64
  else
65
65
  {}
66
66
  end
67
- rescue StandardError => ex
67
+ rescue StandardError => e
68
68
  raise SCSSLint::Exceptions::InvalidConfiguration,
69
- "Invalid configuration: #{ex.message}"
69
+ "Invalid configuration: #{e.message}"
70
70
  end
71
71
 
72
72
  options = convert_single_options_to_arrays(options)
@@ -94,8 +94,6 @@ module SCSSLint
94
94
  # Merge options from wildcard linters into individual linter configs
95
95
  def merge_wildcard_linter_options(options)
96
96
  options = options.dup
97
-
98
- # rubocop:disable Performance/HashEachMethods (FALSE POSITIVE)
99
97
  # Cannot use `each_key` because the cycle adds new keys during iteration
100
98
  options.fetch('linters', {}).keys.each do |class_name|
101
99
  next unless class_name.include?('*')
@@ -103,7 +101,6 @@ module SCSSLint
103
101
  wildcard_options = options['linters'].delete(class_name)
104
102
  apply_options_to_matching_linters(class_name, options, wildcard_options)
105
103
  end
106
- # rubocop:enable Performance/HashEachMethods
107
104
 
108
105
  options
109
106
  end
@@ -5,6 +5,6 @@ module SCSSLint
5
5
  SCSS_LINT_HOME = File.realpath(File.join(File.dirname(__FILE__), '..', '..')).freeze
6
6
  SCSS_LINT_DATA = File.join(SCSS_LINT_HOME, 'data').freeze
7
7
 
8
- REPO_URL = 'https://github.com/brigade/scss-lint'.freeze
8
+ REPO_URL = 'https://github.com/sds/scss-lint'.freeze
9
9
  BUG_REPORT_URL = "#{REPO_URL}/issues".freeze
10
10
  end
@@ -34,12 +34,12 @@ module SCSSLint
34
34
  .lines
35
35
  @tree = @engine.to_tree
36
36
  find_any_control_commands
37
- rescue Encoding::UndefinedConversionError, Sass::SyntaxError, ArgumentError => error
38
- if error.is_a?(Encoding::UndefinedConversionError) ||
39
- error.message.match(/invalid.*(byte sequence|character)/i)
37
+ rescue Encoding::UndefinedConversionError, Sass::SyntaxError, ArgumentError => e
38
+ if e.is_a?(Encoding::UndefinedConversionError) ||
39
+ e.message.match(/invalid.*(byte sequence|character)/i)
40
40
  raise FileEncodingError,
41
- "Unable to parse SCSS file: #{error}",
42
- error.backtrace
41
+ "Unable to parse SCSS file: #{e}",
42
+ e.backtrace
43
43
  else
44
44
  raise
45
45
  end
@@ -6,7 +6,7 @@ module SCSSLint
6
6
  def visit_sequence(sequence)
7
7
  line_offset = 0
8
8
  sequence.members.each do |member|
9
- line_offset += 1 if member =~ /\n/
9
+ line_offset += 1 if member.to_s =~ /\n/
10
10
  next unless chained_class?(member)
11
11
  add_lint(member.line + line_offset,
12
12
  'Prefer using a distinct class over chained classes ' \
@@ -18,13 +18,10 @@ module SCSSLint
18
18
 
19
19
  def visit_script_string(node)
20
20
  return if literal_string?(node)
21
-
22
- # rubocop:disable Performance/HashEachMethods (FALSE POSITIVE v0.50.0)
23
21
  remove_quoted_strings(node.value)
24
22
  .scan(/(^|\s)(#[a-f0-9]+|[a-z]+)(?=\s|$)/i)
25
23
  .select { |_, word| color?(word) }
26
24
  .each { |_, color| record_lint(node, color) }
27
- # rubocop:enable Performance/HashEachMethods
28
25
  end
29
26
 
30
27
  def visit_script_funcall(node)
@@ -7,7 +7,7 @@ module SCSSLint
7
7
  # No lint if the first line of the comment is not a command (because then
8
8
  # either this comment has no commands, or the first line serves as a the
9
9
  # reason for a command on a later line).
10
- if comment_lines(node).first.match(COMMAND_REGEX)
10
+ if comment_lines(node).first.match?(COMMAND_REGEX)
11
11
  visit_command_comment(node)
12
12
  else
13
13
  @previous_comment = node
@@ -21,7 +21,7 @@ module SCSSLint
21
21
  end
22
22
 
23
23
  # Not a "disable linter reason" if the last line of the previous comment is a command.
24
- if comment_lines(@previous_comment).last.match(COMMAND_REGEX)
24
+ if comment_lines(@previous_comment).last.match?(COMMAND_REGEX)
25
25
  report_lint(node)
26
26
  return
27
27
  end
@@ -48,7 +48,7 @@ module SCSSLint
48
48
  (?<action>disable)\s+
49
49
  (?<linters>.*?)
50
50
  \s*(?:\*/|\n) # Comment end marker or end of line
51
- }x
51
+ }x.freeze
52
52
 
53
53
  def comment_lines(node)
54
54
  node.value.join.split("\n")
@@ -4,7 +4,7 @@ module SCSSLint
4
4
  class Linter::HexLength < Linter
5
5
  include LinterRegistry
6
6
 
7
- HEX_REGEX = /(#(\h{3}|\h{6}))(?!\h)/
7
+ HEX_REGEX = /(#(\h{3}|\h{6}))(?!\h)/.freeze
8
8
 
9
9
  def visit_script_color(node)
10
10
  return unless hex = source_from_range(node.source_range)[HEX_REGEX, 1]
@@ -3,7 +3,7 @@ module SCSSLint
3
3
  class Linter::HexNotation < Linter
4
4
  include LinterRegistry
5
5
 
6
- HEX_REGEX = /(#(\h{3}|\h{6}))(?!\h)/
6
+ HEX_REGEX = /(#(\h{3}|\h{6}))(?!\h)/.freeze
7
7
 
8
8
  def visit_script_color(node)
9
9
  return unless hex = source_from_range(node.source_range)[HEX_REGEX, 1]
@@ -13,10 +13,10 @@ module SCSSLint
13
13
 
14
14
  private
15
15
 
16
- HEX_REGEX = /(#(\h{3}|\h{6}|\h{8}))(?!\h)/
16
+ HEX_REGEX = /(#(\h{3}|\h{6}|\h{8}))(?!\h)/.freeze
17
17
 
18
18
  def check_hex(hex, node)
19
- return if HEX_REGEX.match(hex)
19
+ return if HEX_REGEX.match?(hex)
20
20
  add_lint(node, "Colors must have either three or six digits: `#{hex}`")
21
21
  end
22
22
  end
@@ -98,7 +98,7 @@ module SCSSLint
98
98
 
99
99
  def visit_import(node)
100
100
  previous_node(node)
101
- return unless engine.lines[node.line - 1] =~ /@import/
101
+ return unless engine.lines[node.line - 1].match?(/@import/)
102
102
  check_indentation(node)
103
103
  end
104
104
 
@@ -22,7 +22,7 @@ module SCSSLint
22
22
 
23
23
  private
24
24
 
25
- NUMBER_WITH_LEADING_ZERO_REGEX = /^-?(0?\.\d+)/
25
+ NUMBER_WITH_LEADING_ZERO_REGEX = /^-?(0?\.\d+)/.freeze
26
26
 
27
27
  CONVENTIONS = {
28
28
  'exclude_zero' => {
@@ -23,7 +23,7 @@ module SCSSLint
23
23
  (?:#{LENGTH_UNITS.join('|')}) # unit!
24
24
  )
25
25
  (?:$|[\s+\-/*()]) # math or space separated, or end of string
26
- }x
26
+ }x.freeze
27
27
 
28
28
  def visit_prop(node)
29
29
  return if allowed_prop?(node)
@@ -15,7 +15,7 @@ module SCSSLint
15
15
  )
16
16
  ([a-z%]+) # [1: units] letters or percent sign, e.g. px or %
17
17
  )
18
- /ix
18
+ /ix.freeze
19
19
 
20
20
  def visit_root(_node)
21
21
  @globally_allowed_units = config['global'].to_set
@@ -47,7 +47,7 @@ module SCSSLint
47
47
  # combinator, as these "combine" simple sequences such that they do not
48
48
  # increase depth.
49
49
  depth = simple_sequences.size -
50
- separators.count { |item| item == '~' || item == '+' }
50
+ separators.count { |item| %w[~ +].include?(item) }
51
51
 
52
52
  depth +=
53
53
  if parent_selectors > 0
@@ -64,7 +64,7 @@ module SCSSLint
64
64
  (\S+\s+\S+(\s+\S+){0,2}) # Two to four values separated by spaces
65
65
  (\s+!\w+)? # Ignore `!important` priority overrides
66
66
  \z
67
- /x
67
+ /x.freeze
68
68
 
69
69
  # @param prop [String]
70
70
  # @param script_string [Sass::Script::Value::String]
@@ -13,7 +13,7 @@ module SCSSLint
13
13
  # (only selectors?), the source ranges are offset by two (probably not
14
14
  # accounting for the `#{`. Slide everything to the left by 2, and maybe
15
15
  # things will look sane this time.
16
- unless operation_sources.operator_source =~ Sass::Script::Lexer::REGULAR_EXPRESSIONS[:op]
16
+ unless operation_sources.operator_source.match?(Sass::Script::Lexer::REGULAR_EXPRESSIONS[:op])
17
17
  operation_sources.adjust_for_interpolation
18
18
  operation_sources.adjust_sources
19
19
  end
@@ -29,7 +29,7 @@ module SCSSLint
29
29
 
30
30
  private
31
31
 
32
- TRAILING_WHITESPACE = /\s*$/
32
+ TRAILING_WHITESPACE = /\s*$/.freeze
33
33
 
34
34
  def check(node, source) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
35
35
  @spaces = config['spaces']
@@ -90,7 +90,7 @@ module SCSSLint
90
90
  # those parens may be part of a parent function call. We don't care about
91
91
  # such parens. This depends on whether the preceding character is part of
92
92
  # a function name.
93
- return original_source if character_at(range.start_pos, left_offset - 1) =~ /[A-Za-z0-9_]/
93
+ return original_source if character_at(range.start_pos, left_offset - 1).match?(/[A-Za-z0-9_]/)
94
94
 
95
95
  range.start_pos.offset += left_offset
96
96
  range.end_pos.offset += right_offset
@@ -45,7 +45,7 @@ module SCSSLint
45
45
  \s*\)?\s*;?\s* # Sometimes the Sass parser includes a trailing ) or ;
46
46
  (//.*)? # Exclude any trailing comments that might have snuck in
47
47
  \z
48
- }x
48
+ }x.freeze
49
49
 
50
50
  def extract_string_without_quotes(source)
51
51
  return unless match = STRING_WITHOUT_QUOTES_REGEX.match(source)
@@ -66,7 +66,7 @@ module SCSSLint
66
66
  if string =~ /(?<! \\) \\'/x && string !~ /"/
67
67
  add_lint(node, 'Use double-quoted strings when writing single ' \
68
68
  'quotes to avoid having to escape the single quotes')
69
- elsif string =~ /(?<! \\) \\"/x
69
+ elsif string.match?(/(?<! \\) \\"/x)
70
70
  add_lint(node, "Don't escape double quotes in single-quoted strings")
71
71
  end
72
72
  elsif string !~ /"/
@@ -45,7 +45,7 @@ module SCSSLint
45
45
 
46
46
  def visit_import(node)
47
47
  # Ignore all but the last import for comma-separated @imports
48
- return if source_from_range(node.source_range) =~ /,\s*$/
48
+ return if source_from_range(node.source_range).match?(/,\s*$/)
49
49
  check_semicolon(node)
50
50
  end
51
51
 
@@ -5,7 +5,7 @@ module SCSSLint
5
5
 
6
6
  def visit_root(_node)
7
7
  engine.lines.each_with_index do |line, index|
8
- next unless line =~ /[ \t]+$/
8
+ next unless line.match?(/[ \t]+$/)
9
9
 
10
10
  add_lint(index + 1, 'Line contains trailing whitespace')
11
11
  end
@@ -22,7 +22,7 @@ module SCSSLint
22
22
 
23
23
  private
24
24
 
25
- FRACTIONAL_DIGIT_REGEX = /^-?(\d*\.\d+)/
25
+ FRACTIONAL_DIGIT_REGEX = /^-?(\d*\.\d+)/.freeze
26
26
 
27
27
  def check_for_trailing_zeros(node, original_number)
28
28
  return unless match = /^(\d*\.(?:[0-9]*[1-9]|[1-9])*)0+$/.match(original_number)
@@ -8,7 +8,7 @@ module SCSSLint
8
8
 
9
9
  def visit_script_string(node)
10
10
  return unless node.type == :identifier
11
- return if node.value =~ /^'|"/
11
+ return if node.value.match?(/^'|"/)
12
12
  return if url_literal?(node)
13
13
 
14
14
  node.value.scan(REAL_NUMBER_REGEX) do |number, integer, mantissa, units|
@@ -35,7 +35,7 @@ module SCSSLint
35
35
  (?<mantissa>\d+)
36
36
  (?<units>\w*)
37
37
  )\b
38
- /ix
38
+ /ix.freeze
39
39
 
40
40
  MESSAGE_FORMAT = '`%s` should be written without the mantissa as `%s%s`'.freeze
41
41
 
@@ -49,8 +49,8 @@ module SCSSLint
49
49
  if uri.scheme || uri.host
50
50
  add_lint(node, "URL `#{url}` should not contain protocol or domain")
51
51
  end
52
- rescue URI::Error => ex
53
- add_lint(node, "Invalid URL `#{url}`: #{ex}")
52
+ rescue URI::Error => e
53
+ add_lint(node, "Invalid URL `#{url}`: #{e}")
54
54
  end
55
55
  end
56
56
  end
@@ -20,8 +20,8 @@ module SCSSLint
20
20
  private
21
21
 
22
22
  def check(node, string)
23
- return unless string =~ /^\s*url\(\s*[^"']/
24
- return if string =~ /^\s*url\(\s*data:/ # Ignore data URIs
23
+ return unless string.match?(/^\s*url\(\s*[^"']/)
24
+ return if string.match?(/^\s*url\(\s*data:/) # Ignore data URIs
25
25
 
26
26
  add_lint(node, 'URLs should be enclosed in quotes')
27
27
  end
@@ -27,7 +27,7 @@ module SCSSLint
27
27
  private
28
28
 
29
29
  def check_identifier(node, identifier)
30
- return unless identifier =~ /^[_-]/
30
+ return unless identifier.match?(/^[_-]/)
31
31
 
32
32
  # Strip vendor prefix to check against identifiers.
33
33
  # (Also strip closing parentheticals from values like linear-gradient.)
@@ -35,7 +35,7 @@ module SCSSLint
35
35
  (?<!\.|\#) # Ignore zeroes following `#` (colors) or `.` (decimals)
36
36
  (0[a-z]+) # Zero followed by letters indicating some sort of unit
37
37
  \b
38
- /ix
38
+ /ix.freeze
39
39
 
40
40
  MESSAGE_FORMAT = '`%s` should be written without units as `0`'.freeze
41
41
 
@@ -75,7 +75,7 @@ module SCSSLint
75
75
  line_source.length - range.start_pos.offset + 1
76
76
  end
77
77
 
78
- # Workaround for https://github.com/brigade/scss-lint/issues/887 to acount for
78
+ # Workaround for https://github.com/sds/scss-lint/issues/887 to acount for
79
79
  # https://github.com/sass/sass/issues/2284.
80
80
  length = 1 if length < 1
81
81
 
@@ -27,10 +27,10 @@ module SCSSLint
27
27
  @options[:files] = args
28
28
 
29
29
  @options
30
- rescue OptionParser::InvalidOption => ex
30
+ rescue OptionParser::InvalidOption => e
31
31
  raise SCSSLint::Exceptions::InvalidCLIOption,
32
- ex.message,
33
- ex.backtrace
32
+ e.message,
33
+ e.backtrace
34
34
  end
35
35
 
36
36
  private
@@ -73,7 +73,7 @@ module SCSSLint
73
73
  end
74
74
  end
75
75
 
76
- def run_cli(task_args) # rubocop:disable AbcSize
76
+ def run_cli(task_args)
77
77
  cli_args = ['--config', config] if config
78
78
 
79
79
  logger = quiet ? SCSSLint::Logger.silent : SCSSLint::Logger.new(STDOUT)
@@ -33,18 +33,18 @@ module SCSSLint
33
33
  @linters.each do |linter|
34
34
  begin
35
35
  run_linter(linter, engine, file[:path])
36
- rescue StandardError => error
36
+ rescue StandardError => e
37
37
  raise SCSSLint::Exceptions::LinterError,
38
38
  "#{linter.class} raised unexpected error linting file #{file[:path]}: " \
39
- "'#{error.message}'",
40
- error.backtrace
39
+ "'#{e.message}'",
40
+ e.backtrace
41
41
  end
42
42
  end
43
- rescue Sass::SyntaxError => ex
44
- @lints << Lint.new(Linter::Syntax.new, ex.sass_filename, Location.new(ex.sass_line),
45
- "Syntax Error: #{ex}", :error)
46
- rescue FileEncodingError => ex
47
- @lints << Lint.new(Linter::Encoding.new, file[:path], Location.new, ex.to_s, :error)
43
+ rescue Sass::SyntaxError => e
44
+ @lints << Lint.new(Linter::Syntax.new, e.sass_filename, Location.new(e.sass_line),
45
+ "Syntax Error: #{e}", :error)
46
+ rescue FileEncodingError => e
47
+ @lints << Lint.new(Linter::Encoding.new, file[:path], Location.new, e.to_s, :error)
48
48
  end
49
49
 
50
50
  # For stubbing in tests.
@@ -1,7 +1,7 @@
1
1
  module SCSSLint
2
2
  # Collection of helpers used across a variety of linters.
3
3
  module Utils
4
- COLOR_REGEX = /^#[a-f0-9]{3,6}$/i
4
+ COLOR_REGEX = /^#[a-f0-9]{3,6}$/i.freeze
5
5
 
6
6
  # Returns whether the given string is a color literal (keyword or hex code).
7
7
  #
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module SCSSLint
5
- VERSION = '0.57.0'.freeze
5
+ VERSION = '0.60.0'.freeze
6
6
  end
@@ -217,7 +217,7 @@ describe SCSSLint::Linter::DuplicateProperty do
217
217
  end
218
218
 
219
219
  context 'when specific consecutive duplicate properties are allowed' do
220
- let(:linter_config) { { 'ignore_consecutive' => ['background-color', 'transition'] } }
220
+ let(:linter_config) { { 'ignore_consecutive' => %w[background-color transition] } }
221
221
 
222
222
  context 'when rule set contains consecutive duplicates in whitelist' do
223
223
  let(:scss) { <<-SCSS }
@@ -348,7 +348,7 @@ describe SCSSLint::Linter::LengthVariable do
348
348
  end
349
349
 
350
350
  context 'when using a length with an allowed property' do
351
- let(:linter_config) { { 'allowed_properties' => ['text-shadow', 'box-shadow'] } }
351
+ let(:linter_config) { { 'allowed_properties' => %w[text-shadow box-shadow] } }
352
352
  let(:scss) { <<-SCSS }
353
353
  p {
354
354
  text-shadow: 10px 10px 5px blue;
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe SCSSLint::Plugins::LinterDir do
4
- let(:plugin_directory) { File.expand_path('../../fixtures/plugins', __FILE__) }
4
+ let(:plugin_directory) { File.expand_path('../fixtures/plugins', __dir__) }
5
5
  let(:subject) { described_class.new(plugin_directory) }
6
6
 
7
7
  describe '#load' do
metadata CHANGED
@@ -1,41 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scss_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.57.0
4
+ version: 0.60.0
5
5
  platform: ruby
6
6
  authors:
7
- - Brigade Engineering
8
7
  - Shane da Silva
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2018-02-26 00:00:00.000000000 Z
11
+ date: 2023-01-27 00:00:00.000000000 Z
13
12
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rake
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0.9'
21
- - - "<"
22
- - !ruby/object:Gem::Version
23
- version: '13'
24
- type: :runtime
25
- prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- version: '0.9'
31
- - - "<"
32
- - !ruby/object:Gem::Version
33
- version: '13'
34
13
  - !ruby/object:Gem::Dependency
35
14
  name: sass
36
15
  requirement: !ruby/object:Gem::Requirement
37
16
  requirements:
38
17
  - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.5'
20
+ - - ">="
39
21
  - !ruby/object:Gem::Version
40
22
  version: 3.5.5
41
23
  type: :runtime
@@ -43,11 +25,13 @@ dependencies:
43
25
  version_requirements: !ruby/object:Gem::Requirement
44
26
  requirements:
45
27
  - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.5'
30
+ - - ">="
46
31
  - !ruby/object:Gem::Version
47
32
  version: 3.5.5
48
33
  description: Configurable tool for writing clean and consistent SCSS
49
34
  email:
50
- - eng@brigade.com
51
35
  - shane@dasilva.io
52
36
  executables:
53
37
  - scss-lint
@@ -254,7 +238,7 @@ files:
254
238
  - spec/spec_helper.rb
255
239
  - spec/support/isolated_environment.rb
256
240
  - spec/support/matchers/report_lint.rb
257
- homepage: https://github.com/brigade/scss-lint
241
+ homepage: https://github.com/sds/scss-lint
258
242
  licenses:
259
243
  - MIT
260
244
  metadata: {}
@@ -266,108 +250,107 @@ required_ruby_version: !ruby/object:Gem::Requirement
266
250
  requirements:
267
251
  - - ">="
268
252
  - !ruby/object:Gem::Version
269
- version: '2.1'
253
+ version: '2.4'
270
254
  required_rubygems_version: !ruby/object:Gem::Requirement
271
255
  requirements:
272
256
  - - ">="
273
257
  - !ruby/object:Gem::Version
274
258
  version: '0'
275
259
  requirements: []
276
- rubyforge_project:
277
- rubygems_version: 2.5.2
260
+ rubygems_version: 3.1.6
278
261
  signing_key:
279
262
  specification_version: 4
280
263
  summary: SCSS lint tool
281
264
  test_files:
282
- - spec/scss_lint/cli_spec.rb
265
+ - spec/spec_helper.rb
266
+ - spec/scss_lint/runner_spec.rb
283
267
  - spec/scss_lint/config_spec.rb
284
- - spec/scss_lint/engine_spec.rb
285
- - spec/scss_lint/file_finder_spec.rb
286
- - spec/scss_lint/fixtures/plugins/linter_plugin.rb
287
- - spec/scss_lint/linter/bang_format_spec.rb
288
- - spec/scss_lint/linter/bem_depth_spec.rb
289
- - spec/scss_lint/linter/border_zero_spec.rb
290
- - spec/scss_lint/linter/chained_classes_spec.rb
291
- - spec/scss_lint/linter/color_keyword_spec.rb
292
- - spec/scss_lint/linter/color_variable_spec.rb
293
- - spec/scss_lint/linter/comment_spec.rb
294
- - spec/scss_lint/linter/compass/property_with_mixin_spec.rb
295
- - spec/scss_lint/linter/debug_statement_spec.rb
296
- - spec/scss_lint/linter/declaration_order_spec.rb
297
- - spec/scss_lint/linter/disable_linter_reason_spec.rb
298
- - spec/scss_lint/linter/duplicate_property_spec.rb
299
- - spec/scss_lint/linter/else_placement_spec.rb
300
- - spec/scss_lint/linter/empty_line_between_blocks_spec.rb
301
- - spec/scss_lint/linter/empty_rule_spec.rb
302
- - spec/scss_lint/linter/extend_directive_spec.rb
303
- - spec/scss_lint/linter/final_newline_spec.rb
304
- - spec/scss_lint/linter/hex_length_spec.rb
305
- - spec/scss_lint/linter/hex_notation_spec.rb
306
- - spec/scss_lint/linter/hex_validation_spec.rb
268
+ - spec/scss_lint/rake_task_spec.rb
269
+ - spec/scss_lint/cli_spec.rb
270
+ - spec/scss_lint/logger_spec.rb
271
+ - spec/scss_lint/linter/trailing_whitespace_spec.rb
307
272
  - spec/scss_lint/linter/id_selector_spec.rb
273
+ - spec/scss_lint/linter/single_line_per_selector_spec.rb
274
+ - spec/scss_lint/linter/declaration_order_spec.rb
308
275
  - spec/scss_lint/linter/import_path_spec.rb
309
- - spec/scss_lint/linter/important_rule_spec.rb
310
- - spec/scss_lint/linter/indentation_spec.rb
276
+ - spec/scss_lint/linter/url_quotes_spec.rb
277
+ - spec/scss_lint/linter/chained_classes_spec.rb
278
+ - spec/scss_lint/linter/space_around_operator_spec.rb
311
279
  - spec/scss_lint/linter/leading_zero_spec.rb
312
- - spec/scss_lint/linter/length_variable_spec.rb
313
- - spec/scss_lint/linter/mergeable_selector_spec.rb
314
- - spec/scss_lint/linter/name_format_spec.rb
315
- - spec/scss_lint/linter/nesting_depth_spec.rb
316
- - spec/scss_lint/linter/placeholder_in_extend_spec.rb
317
- - spec/scss_lint/linter/private_naming_convention_spec.rb
318
- - spec/scss_lint/linter/property_count_spec.rb
319
- - spec/scss_lint/linter/property_sort_order_spec.rb
320
- - spec/scss_lint/linter/property_spelling_spec.rb
321
- - spec/scss_lint/linter/property_units_spec.rb
280
+ - spec/scss_lint/linter/unnecessary_mantissa_spec.rb
281
+ - spec/scss_lint/linter/important_rule_spec.rb
282
+ - spec/scss_lint/linter/zero_unit_spec.rb
283
+ - spec/scss_lint/linter/space_after_property_name_spec.rb
322
284
  - spec/scss_lint/linter/pseudo_element_spec.rb
285
+ - spec/scss_lint/linter/else_placement_spec.rb
286
+ - spec/scss_lint/linter/vendor_prefix_spec.rb
287
+ - spec/scss_lint/linter/space_after_comment_spec.rb
288
+ - spec/scss_lint/linter/trailing_semicolon_spec.rb
289
+ - spec/scss_lint/linter/length_variable_spec.rb
290
+ - spec/scss_lint/linter/space_after_comma_spec.rb
291
+ - spec/scss_lint/linter/single_line_per_property_spec.rb
292
+ - spec/scss_lint/linter/border_zero_spec.rb
293
+ - spec/scss_lint/linter/url_format_spec.rb
323
294
  - spec/scss_lint/linter/qualifying_element_spec.rb
324
- - spec/scss_lint/linter/selector_depth_spec.rb
295
+ - spec/scss_lint/linter/empty_line_between_blocks_spec.rb
296
+ - spec/scss_lint/linter/hex_validation_spec.rb
297
+ - spec/scss_lint/linter/empty_rule_spec.rb
298
+ - spec/scss_lint/linter/variable_for_property_spec.rb
299
+ - spec/scss_lint/linter/duplicate_property_spec.rb
300
+ - spec/scss_lint/linter/property_spelling_spec.rb
325
301
  - spec/scss_lint/linter/selector_format_spec.rb
326
- - spec/scss_lint/linter/shorthand_spec.rb
327
- - spec/scss_lint/linter/single_line_per_property_spec.rb
328
- - spec/scss_lint/linter/single_line_per_selector_spec.rb
329
- - spec/scss_lint/linter/space_after_comma_spec.rb
330
- - spec/scss_lint/linter/space_after_comment_spec.rb
331
- - spec/scss_lint/linter/space_after_property_colon_spec.rb
332
- - spec/scss_lint/linter/space_after_property_name_spec.rb
333
- - spec/scss_lint/linter/space_after_variable_colon_spec.rb
334
- - spec/scss_lint/linter/space_after_variable_name_spec.rb
335
- - spec/scss_lint/linter/space_around_operator_spec.rb
336
- - spec/scss_lint/linter/space_before_brace_spec.rb
337
302
  - spec/scss_lint/linter/space_between_parens_spec.rb
303
+ - spec/scss_lint/linter/space_after_variable_colon_spec.rb
304
+ - spec/scss_lint/linter/indentation_spec.rb
305
+ - spec/scss_lint/linter/placeholder_in_extend_spec.rb
306
+ - spec/scss_lint/linter/extend_directive_spec.rb
338
307
  - spec/scss_lint/linter/string_quotes_spec.rb
339
- - spec/scss_lint/linter/trailing_semicolon_spec.rb
340
- - spec/scss_lint/linter/trailing_whitespace_spec.rb
341
308
  - spec/scss_lint/linter/trailing_zero_spec.rb
309
+ - spec/scss_lint/linter/space_after_property_colon_spec.rb
310
+ - spec/scss_lint/linter/debug_statement_spec.rb
311
+ - spec/scss_lint/linter/property_count_spec.rb
312
+ - spec/scss_lint/linter/private_naming_convention_spec.rb
313
+ - spec/scss_lint/linter/color_variable_spec.rb
314
+ - spec/scss_lint/linter/property_sort_order_spec.rb
315
+ - spec/scss_lint/linter/space_before_brace_spec.rb
316
+ - spec/scss_lint/linter/mergeable_selector_spec.rb
317
+ - spec/scss_lint/linter/final_newline_spec.rb
318
+ - spec/scss_lint/linter/hex_notation_spec.rb
319
+ - spec/scss_lint/linter/compass/property_with_mixin_spec.rb
320
+ - spec/scss_lint/linter/space_after_variable_name_spec.rb
321
+ - spec/scss_lint/linter/hex_length_spec.rb
322
+ - spec/scss_lint/linter/shorthand_spec.rb
323
+ - spec/scss_lint/linter/selector_depth_spec.rb
324
+ - spec/scss_lint/linter/bem_depth_spec.rb
325
+ - spec/scss_lint/linter/nesting_depth_spec.rb
326
+ - spec/scss_lint/linter/name_format_spec.rb
327
+ - spec/scss_lint/linter/comment_spec.rb
342
328
  - spec/scss_lint/linter/transition_all_spec.rb
343
- - spec/scss_lint/linter/unnecessary_mantissa_spec.rb
329
+ - spec/scss_lint/linter/bang_format_spec.rb
330
+ - spec/scss_lint/linter/property_units_spec.rb
344
331
  - spec/scss_lint/linter/unnecessary_parent_reference_spec.rb
345
- - spec/scss_lint/linter/url_format_spec.rb
346
- - spec/scss_lint/linter/url_quotes_spec.rb
347
- - spec/scss_lint/linter/variable_for_property_spec.rb
348
- - spec/scss_lint/linter/vendor_prefix_spec.rb
349
- - spec/scss_lint/linter/zero_unit_spec.rb
350
- - spec/scss_lint/linter_registry_spec.rb
351
- - spec/scss_lint/linter_spec.rb
352
- - spec/scss_lint/location_spec.rb
353
- - spec/scss_lint/logger_spec.rb
354
- - spec/scss_lint/options_spec.rb
332
+ - spec/scss_lint/linter/disable_linter_reason_spec.rb
333
+ - spec/scss_lint/linter/color_keyword_spec.rb
334
+ - spec/scss_lint/reporter/stats_reporter_spec.rb
335
+ - spec/scss_lint/reporter/json_reporter_spec.rb
336
+ - spec/scss_lint/reporter/tap_reporter_spec.rb
337
+ - spec/scss_lint/reporter/files_reporter_spec.rb
338
+ - spec/scss_lint/reporter/config_reporter_spec.rb
339
+ - spec/scss_lint/reporter/default_reporter_spec.rb
340
+ - spec/scss_lint/reporter/clean_files_reporter_spec.rb
355
341
  - spec/scss_lint/plugins/linter_dir_spec.rb
356
342
  - spec/scss_lint/plugins/linter_gem_spec.rb
357
- - spec/scss_lint/plugins_spec.rb
343
+ - spec/scss_lint/options_spec.rb
344
+ - spec/scss_lint/file_finder_spec.rb
358
345
  - spec/scss_lint/preprocess_spec.rb
359
- - spec/scss_lint/rake_task_spec.rb
346
+ - spec/scss_lint/plugins_spec.rb
347
+ - spec/scss_lint/linter_registry_spec.rb
348
+ - spec/scss_lint/engine_spec.rb
349
+ - spec/scss_lint/location_spec.rb
360
350
  - spec/scss_lint/report_lint_spec.rb
361
- - spec/scss_lint/reporter/clean_files_reporter_spec.rb
362
- - spec/scss_lint/reporter/config_reporter_spec.rb
363
- - spec/scss_lint/reporter/default_reporter_spec.rb
364
- - spec/scss_lint/reporter/files_reporter_spec.rb
365
- - spec/scss_lint/reporter/json_reporter_spec.rb
366
- - spec/scss_lint/reporter/stats_reporter_spec.rb
367
- - spec/scss_lint/reporter/tap_reporter_spec.rb
351
+ - spec/scss_lint/fixtures/plugins/linter_plugin.rb
352
+ - spec/scss_lint/linter_spec.rb
368
353
  - spec/scss_lint/reporter_spec.rb
369
- - spec/scss_lint/runner_spec.rb
370
354
  - spec/scss_lint/selector_visitor_spec.rb
371
- - spec/spec_helper.rb
372
355
  - spec/support/isolated_environment.rb
373
356
  - spec/support/matchers/report_lint.rb