scss_lint 0.43.0 → 0.43.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: 26102783a3fa8f2e4ade260a8a483aa2d2a315f6
4
- data.tar.gz: ce8673ca36772ff3505bb6ce3eec4861f78ebed4
3
+ metadata.gz: 13e3b02dea61e5e42cc983459ef0269a92fd4852
4
+ data.tar.gz: 6c8b99c3ed5d6987e62fbfa386ba865a88fd3a6c
5
5
  SHA512:
6
- metadata.gz: d5558f7bbe06908b1901d949215856aad7c0318a4fb10305ff89e3dbea00b08a73c1dcd5edece21898b37cf331585e37c02429ec66337a3a5a887365fa151a18
7
- data.tar.gz: 08b6257a9482c94ee656debfc1b141a0c557dccdb970bec4df3588f6ec69dab8888e9a282ab8f74a580f783c81844136f2c729c034a32703dd756873a2a4d0a7
6
+ metadata.gz: 4fc569e9526be141eddbdaec286d960501c8717b82f09c944cf07721d3681144332706c4236fbbd280e9ea43a402ab66d1b34add10bbf8bfa9f23ad580da7ffb
7
+ data.tar.gz: 9d900a09921c023a4460dcf37428b5db617858bb35701df3f71aca9267c7e4fddfcb5cf03b3c89dc1f68e304cb533ef74daa25d593dc33830a5b7792c363c857
@@ -0,0 +1,92 @@
1
+ -moz-anonymous-block
2
+ -moz-anonymous-positioned-block
3
+ -moz-canvas
4
+ -moz-cell-content
5
+ -moz-focus-inner
6
+ -moz-focus-outer
7
+ -moz-inline-table
8
+ -moz-page
9
+ -moz-page-sequence
10
+ -moz-pagebreak
11
+ -moz-pagecontent
12
+ -moz-placeholder
13
+ -moz-progress-bar
14
+ -moz-progress-bar
15
+ -moz-range-thumb
16
+ -moz-range-track
17
+ -moz-scrolled-canvas
18
+ -moz-scrolled-content
19
+ -moz-scrolled-page-sequence
20
+ -moz-selection
21
+ -moz-svg-foreign-content
22
+ -moz-table
23
+ -moz-table-cell
24
+ -moz-table-column
25
+ -moz-table-column-group
26
+ -moz-table-outer
27
+ -moz-table-row
28
+ -moz-table-row-group
29
+ -moz-viewport
30
+ -moz-viewport-scroll
31
+ -moz-xul-anonymous-block
32
+ -ms-browse
33
+ -ms-check
34
+ -ms-clear
35
+ -ms-expand
36
+ -ms-expand
37
+ -ms-fill
38
+ -ms-fill-lower
39
+ -ms-fill-upper
40
+ -ms-reveal
41
+ -ms-thumb
42
+ -ms-ticks-after
43
+ -ms-ticks-before
44
+ -ms-tooltip
45
+ -ms-track
46
+ -ms-value
47
+ -webkit-calendar-picker-indicator
48
+ -webkit-color-swatch
49
+ -webkit-color-swatch-wrapper
50
+ -webkit-datetime-edit
51
+ -webkit-datetime-edit-day-field
52
+ -webkit-datetime-edit-fields-wrapper
53
+ -webkit-datetime-edit-month-field
54
+ -webkit-datetime-edit-text
55
+ -webkit-datetime-edit-year-field
56
+ -webkit-file-upload-button
57
+ -webkit-inner-spin-button
58
+ -webkit-input-placeholder
59
+ -webkit-keygen-select
60
+ -webkit-meter-bar
61
+ -webkit-meter-even-less-good-value
62
+ -webkit-meter-optimum-value
63
+ -webkit-meter-suboptimum-value
64
+ -webkit-outer-spin-button
65
+ -webkit-progress-bar
66
+ -webkit-progress-inner-element
67
+ -webkit-progress-value
68
+ -webkit-resizer
69
+ -webkit-scrollbar
70
+ -webkit-scrollbar-button
71
+ -webkit-scrollbar-corner
72
+ -webkit-scrollbar-thumb
73
+ -webkit-scrollbar-track
74
+ -webkit-scrollbar-track-piece
75
+ -webkit-search-cancel-button
76
+ -webkit-search-results-button
77
+ -webkit-slider-runnable-track
78
+ -webkit-slider-thumb
79
+ -webkit-textfield-decoration-container
80
+ -webkit-validation-bubble
81
+ -webkit-validation-bubble-arrow
82
+ -webkit-validation-bubble-arrow-clipper
83
+ -webkit-validation-bubble-heading
84
+ -webkit-validation-bubble-message
85
+ -webkit-validation-bubble-text-block
86
+ after
87
+ backdrop
88
+ before
89
+ first-letter
90
+ first-line
91
+ placeholder
92
+ selection
@@ -181,6 +181,8 @@ module SCSSLint
181
181
  actual_line = source_position.line - 1
182
182
  actual_offset = source_position.offset + offset - 1
183
183
 
184
+ return nil if actual_offset < 0
185
+
184
186
  engine.lines.size > actual_line && engine.lines[actual_line][actual_offset]
185
187
  end
186
188
 
@@ -3,7 +3,13 @@ module SCSSLint
3
3
  class Linter::PseudoElement < Linter
4
4
  include LinterRegistry
5
5
 
6
- PSEUDO_ELEMENTS = %w[after backdrop before first-letter first-line selection]
6
+ # https://msdn.microsoft.com/en-us/library/windows/apps/hh767361.aspx
7
+ # https://developer.mozilla.org/en-US/docs/Web/CSS/Mozilla_Extensions
8
+ # http://tjvantoll.com/2013/04/15/list-of-pseudo-elements-to-style-form-controls/
9
+ PSEUDO_ELEMENTS = File.open(File.join(SCSS_LINT_DATA, 'pseudo-elements.txt'))
10
+ .read
11
+ .split
12
+ .to_set
7
13
 
8
14
  def visit_pseudo(pseudo)
9
15
  if PSEUDO_ELEMENTS.include?(pseudo.name)
@@ -78,19 +78,18 @@ module SCSSLint
78
78
  # Sometimes the line we're looking at doesn't even contain a comma!
79
79
  next unless engine.lines[arg.line - 1].include?(',')
80
80
 
81
- offset = find_comma_offset(arg)
81
+ comma_position = find_comma_position(arg)
82
82
 
83
83
  # Check for space or newline after comma (we allow arguments to be split
84
84
  # up over multiple lines).
85
85
  spaces = 0
86
- while (char = character_at(arg.source_range.end_pos, offset + 1)) == ' '
86
+ while (char = character_at(comma_position, spaces + 1)) == ' '
87
87
  spaces += 1
88
- offset += 1
89
88
  end
90
89
  next if char == "\n" || # Ignore trailing spaces
91
90
  valid_spaces_after_comma?(spaces)
92
91
 
93
- add_lint arg, "Commas in #{arg_type} should be followed by a single space"
92
+ add_lint comma_position, "Commas in #{arg_type} should be followed by a single space"
94
93
  end
95
94
  end
96
95
 
@@ -100,20 +99,26 @@ module SCSSLint
100
99
  # source range. Thus we need to start at the indicated range, and check
101
100
  # left and right of that range, gradually moving further outward until
102
101
  # we find the comma.
103
- def find_comma_offset(arg)
102
+ def find_comma_position(arg) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
104
103
  offset = 0
104
+ pos = arg.source_range.end_pos
105
105
 
106
- if character_at(arg.source_range.end_pos, offset) != ','
106
+ if character_at(pos, offset) != ','
107
107
  loop do
108
108
  offset += 1
109
- break if character_at(arg.source_range.end_pos, offset) == ','
109
+ break if (right_char = character_at(pos, offset)) == ','
110
110
  offset = -offset
111
- break if character_at(arg.source_range.end_pos, offset) == ','
111
+ break if (left_char = character_at(pos, offset)) == ','
112
112
  offset = -offset
113
+
114
+ next unless right_char.nil? && left_char.nil?
115
+ offset = 0
116
+ pos = Sass::Source::Position.new(pos.line + 1, 1)
117
+ break if character_at(pos, offset) == ','
113
118
  end
114
119
  end
115
120
 
116
- offset
121
+ Sass::Source::Position.new(pos.line, pos.offset + offset)
117
122
  end
118
123
  end
119
124
  end
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module SCSSLint
3
- VERSION = '0.43.0'
3
+ VERSION = '0.43.1'
4
4
  end
@@ -334,6 +334,18 @@ describe SCSSLint::Linter::SpaceAfterComma do
334
334
  it { should_not report_lint }
335
335
  end
336
336
  end
337
+
338
+ context 'when map literal spans multiple lines' do
339
+ let(:scss) { <<-SCSS }
340
+ @include mixin('arg1', (
341
+ key1: 'arg2-key1-value',
342
+ key2: 'arg2-key2-value'
343
+ ),$arg3: 'arg3-value', $arg4: 'arg4-value'
344
+ );
345
+ SCSS
346
+
347
+ it { should report_lint line: 4 }
348
+ end
337
349
  end
338
350
 
339
351
  context 'when more than one space is preferred' do
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.43.0
4
+ version: 0.43.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brigade Engineering
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-23 00:00:00.000000000 Z
12
+ date: 2015-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow
@@ -71,6 +71,7 @@ files:
71
71
  - data/property-sort-orders/concentric.txt
72
72
  - data/property-sort-orders/recess.txt
73
73
  - data/property-sort-orders/smacss.txt
74
+ - data/pseudo-elements.txt
74
75
  - lib/scss_lint.rb
75
76
  - lib/scss_lint/cli.rb
76
77
  - lib/scss_lint/config.rb