scss_lint 0.47.0 → 0.47.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 +4 -4
- data/lib/scss_lint/cli.rb +1 -1
- data/lib/scss_lint/linter/duplicate_property.rb +8 -6
- data/lib/scss_lint/reporter/tap_reporter.rb +28 -20
- data/lib/scss_lint/reporter.rb +1 -1
- data/lib/scss_lint/version.rb +1 -1
- data/spec/scss_lint/linter/duplicate_property_spec.rb +1 -0
- data/spec/scss_lint/reporter/tap_reporter_spec.rb +14 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0ac6b15087b8dec70d1bdde62a549b7257d06a5
|
4
|
+
data.tar.gz: 1c82559401919e75e12460d080b0f1744d9b1ba4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02fc63d1f4f277c8193ec256303ca9f483fcc413554049b1c02f1fc9227d431b7b5a30d4cc982e89673c739ea5e50045c733af488ba0456a7924d6b25129336
|
7
|
+
data.tar.gz: a590c19d6d195d590a7a4189f0678fd265df38a0a704d90383f09cc02dc89c9105a8be588a81917d8205346dd591f01003ae51661b01219b132a9bb4007c6114
|
data/lib/scss_lint/cli.rb
CHANGED
@@ -182,7 +182,7 @@ module SCSSLint
|
|
182
182
|
|
183
183
|
# @param options [Hash]
|
184
184
|
# @param lints [Array<Lint>]
|
185
|
-
# @param files [Array<
|
185
|
+
# @param files [Array<Hash>]
|
186
186
|
def report_lints(options, lints, files)
|
187
187
|
sorted_lints = lints.sort_by { |l| [l.filename, l.location] }
|
188
188
|
options.fetch(:reporters).each do |reporter, output|
|
@@ -42,7 +42,7 @@ module SCSSLint
|
|
42
42
|
# for purposes of uniqueness.
|
43
43
|
def property_key(prop)
|
44
44
|
prop_key = prop.name.join
|
45
|
-
prop_value =
|
45
|
+
prop_value = value_as_string(prop.value)
|
46
46
|
|
47
47
|
# Differentiate between values for different vendor prefixes
|
48
48
|
prop_value.to_s.scan(/^(-[^-]+-.+)/) do |vendor_keyword|
|
@@ -52,15 +52,17 @@ module SCSSLint
|
|
52
52
|
prop_key
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
56
|
-
case
|
55
|
+
def value_as_string(value)
|
56
|
+
case value
|
57
57
|
when Sass::Script::Funcall
|
58
|
-
|
58
|
+
value.name
|
59
59
|
when Sass::Script::String
|
60
60
|
when Sass::Script::Tree::Literal
|
61
|
-
|
61
|
+
value.value
|
62
|
+
when Sass::Script::Tree::ListLiteral
|
63
|
+
value.elements.map { |e| value_as_string(e) }.join(' ')
|
62
64
|
else
|
63
|
-
|
65
|
+
value.to_s
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
@@ -14,7 +14,7 @@ module SCSSLint
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
# @param files [Array<
|
17
|
+
# @param files [Array<Hash>]
|
18
18
|
# @param lints [Array<SCSSLint::Lint>]
|
19
19
|
# @return [String]
|
20
20
|
def format_plan(files, lints)
|
@@ -24,15 +24,15 @@ module SCSSLint
|
|
24
24
|
"1..#{files.count + extra_lines}#{comment}"
|
25
25
|
end
|
26
26
|
|
27
|
-
# @param files [Array<
|
27
|
+
# @param files [Array<Hash>]
|
28
28
|
# @param lints [Array<SCSSLint::Lint>]
|
29
29
|
# @return [Array<String>] one item per ok file or not ok lint
|
30
30
|
def format_files(files, lints)
|
31
31
|
unless lints.any?
|
32
32
|
# There are no lints, so we can take a shortcut and just output an ok
|
33
33
|
# test line for every file.
|
34
|
-
return files.map.with_index do |
|
35
|
-
format_ok(
|
34
|
+
return files.map.with_index do |file, index|
|
35
|
+
format_ok(file, index + 1)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -45,17 +45,17 @@ module SCSSLint
|
|
45
45
|
grouped_lints = group_lints_by_filename(lints)
|
46
46
|
|
47
47
|
test_number = 1
|
48
|
-
files.map do |
|
49
|
-
if grouped_lints.key?(
|
48
|
+
files.map do |file|
|
49
|
+
if grouped_lints.key?(file[:path])
|
50
50
|
# This file has lints, so we want to generate a "not ok" test line for
|
51
51
|
# each failing lint.
|
52
|
-
grouped_lints[
|
52
|
+
grouped_lints[file[:path]].map do |lint|
|
53
53
|
formatted = format_not_ok(lint, test_number)
|
54
54
|
test_number += 1
|
55
55
|
formatted
|
56
56
|
end
|
57
57
|
else
|
58
|
-
formatted = format_ok(
|
58
|
+
formatted = format_ok(file, test_number)
|
59
59
|
test_number += 1
|
60
60
|
[formatted]
|
61
61
|
end
|
@@ -73,30 +73,38 @@ module SCSSLint
|
|
73
73
|
grouped_lints
|
74
74
|
end
|
75
75
|
|
76
|
-
# @param
|
76
|
+
# @param file [Hash]
|
77
77
|
# @param test_number [Number]
|
78
78
|
# @return [String]
|
79
|
-
def format_ok(
|
80
|
-
"ok #{test_number} - #{
|
79
|
+
def format_ok(file, test_number)
|
80
|
+
"ok #{test_number} - #{file[:path]}"
|
81
81
|
end
|
82
82
|
|
83
83
|
# @param lint [SCSSLint::Lint]
|
84
84
|
# @param test_number [Number]
|
85
85
|
# @return [String]
|
86
|
-
def format_not_ok(lint, test_number)
|
86
|
+
def format_not_ok(lint, test_number) # rubocop:disable Metrics/AbcSize
|
87
87
|
location = lint.location
|
88
88
|
test_line_description = "#{lint.filename}:#{location.line}:#{location.column}"
|
89
|
-
|
89
|
+
|
90
|
+
data = {
|
91
|
+
'message' => lint.description,
|
92
|
+
'severity' => lint.severity.to_s,
|
93
|
+
'file' => lint.filename,
|
94
|
+
'line' => lint.location.line,
|
95
|
+
'column' => lint.location.column,
|
96
|
+
}
|
97
|
+
|
98
|
+
if lint.linter
|
99
|
+
test_line_description += " #{lint.linter.name}" if lint.linter
|
100
|
+
data['name'] = lint.linter.name
|
101
|
+
end
|
102
|
+
|
103
|
+
data_yaml = data.to_yaml.strip.gsub(/^/, ' ')
|
90
104
|
|
91
105
|
<<-EOS.strip
|
92
106
|
not ok #{test_number} - #{test_line_description}
|
93
|
-
|
94
|
-
message: #{lint.description}
|
95
|
-
severity: #{lint.severity}
|
96
|
-
data:
|
97
|
-
file: #{lint.filename}
|
98
|
-
line: #{lint.location.line}
|
99
|
-
column: #{lint.location.column}
|
107
|
+
#{data_yaml}
|
100
108
|
...
|
101
109
|
EOS
|
102
110
|
end
|
data/lib/scss_lint/reporter.rb
CHANGED
@@ -8,7 +8,7 @@ module SCSSLint
|
|
8
8
|
end
|
9
9
|
|
10
10
|
# @param lints [List<Lint>] a list of Lints sorted by file and line number
|
11
|
-
# @param files [List<
|
11
|
+
# @param files [List<Hash>] a list of the files that were linted
|
12
12
|
# @param logger [SCSSLint::Logger]
|
13
13
|
def initialize(lints, files, logger)
|
14
14
|
@lints = lints
|
data/lib/scss_lint/version.rb
CHANGED
@@ -2,7 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Reporter::TAPReporter do
|
4
4
|
let(:logger) { SCSSLint::Logger.new($stdout) }
|
5
|
-
|
5
|
+
let(:files) { filenames.map { |filename| { path: filename } } }
|
6
|
+
subject { described_class.new(lints, files, logger) }
|
6
7
|
|
7
8
|
describe '#report_lints' do
|
8
9
|
context 'when there are no files' do
|
@@ -66,28 +67,28 @@ not ok 2 - not-ok1.scss:123:10 SCSSLint::Linter::PrivateNamingConvention
|
|
66
67
|
---
|
67
68
|
message: Description of lint 1
|
68
69
|
severity: warning
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
file: not-ok1.scss
|
71
|
+
line: 123
|
72
|
+
column: 10
|
73
|
+
name: SCSSLint::Linter::PrivateNamingConvention
|
73
74
|
...
|
74
75
|
not ok 3 - not-ok2.scss:20:2 SCSSLint::Linter::PrivateNamingConvention
|
75
76
|
---
|
76
77
|
message: Description of lint 2
|
77
78
|
severity: error
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
file: not-ok2.scss
|
80
|
+
line: 20
|
81
|
+
column: 2
|
82
|
+
name: SCSSLint::Linter::PrivateNamingConvention
|
82
83
|
...
|
83
84
|
not ok 4 - not-ok2.scss:21:3 SCSSLint::Linter::PrivateNamingConvention
|
84
85
|
---
|
85
86
|
message: Description of lint 3
|
86
87
|
severity: warning
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
file: not-ok2.scss
|
89
|
+
line: 21
|
90
|
+
column: 3
|
91
|
+
name: SCSSLint::Linter::PrivateNamingConvention
|
91
92
|
...
|
92
93
|
ok 5 - ok2.scss
|
93
94
|
EOS
|
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.47.
|
4
|
+
version: 0.47.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: 2016-02
|
12
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|