scss-lint 0.30.0 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/bin/scss-lint +1 -4
  3. data/config/default.yml +5 -4
  4. data/data/property-sort-orders/recess.txt +149 -0
  5. data/data/property-sort-orders/smacss.txt +138 -0
  6. data/lib/scss_lint.rb +1 -0
  7. data/lib/scss_lint/cli.rb +93 -153
  8. data/lib/scss_lint/config.rb +16 -13
  9. data/lib/scss_lint/control_comment_processor.rb +83 -0
  10. data/lib/scss_lint/engine.rb +21 -5
  11. data/lib/scss_lint/exceptions.rb +6 -0
  12. data/lib/scss_lint/linter.rb +6 -2
  13. data/lib/scss_lint/linter/bang_format.rb +20 -9
  14. data/lib/scss_lint/linter/duplicate_property.rb +35 -30
  15. data/lib/scss_lint/linter/empty_line_between_blocks.rb +1 -1
  16. data/lib/scss_lint/linter/id_selector.rb +10 -0
  17. data/lib/scss_lint/linter/indentation.rb +2 -1
  18. data/lib/scss_lint/linter/leading_zero.rb +6 -6
  19. data/lib/scss_lint/linter/name_format.rb +11 -0
  20. data/lib/scss_lint/linter/selector_format.rb +0 -4
  21. data/lib/scss_lint/linter/single_line_per_property.rb +13 -7
  22. data/lib/scss_lint/linter/single_line_per_selector.rb +19 -11
  23. data/lib/scss_lint/linter/trailing_semicolon.rb +5 -3
  24. data/lib/scss_lint/linter/trailing_zero.rb +4 -4
  25. data/lib/scss_lint/options.rb +113 -0
  26. data/lib/scss_lint/reporter/default_reporter.rb +15 -7
  27. data/lib/scss_lint/reporter/json_reporter.rb +15 -8
  28. data/lib/scss_lint/reporter/xml_reporter.rb +12 -6
  29. data/lib/scss_lint/runner.rb +4 -5
  30. data/lib/scss_lint/version.rb +1 -1
  31. data/spec/scss_lint/cli_spec.rb +9 -229
  32. data/spec/scss_lint/linter/bang_format_spec.rb +20 -0
  33. data/spec/scss_lint/linter/duplicate_property_spec.rb +13 -0
  34. data/spec/scss_lint/linter/empty_line_between_blocks_spec.rb +12 -11
  35. data/spec/scss_lint/linter/id_selector_spec.rb +62 -0
  36. data/spec/scss_lint/linter/indentation_spec.rb +11 -0
  37. data/spec/scss_lint/linter/name_format_spec.rb +147 -117
  38. data/spec/scss_lint/linter/selector_format_spec.rb +3 -66
  39. data/spec/scss_lint/linter/trailing_semicolon_spec.rb +20 -0
  40. data/spec/scss_lint/linter_spec.rb +248 -0
  41. data/spec/scss_lint/options_spec.rb +42 -0
  42. data/spec/spec_helper.rb +1 -1
  43. metadata +177 -183
  44. data/lib/scss_lint/linter/id_with_extraneous_selector.rb +0 -20
  45. data/spec/scss_lint/linter/id_with_extraneous_selector_spec.rb +0 -139
@@ -1,20 +0,0 @@
1
- module SCSSLint
2
- # Checks for a selector with an ID combined with some other selector.
3
- class Linter::IdWithExtraneousSelector < Linter
4
- include LinterRegistry
5
-
6
- def visit_simple_sequence(seq)
7
- id_sel = seq.members.find { |simple| simple.is_a?(Sass::Selector::Id) }
8
- return unless id_sel
9
-
10
- can_be_simplified = seq.members.any? do |simple|
11
- !simple.is_a?(Sass::Selector::Id) &&
12
- !simple.is_a?(Sass::Selector::Pseudo)
13
- end
14
- return unless can_be_simplified
15
-
16
- add_lint(seq.line, "Selector `#{seq}` can be simplified to `#{id_sel}`, " \
17
- 'since IDs should be uniquely identifying')
18
- end
19
- end
20
- end
@@ -1,139 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SCSSLint::Linter::IdWithExtraneousSelector do
4
- context 'when rule is just a type' do
5
- let(:css) { <<-CSS }
6
- p {
7
- }
8
- CSS
9
-
10
- it { should_not report_lint }
11
- end
12
-
13
- context 'when rule is just an ID' do
14
- let(:css) { <<-CSS }
15
- #identifier {
16
- }
17
- CSS
18
-
19
- it { should_not report_lint }
20
- end
21
-
22
- context 'when rule is just a class' do
23
- let(:css) { <<-CSS }
24
- .class {
25
- }
26
- CSS
27
-
28
- it { should_not report_lint }
29
- end
30
-
31
- context 'when rule is a type with a class' do
32
- let(:css) { <<-CSS }
33
- a.class {
34
- }
35
- CSS
36
-
37
- it { should_not report_lint }
38
- end
39
-
40
- context 'when rule is a type with an ID' do
41
- let(:css) { <<-CSS }
42
- a#identifier {
43
- }
44
- CSS
45
-
46
- it { should report_lint line: 1 }
47
- end
48
-
49
- context 'when rule is an ID with a pseudo' do
50
- let(:css) { <<-CSS }
51
- #identifier:active {
52
- }
53
- CSS
54
-
55
- it { should_not report_lint }
56
- end
57
-
58
- context 'when rule is a type with an ID with a pseudo' do
59
- let(:css) { <<-CSS }
60
- a#identifier:active {
61
- }
62
- CSS
63
-
64
- it { should report_lint line: 1 }
65
- end
66
-
67
- context 'when rule contains multiple selectors' do
68
- context 'when all of the selectors are just IDs, classes, or types' do
69
- let(:css) { <<-CSS }
70
- #identifier,
71
- .class,
72
- a {
73
- }
74
- CSS
75
-
76
- it { should_not report_lint }
77
- end
78
-
79
- context 'when one of the rules is an ID with a pseudo' do
80
- let(:css) { <<-CSS }
81
- #identifier:active,
82
- .class {
83
- }
84
- CSS
85
-
86
- it { should_not report_lint }
87
- end
88
-
89
- context 'when one of the rules is a type with an ID with a pseudo' do
90
- let(:css) { <<-CSS }
91
- a#identifier:active,
92
- .class {
93
- }
94
- CSS
95
-
96
- it { should report_lint line: 1 }
97
- end
98
-
99
- context 'when one of the selectors is a type and class' do
100
- let(:css) { <<-CSS }
101
- #identifier,
102
- a.class {
103
- }
104
- CSS
105
-
106
- it { should_not report_lint }
107
- end
108
-
109
- context 'when one of the selectors is a type and ID' do
110
- let(:css) { <<-CSS }
111
- #identifier,
112
- a#my-id {
113
- }
114
- CSS
115
-
116
- it { should report_lint line: 1 }
117
- end
118
- end
119
-
120
- context 'when rule contains a nested rule with type and ID' do
121
- let(:css) { <<-CSS }
122
- p {
123
- a#identifier {
124
- }
125
- }
126
- CSS
127
-
128
- it { should report_lint line: 2 }
129
- end
130
-
131
- context 'when selector contains a class and ID' do
132
- let(:css) { <<-CSS }
133
- #id.class {
134
- }
135
- CSS
136
-
137
- it { should report_lint line: 1 }
138
- end
139
- end