scss-lint 0.33.0 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/config/default.yml +19 -1
  3. data/data/properties.txt +4 -0
  4. data/lib/scss_lint.rb +1 -0
  5. data/lib/scss_lint/cli.rb +4 -42
  6. data/lib/scss_lint/config.rb +1 -45
  7. data/lib/scss_lint/control_comment_processor.rb +47 -15
  8. data/lib/scss_lint/file_finder.rb +57 -0
  9. data/lib/scss_lint/linter/bang_format.rb +1 -1
  10. data/lib/scss_lint/linter/border_zero.rb +25 -9
  11. data/lib/scss_lint/linter/color_keyword.rb +3 -13
  12. data/lib/scss_lint/linter/color_variable.rb +36 -0
  13. data/lib/scss_lint/linter/declaration_order.rb +2 -2
  14. data/lib/scss_lint/linter/important_rule.rb +12 -0
  15. data/lib/scss_lint/linter/indentation.rb +7 -1
  16. data/lib/scss_lint/linter/property_count.rb +44 -0
  17. data/lib/scss_lint/linter/property_sort_order.rb +73 -19
  18. data/lib/scss_lint/linter/string_quotes.rb +9 -0
  19. data/lib/scss_lint/linter/variable_for_property.rb +20 -0
  20. data/lib/scss_lint/linter/vendor_prefixes.rb +3 -3
  21. data/lib/scss_lint/runner.rb +5 -7
  22. data/lib/scss_lint/utils.rb +34 -0
  23. data/lib/scss_lint/version.rb +1 -1
  24. data/spec/scss_lint/cli_spec.rb +1 -1
  25. data/spec/scss_lint/config_spec.rb +4 -203
  26. data/spec/scss_lint/engine_spec.rb +4 -4
  27. data/spec/scss_lint/file_finder_spec.rb +110 -0
  28. data/spec/scss_lint/linter/bang_format_spec.rb +28 -18
  29. data/spec/scss_lint/linter/border_zero_spec.rb +50 -16
  30. data/spec/scss_lint/linter/color_keyword_spec.rb +16 -16
  31. data/spec/scss_lint/linter/color_variable_spec.rb +102 -0
  32. data/spec/scss_lint/linter/comment_spec.rb +9 -9
  33. data/spec/scss_lint/linter/compass/property_with_mixin_spec.rb +10 -10
  34. data/spec/scss_lint/linter/debug_statement_spec.rb +4 -4
  35. data/spec/scss_lint/linter/declaration_order_spec.rb +80 -80
  36. data/spec/scss_lint/linter/duplicate_property_spec.rb +30 -30
  37. data/spec/scss_lint/linter/else_placement_spec.rb +16 -16
  38. data/spec/scss_lint/linter/empty_line_between_blocks_spec.rb +38 -38
  39. data/spec/scss_lint/linter/empty_rule_spec.rb +4 -4
  40. data/spec/scss_lint/linter/final_newline_spec.rb +6 -6
  41. data/spec/scss_lint/linter/hex_length_spec.rb +16 -16
  42. data/spec/scss_lint/linter/hex_notation_spec.rb +16 -16
  43. data/spec/scss_lint/linter/hex_validation_spec.rb +6 -6
  44. data/spec/scss_lint/linter/id_selector_spec.rb +10 -10
  45. data/spec/scss_lint/linter/import_path_spec.rb +45 -45
  46. data/spec/scss_lint/linter/important_rule_spec.rb +43 -0
  47. data/spec/scss_lint/linter/indentation_spec.rb +103 -43
  48. data/spec/scss_lint/linter/leading_zero_spec.rb +45 -45
  49. data/spec/scss_lint/linter/mergeable_selector_spec.rb +32 -32
  50. data/spec/scss_lint/linter/name_format_spec.rb +75 -41
  51. data/spec/scss_lint/linter/nesting_depth_spec.rb +14 -14
  52. data/spec/scss_lint/linter/placeholder_in_extend_spec.rb +12 -12
  53. data/spec/scss_lint/linter/property_count_spec.rb +104 -0
  54. data/spec/scss_lint/linter/property_sort_order_spec.rb +138 -48
  55. data/spec/scss_lint/linter/property_spelling_spec.rb +14 -14
  56. data/spec/scss_lint/linter/qualifying_element_spec.rb +26 -26
  57. data/spec/scss_lint/linter/selector_depth_spec.rb +26 -26
  58. data/spec/scss_lint/linter/selector_format_spec.rb +114 -114
  59. data/spec/scss_lint/linter/shorthand_spec.rb +32 -32
  60. data/spec/scss_lint/linter/single_line_per_property_spec.rb +10 -10
  61. data/spec/scss_lint/linter/single_line_per_selector_spec.rb +24 -24
  62. data/spec/scss_lint/linter/space_after_comma_spec.rb +60 -60
  63. data/spec/scss_lint/linter/space_after_property_colon_spec.rb +44 -44
  64. data/spec/scss_lint/linter/space_after_property_name_spec.rb +6 -6
  65. data/spec/scss_lint/linter/space_before_brace_spec.rb +119 -119
  66. data/spec/scss_lint/linter/space_between_parens_spec.rb +48 -48
  67. data/spec/scss_lint/linter/string_quotes_spec.rb +74 -62
  68. data/spec/scss_lint/linter/trailing_semicolon_spec.rb +53 -54
  69. data/spec/scss_lint/linter/trailing_zero_spec.rb +34 -34
  70. data/spec/scss_lint/linter/unnecessary_mantissa_spec.rb +10 -10
  71. data/spec/scss_lint/linter/unnecessary_parent_reference_spec.rb +18 -18
  72. data/spec/scss_lint/linter/url_format_spec.rb +4 -4
  73. data/spec/scss_lint/linter/url_quotes_spec.rb +14 -14
  74. data/spec/scss_lint/linter/variable_for_property_spec.rb +115 -0
  75. data/spec/scss_lint/linter/vendor_prefixes_spec.rb +66 -56
  76. data/spec/scss_lint/linter/zero_unit_spec.rb +22 -22
  77. data/spec/scss_lint/linter_spec.rb +72 -28
  78. data/spec/scss_lint/runner_spec.rb +0 -1
  79. data/spec/scss_lint/selector_visitor_spec.rb +23 -23
  80. data/spec/spec_helper.rb +2 -2
  81. metadata +27 -12
@@ -2,16 +2,16 @@ require 'spec_helper'
2
2
 
3
3
  describe SCSSLint::Linter::EmptyRule do
4
4
  context 'when rule is empty' do
5
- let(:css) { <<-CSS }
5
+ let(:scss) { <<-SCSS }
6
6
  p {
7
7
  }
8
- CSS
8
+ SCSS
9
9
 
10
10
  it { should report_lint line: 1 }
11
11
  end
12
12
 
13
13
  context 'when rule contains an empty nested rule' do
14
- let(:css) { <<-CSS }
14
+ let(:scss) { <<-SCSS }
15
15
  p {
16
16
  background: #000;
17
17
  display: none;
@@ -20,7 +20,7 @@ describe SCSSLint::Linter::EmptyRule do
20
20
  a {
21
21
  }
22
22
  }
23
- CSS
23
+ SCSS
24
24
 
25
25
  it { should report_lint line: 6 }
26
26
  end
@@ -7,19 +7,19 @@ describe SCSSLint::Linter::FinalNewline do
7
7
  let(:present) { true }
8
8
 
9
9
  context 'when the file is empty' do
10
- let(:css) { '' }
10
+ let(:scss) { '' }
11
11
 
12
12
  it { should_not report_lint }
13
13
  end
14
14
 
15
15
  context 'when the file ends with a newline' do
16
- let(:css) { "p {}\n" }
16
+ let(:scss) { "p {}\n" }
17
17
 
18
18
  it { should_not report_lint }
19
19
  end
20
20
 
21
21
  context 'when the file does not end with a newline' do
22
- let(:css) { 'p {}' }
22
+ let(:scss) { 'p {}' }
23
23
 
24
24
  it { should report_lint }
25
25
  end
@@ -29,19 +29,19 @@ describe SCSSLint::Linter::FinalNewline do
29
29
  let(:present) { false }
30
30
 
31
31
  context 'when the file is empty' do
32
- let(:css) { '' }
32
+ let(:scss) { '' }
33
33
 
34
34
  it { should_not report_lint }
35
35
  end
36
36
 
37
37
  context 'when the file ends with a newline' do
38
- let(:css) { "p {}\n" }
38
+ let(:scss) { "p {}\n" }
39
39
 
40
40
  it { should report_lint }
41
41
  end
42
42
 
43
43
  context 'when the file does not end with a newline' do
44
- let(:css) { 'p {}' }
44
+ let(:scss) { 'p {}' }
45
45
 
46
46
  it { should_not report_lint }
47
47
  end
@@ -5,39 +5,39 @@ describe SCSSLint::Linter::HexLength do
5
5
  let(:style) { 'short' }
6
6
 
7
7
  context 'when rule is empty' do
8
- let(:css) { <<-CSS }
8
+ let(:scss) { <<-SCSS }
9
9
  p {
10
10
  }
11
- CSS
11
+ SCSS
12
12
 
13
13
  it { should_not report_lint }
14
14
  end
15
15
 
16
16
  context 'when rule contains properties with valid hex code' do
17
- let(:css) { <<-CSS }
17
+ let(:scss) { <<-SCSS }
18
18
  p {
19
19
  color: #1234ab;
20
20
  }
21
- CSS
21
+ SCSS
22
22
 
23
23
  it { should_not report_lint }
24
24
  end
25
25
 
26
26
  context 'when ID selector starts with a hex code' do
27
- let(:css) { <<-CSS }
27
+ let(:scss) { <<-SCSS }
28
28
  #aabbcc {
29
29
  }
30
- CSS
30
+ SCSS
31
31
 
32
32
  it { should_not report_lint }
33
33
  end
34
34
 
35
35
  context 'when color is specified as a color keyword' do
36
- let(:css) { <<-CSS }
36
+ let(:scss) { <<-SCSS }
37
37
  p {
38
38
  @include box-shadow(0 0 1px 1px gold);
39
39
  }
40
- CSS
40
+ SCSS
41
41
 
42
42
  it { should_not report_lint }
43
43
  end
@@ -46,25 +46,25 @@ describe SCSSLint::Linter::HexLength do
46
46
  let(:style) { 'short' }
47
47
 
48
48
  context 'with short hex code' do
49
- let(:css) { <<-CSS }
49
+ let(:scss) { <<-SCSS }
50
50
  p {
51
51
  background: #ccc;
52
52
  background: #CCC;
53
53
  @include crazy-color(#fff);
54
54
  }
55
- CSS
55
+ SCSS
56
56
 
57
57
  it { should_not report_lint }
58
58
  end
59
59
 
60
60
  context 'with long hex code that could be condensed to 3 digits' do
61
- let(:css) { <<-CSS }
61
+ let(:scss) { <<-SCSS }
62
62
  p {
63
63
  background: #cccccc;
64
64
  background: #CCCCCC;
65
65
  @include crazy-color(#ffffff);
66
66
  }
67
- CSS
67
+ SCSS
68
68
 
69
69
  it { should report_lint line: 2 }
70
70
  it { should report_lint line: 3 }
@@ -76,25 +76,25 @@ describe SCSSLint::Linter::HexLength do
76
76
  let(:style) { 'long' }
77
77
 
78
78
  context 'with long hex code that could be condensed to 3 digits' do
79
- let(:css) { <<-CSS }
79
+ let(:scss) { <<-SCSS }
80
80
  p {
81
81
  background: #cccccc;
82
82
  background: #CCCCCC;
83
83
  @include crazy-color(#ffffff);
84
84
  }
85
- CSS
85
+ SCSS
86
86
 
87
87
  it { should_not report_lint }
88
88
  end
89
89
 
90
90
  context 'with short hex code' do
91
- let(:css) { <<-CSS }
91
+ let(:scss) { <<-SCSS }
92
92
  p {
93
93
  background: #ccc;
94
94
  background: #CCC;
95
95
  @include crazy-color(#fff);
96
96
  }
97
- CSS
97
+ SCSS
98
98
 
99
99
  it { should report_lint line: 2 }
100
100
  it { should report_lint line: 3 }
@@ -5,20 +5,20 @@ describe SCSSLint::Linter::HexNotation do
5
5
  let(:style) { nil }
6
6
 
7
7
  context 'when rule is empty' do
8
- let(:css) { <<-CSS }
8
+ let(:scss) { <<-SCSS }
9
9
  p {
10
10
  }
11
- CSS
11
+ SCSS
12
12
 
13
13
  it { should_not report_lint }
14
14
  end
15
15
 
16
16
  context 'when rule contains color keyword' do
17
- let(:css) { <<-CSS }
17
+ let(:scss) { <<-SCSS }
18
18
  p {
19
19
  border-color: red;
20
20
  }
21
- CSS
21
+ SCSS
22
22
 
23
23
  it { should_not report_lint }
24
24
  end
@@ -27,25 +27,25 @@ describe SCSSLint::Linter::HexNotation do
27
27
  let(:style) { 'lowercase' }
28
28
 
29
29
  context 'when rule contains properties with lowercase hex code' do
30
- let(:css) { <<-CSS }
30
+ let(:scss) { <<-SCSS }
31
31
  p {
32
32
  background: #ccc;
33
33
  color: #cccccc;
34
34
  @include crazy-color(#fff);
35
35
  }
36
- CSS
36
+ SCSS
37
37
 
38
38
  it { should_not report_lint }
39
39
  end
40
40
 
41
41
  context 'with uppercase hex codes' do
42
- let(:css) { <<-CSS }
42
+ let(:scss) { <<-SCSS }
43
43
  p {
44
44
  background: #CCC;
45
45
  color: #CCCCCC;
46
46
  @include crazy-color(#FFF);
47
47
  }
48
- CSS
48
+ SCSS
49
49
 
50
50
  it { should report_lint line: 2 }
51
51
  it { should report_lint line: 3 }
@@ -57,25 +57,25 @@ describe SCSSLint::Linter::HexNotation do
57
57
  let(:style) { 'uppercase' }
58
58
 
59
59
  context 'with uppercase hex codes' do
60
- let(:css) { <<-CSS }
60
+ let(:scss) { <<-SCSS }
61
61
  p {
62
62
  background: #CCC;
63
63
  color: #CCCCCC;
64
64
  @include crazy-color(#FFF);
65
65
  }
66
- CSS
66
+ SCSS
67
67
 
68
68
  it { should_not report_lint }
69
69
  end
70
70
 
71
71
  context 'when rule contains properties with lowercase hex code' do
72
- let(:css) { <<-CSS }
72
+ let(:scss) { <<-SCSS }
73
73
  p {
74
74
  background: #ccc;
75
75
  color: #cccccc;
76
76
  @include crazy-color(#fff);
77
77
  }
78
- CSS
78
+ SCSS
79
79
 
80
80
  it { should report_lint line: 2 }
81
81
  it { should report_lint line: 3 }
@@ -84,20 +84,20 @@ describe SCSSLint::Linter::HexNotation do
84
84
  end
85
85
 
86
86
  context 'when ID selector starts with a hex code' do
87
- let(:css) { <<-CSS }
87
+ let(:scss) { <<-SCSS }
88
88
  #aabbcc {
89
89
  }
90
- CSS
90
+ SCSS
91
91
 
92
92
  it { should_not report_lint }
93
93
  end
94
94
 
95
95
  context 'when color is specified as a color keyword' do
96
- let(:css) { <<-CSS }
96
+ let(:scss) { <<-SCSS }
97
97
  p {
98
98
  @include box-shadow(0 0 1px 1px gold);
99
99
  }
100
- CSS
100
+ SCSS
101
101
 
102
102
  it { should_not report_lint }
103
103
  end
@@ -2,10 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  describe SCSSLint::Linter::HexValidation do
4
4
  context 'when rule is empty' do
5
- let(:css) { <<-CSS }
5
+ let(:scss) { <<-SCSS }
6
6
  p {
7
7
  }
8
- CSS
8
+ SCSS
9
9
 
10
10
  it { should_not report_lint }
11
11
  end
@@ -14,25 +14,25 @@ describe SCSSLint::Linter::HexValidation do
14
14
  gradient_css = 'progid:DXImageTransform.Microsoft.gradient' \
15
15
  '(startColorstr=#99000000, endColorstr=#99000000)'
16
16
 
17
- let(:css) { <<-CSS }
17
+ let(:scss) { <<-SCSS }
18
18
  p {
19
19
  background: #000;
20
20
  color: #FFFFFF;
21
21
  border-color: red;
22
22
  filter: #{gradient_css};
23
23
  }
24
- CSS
24
+ SCSS
25
25
 
26
26
  it { should_not report_lint }
27
27
  end
28
28
 
29
29
  context 'when rule contains invalid hex codes' do
30
- let(:css) { <<-CSS }
30
+ let(:scss) { <<-SCSS }
31
31
  p {
32
32
  background: #dd;
33
33
  color: #dddd;
34
34
  }
35
- CSS
35
+ SCSS
36
36
 
37
37
  it { should report_lint line: 2 }
38
38
  it { should report_lint line: 3 }
@@ -2,59 +2,59 @@ require 'spec_helper'
2
2
 
3
3
  describe SCSSLint::Linter::IdSelector do
4
4
  context 'when rule is a type' do
5
- let(:css) { 'p {}' }
5
+ let(:scss) { 'p {}' }
6
6
 
7
7
  it { should_not report_lint }
8
8
  end
9
9
 
10
10
  context 'when rule is an ID' do
11
- let(:css) { '#identifier {}' }
11
+ let(:scss) { '#identifier {}' }
12
12
 
13
13
  it { should report_lint line: 1 }
14
14
  end
15
15
 
16
16
  context 'when rule is a class' do
17
- let(:css) { '.class {}' }
17
+ let(:scss) { '.class {}' }
18
18
 
19
19
  it { should_not report_lint }
20
20
  end
21
21
 
22
22
  context 'when rule is a type with a class' do
23
- let(:css) { 'a.class {}' }
23
+ let(:scss) { 'a.class {}' }
24
24
 
25
25
  it { should_not report_lint }
26
26
  end
27
27
 
28
28
  context 'when rule is a type with an ID' do
29
- let(:css) { 'a#identifier {}' }
29
+ let(:scss) { 'a#identifier {}' }
30
30
 
31
31
  it { should report_lint line: 1 }
32
32
  end
33
33
 
34
34
  context 'when rule is an ID with a pseudo-selector' do
35
- let(:css) { '#identifier:active {}' }
35
+ let(:scss) { '#identifier:active {}' }
36
36
 
37
37
  it { should report_lint line: 1 }
38
38
  end
39
39
 
40
40
  context 'when rule contains a nested rule with type and ID' do
41
- let(:css) { <<-CSS }
41
+ let(:scss) { <<-SCSS }
42
42
  p {
43
43
  a#identifier {}
44
44
  }
45
- CSS
45
+ SCSS
46
46
 
47
47
  it { should report_lint line: 2 }
48
48
  end
49
49
 
50
50
  context 'when rule contains multiple selectors' do
51
51
  context 'when all of the selectors are just IDs, classes, or types' do
52
- let(:css) { <<-CSS }
52
+ let(:scss) { <<-SCSS }
53
53
  #identifier,
54
54
  .class,
55
55
  a {
56
56
  }
57
- CSS
57
+ SCSS
58
58
 
59
59
  it { should report_lint line: 1 }
60
60
  end
@@ -3,44 +3,44 @@ require 'spec_helper'
3
3
  describe SCSSLint::Linter::ImportPath do
4
4
  context 'when the path includes no directories' do
5
5
  context 'and the filename has no leading underscore or filename extension' do
6
- let(:css) { '@import "filename";' }
6
+ let(:scss) { '@import "filename";' }
7
7
 
8
8
  it { should_not report_lint }
9
9
  end
10
10
 
11
11
  context 'and the filename has a leading underscore' do
12
- let(:css) { '@import "_filename";' }
12
+ let(:scss) { '@import "_filename";' }
13
13
 
14
14
  it { should report_lint line: 1 }
15
15
  end
16
16
 
17
17
  context 'and the filename has a filename extension' do
18
- let(:css) { '@import "filename.scss";' }
18
+ let(:scss) { '@import "filename.scss";' }
19
19
 
20
20
  it { should report_lint line: 1 }
21
21
  end
22
22
 
23
23
  context 'and the filename has a leading underscore and a filename extension' do
24
- let(:css) { '@import "_filename.scss";' }
24
+ let(:scss) { '@import "_filename.scss";' }
25
25
 
26
26
  it { should report_lint line: 1 }
27
27
  end
28
28
 
29
29
  context 'and multiple files are @imported' do
30
30
  context 'and neither have leading underscores or filename extensions' do
31
- let(:css) { '@import "foo", "bar";' }
31
+ let(:scss) { '@import "foo", "bar";' }
32
32
 
33
33
  it { should_not report_lint }
34
34
  end
35
35
 
36
36
  context 'and the second has a leading underscore' do
37
- let(:css) { '@import "foo", "_bar";' }
37
+ let(:scss) { '@import "foo", "_bar";' }
38
38
 
39
39
  it { should report_lint line: 1 }
40
40
  end
41
41
 
42
42
  context 'and the first has a filename extension' do
43
- let(:css) { '@import "foo.scss", "bar";' }
43
+ let(:scss) { '@import "foo.scss", "bar";' }
44
44
 
45
45
  it { should report_lint line: 1 }
46
46
  end
@@ -49,44 +49,44 @@ describe SCSSLint::Linter::ImportPath do
49
49
 
50
50
  context 'when the path includes directories' do
51
51
  context 'and the filename has no leading underscore or filename extension' do
52
- let(:css) { '@import "path/to/filename";' }
52
+ let(:scss) { '@import "path/to/filename";' }
53
53
 
54
54
  it { should_not report_lint }
55
55
  end
56
56
 
57
57
  context 'and the filename has a leading underscore' do
58
- let(:css) { '@import "../to/_filename";' }
58
+ let(:scss) { '@import "../to/_filename";' }
59
59
 
60
60
  it { should report_lint line: 1 }
61
61
  end
62
62
 
63
63
  context 'and the filename has a filename extension' do
64
- let(:css) { '@import "/path/to/filename.scss";' }
64
+ let(:scss) { '@import "/path/to/filename.scss";' }
65
65
 
66
66
  it { should report_lint line: 1 }
67
67
  end
68
68
 
69
69
  context 'and the filename has a leading underscore and a filename extension' do
70
- let(:css) { '@import "path/to/_filename.scss";' }
70
+ let(:scss) { '@import "path/to/_filename.scss";' }
71
71
 
72
72
  it { should report_lint line: 1 }
73
73
  end
74
74
 
75
75
  context 'and multiple files are @imported' do
76
76
  context 'and neither have leading underscores or filename extensions' do
77
- let(:css) { '@import "path/to/foo", "../../bar";' }
77
+ let(:scss) { '@import "path/to/foo", "../../bar";' }
78
78
 
79
79
  it { should_not report_lint }
80
80
  end
81
81
 
82
82
  context 'and the second has a leading underscore' do
83
- let(:css) { '@import "path/to/foo", "../../_bar";' }
83
+ let(:scss) { '@import "path/to/foo", "../../_bar";' }
84
84
 
85
85
  it { should report_lint line: 1 }
86
86
  end
87
87
 
88
88
  context 'and the first has a filename extension' do
89
- let(:css) { '@import "path/to/foo.scss", "../../bar";' }
89
+ let(:scss) { '@import "path/to/foo.scss", "../../bar";' }
90
90
 
91
91
  it { should report_lint line: 1 }
92
92
  end
@@ -97,44 +97,44 @@ describe SCSSLint::Linter::ImportPath do
97
97
  let(:linter_config) { { 'leading_underscore' => true } }
98
98
 
99
99
  context 'and the filename has no leading underscore or filename extension' do
100
- let(:css) { '@import "path/to/filename";' }
100
+ let(:scss) { '@import "path/to/filename";' }
101
101
 
102
102
  it { should report_lint line: 1 }
103
103
  end
104
104
 
105
105
  context 'and the filename has a leading underscore' do
106
- let(:css) { '@import "../to/_filename";' }
106
+ let(:scss) { '@import "../to/_filename";' }
107
107
 
108
108
  it { should_not report_lint }
109
109
  end
110
110
 
111
111
  context 'and the filename has a filename extension' do
112
- let(:css) { '@import "/path/to/filename.scss";' }
112
+ let(:scss) { '@import "/path/to/filename.scss";' }
113
113
 
114
114
  it { should report_lint line: 1 }
115
115
  end
116
116
 
117
117
  context 'and the filename has a leading underscore and a filename extension' do
118
- let(:css) { '@import "path/to/_filename.scss";' }
118
+ let(:scss) { '@import "path/to/_filename.scss";' }
119
119
 
120
120
  it { should report_lint line: 1 }
121
121
  end
122
122
 
123
123
  context 'and multiple files are @imported' do
124
124
  context 'and neither have leading underscores or filename extensions' do
125
- let(:css) { '@import "path/to/foo", "../../bar";' }
125
+ let(:scss) { '@import "path/to/foo", "../../bar";' }
126
126
 
127
127
  it { should report_lint line: 1 }
128
128
  end
129
129
 
130
130
  context 'and both have a leading underscore' do
131
- let(:css) { '@import "path/to/_foo", "../../_bar";' }
131
+ let(:scss) { '@import "path/to/_foo", "../../_bar";' }
132
132
 
133
133
  it { should_not report_lint }
134
134
  end
135
135
 
136
136
  context 'and only one has a leading underscore' do
137
- let(:css) { '@import "path/to/foo.scss", "../../_bar";' }
137
+ let(:scss) { '@import "path/to/foo.scss", "../../_bar";' }
138
138
 
139
139
  it { should report_lint line: 1 }
140
140
  end
@@ -145,44 +145,44 @@ describe SCSSLint::Linter::ImportPath do
145
145
  let(:linter_config) { { 'filename_extension' => true } }
146
146
 
147
147
  context 'and the filename has no leading underscore or filename extension' do
148
- let(:css) { '@import "path/to/filename";' }
148
+ let(:scss) { '@import "path/to/filename";' }
149
149
 
150
150
  it { should report_lint line: 1 }
151
151
  end
152
152
 
153
153
  context 'and the filename has a leading underscore' do
154
- let(:css) { '@import "../to/_filename";' }
154
+ let(:scss) { '@import "../to/_filename";' }
155
155
 
156
156
  it { should report_lint line: 1 }
157
157
  end
158
158
 
159
159
  context 'and the filename has a filename extension' do
160
- let(:css) { '@import "/path/to/filename.scss";' }
160
+ let(:scss) { '@import "/path/to/filename.scss";' }
161
161
 
162
162
  it { should_not report_lint }
163
163
  end
164
164
 
165
165
  context 'and the filename has a leading underscore and a filename extension' do
166
- let(:css) { '@import "path/to/_filename.scss";' }
166
+ let(:scss) { '@import "path/to/_filename.scss";' }
167
167
 
168
168
  it { should report_lint line: 1 }
169
169
  end
170
170
 
171
171
  context 'and multiple files are @imported' do
172
172
  context 'and neither have leading underscores or filename extensions' do
173
- let(:css) { '@import "path/to/foo", "../../bar";' }
173
+ let(:scss) { '@import "path/to/foo", "../../bar";' }
174
174
 
175
175
  it { should report_lint line: 1 }
176
176
  end
177
177
 
178
178
  context 'and both have filename extensions' do
179
- let(:css) { '@import "path/to/foo.scss", "../../bar.scss";' }
179
+ let(:scss) { '@import "path/to/foo.scss", "../../bar.scss";' }
180
180
 
181
181
  it { should_not report_lint }
182
182
  end
183
183
 
184
184
  context 'and only one has a filename extensions' do
185
- let(:css) { '@import "path/to/foo.scss", "../../bar";' }
185
+ let(:scss) { '@import "path/to/foo.scss", "../../bar";' }
186
186
 
187
187
  it { should report_lint line: 1 }
188
188
  end
@@ -193,44 +193,44 @@ describe SCSSLint::Linter::ImportPath do
193
193
  let(:linter_config) { { 'leading_underscore' => true, 'filename_extension' => true } }
194
194
 
195
195
  context 'and the filename has no leading underscore or filename extension' do
196
- let(:css) { '@import "path/to/filename";' }
196
+ let(:scss) { '@import "path/to/filename";' }
197
197
 
198
198
  it { should report_lint line: 1 }
199
199
  end
200
200
 
201
201
  context 'and the filename has a leading underscore' do
202
- let(:css) { '@import "../to/_filename";' }
202
+ let(:scss) { '@import "../to/_filename";' }
203
203
 
204
204
  it { should report_lint line: 1 }
205
205
  end
206
206
 
207
207
  context 'and the filename has a filename extension' do
208
- let(:css) { '@import "/path/to/filename.scss";' }
208
+ let(:scss) { '@import "/path/to/filename.scss";' }
209
209
 
210
210
  it { should report_lint line: 1 }
211
211
  end
212
212
 
213
213
  context 'and the filename has a leading underscore and a filename extension' do
214
- let(:css) { '@import "path/to/_filename.scss";' }
214
+ let(:scss) { '@import "path/to/_filename.scss";' }
215
215
 
216
216
  it { should_not report_lint }
217
217
  end
218
218
 
219
219
  context 'and multiple files are @imported' do
220
220
  context 'and neither have leading underscores or filename extensions' do
221
- let(:css) { '@import "path/to/foo", "../../bar";' }
221
+ let(:scss) { '@import "path/to/foo", "../../bar";' }
222
222
 
223
223
  it { should report_lint line: 1 }
224
224
  end
225
225
 
226
226
  context 'and both have filename extensions and leading underscores' do
227
- let(:css) { '@import "path/to/_foo.scss", "../../_bar.scss";' }
227
+ let(:scss) { '@import "path/to/_foo.scss", "../../_bar.scss";' }
228
228
 
229
229
  it { should_not report_lint }
230
230
  end
231
231
 
232
232
  context 'and only one has both a filename extension and a leading underscore' do
233
- let(:css) { '@import "path/to/_foo.scss", "../../bar.scss";' }
233
+ let(:scss) { '@import "path/to/_foo.scss", "../../bar.scss";' }
234
234
 
235
235
  it { should report_lint line: 1 }
236
236
  end
@@ -239,34 +239,34 @@ describe SCSSLint::Linter::ImportPath do
239
239
 
240
240
  context 'when the @import directive compiles directly to a CSS @import rule' do
241
241
  context 'and the @import is a CSS file' do
242
- let(:css) { '@import "_foo.css";' }
242
+ let(:scss) { '@import "_foo.css";' }
243
243
 
244
244
  it { should_not report_lint }
245
245
  end
246
246
 
247
247
  context 'and the @import contains a protocol' do
248
- let(:css) { '@import "http://foo.com/_bar.css";' }
248
+ let(:scss) { '@import "http://foo.com/_bar.css";' }
249
249
 
250
250
  it { should_not report_lint }
251
251
  end
252
252
 
253
253
  context 'and the @import contains a media query' do
254
- let(:css) { '@import "_foo.css" screen;' }
254
+ let(:scss) { '@import "_foo.css" screen;' }
255
255
 
256
256
  it { should_not report_lint }
257
257
  end
258
258
 
259
259
  context 'and the @import is a URL' do
260
- let(:css) { '@import url(_foo.css);' }
260
+ let(:scss) { '@import url(_foo.css);' }
261
261
 
262
262
  it { should_not report_lint }
263
263
  end
264
264
 
265
265
  context 'and the @import contains interpolation' do
266
- let(:css) { <<-CSS }
266
+ let(:scss) { <<-SCSS }
267
267
  $family: unquote("Droid+Sans");
268
268
  @import url("http://fonts.googleapis.com/css?family=\#{$family}");
269
- CSS
269
+ SCSS
270
270
 
271
271
  it { should_not report_lint }
272
272
  end
@@ -274,25 +274,25 @@ describe SCSSLint::Linter::ImportPath do
274
274
 
275
275
  context 'when the partial has the same name as its directory' do
276
276
  context 'and the filename has no leading underscore or filename extension' do
277
- let(:css) { '@import "foo/foo";' }
277
+ let(:scss) { '@import "foo/foo";' }
278
278
 
279
279
  it { should_not report_lint }
280
280
  end
281
281
 
282
282
  context 'and the filename has a leading underscore' do
283
- let(:css) { '@import "_foo/_foo";' }
283
+ let(:scss) { '@import "_foo/_foo";' }
284
284
 
285
285
  it { should report_lint line: 1 }
286
286
  end
287
287
 
288
288
  context 'and the filename has a filename extension' do
289
- let(:css) { '@import "foo/foo.scss";' }
289
+ let(:scss) { '@import "foo/foo.scss";' }
290
290
 
291
291
  it { should report_lint line: 1 }
292
292
  end
293
293
 
294
294
  context 'and the filename has a leading underscore and a filename extension' do
295
- let(:css) { '@import "_foo/_foo.scss";' }
295
+ let(:scss) { '@import "_foo/_foo.scss";' }
296
296
 
297
297
  it { should report_lint line: 1 }
298
298
  end