scss-lint 0.17.1 → 0.17.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e087dca04b3ac481c798c6c0780b2a714a05406a
4
- data.tar.gz: fc983fabca36dd3e16b21d2cb1d488949d97d1d0
3
+ metadata.gz: 1652c1165c1e0733c886de95fe04a42319edcb94
4
+ data.tar.gz: 20adb18c09edf8f59e8820f25acccddb96ec295c
5
5
  SHA512:
6
- metadata.gz: db528b6dcaa880dfda01852687b8347158b100a3dc3e35a3be7859222121204c06c8b7272fc6536298e0b54c50ed11aa0b8ca3ac995f9705ec42f83968334adb
7
- data.tar.gz: ae5ac3fcd4cde08613cc4cbeb80763b10a8b4e37f30b98f41af2a437b08932420b2f9e18054f59b808e24834912fc54780ffec50f2545c60478730447c195c01
6
+ metadata.gz: e5c1b3d9a1553bfcde5ff6a99f6ef7429faf2a0bd9d3497d2de8e6028ed97f7244147d056390540c8db3af52daf62ac51ca420120bb109845c1e7862ae7516f8
7
+ data.tar.gz: 8a710a91738f37d24de431b0e74b96fa080305710de584b7a7f6f29fb2db1852c95b35b0206aff8c29e66014d136a57f580f247221c0dc00f32bae6740729f91
@@ -18,9 +18,6 @@ linters:
18
18
  DeclarationOrder:
19
19
  enabled: true
20
20
 
21
- DeclaredName:
22
- enabled: true
23
-
24
21
  DuplicateProperty:
25
22
  enabled: true
26
23
 
@@ -43,6 +40,9 @@ linters:
43
40
  LeadingZero:
44
41
  enabled: true
45
42
 
43
+ NameFormat:
44
+ enabled: true
45
+
46
46
  PlaceholderInExtend:
47
47
  enabled: true
48
48
 
@@ -89,9 +89,6 @@ linters:
89
89
  UrlQuotes:
90
90
  enabled: true
91
91
 
92
- UsageName:
93
- enabled: true
94
-
95
92
  ZeroUnit:
96
93
  enabled: true
97
94
 
@@ -1,7 +1,7 @@
1
1
  module SCSSLint
2
- # Checks for variable/function/mixin/placeholder uses which contains uppercase
3
- # characters or underscores.
4
- class Linter::UsageName < Linter
2
+ # Checks that the declared names of functions, mixins, and variables are all
3
+ # lowercase and use hyphens instead of underscores.
4
+ class Linter::NameFormat < Linter
5
5
  include LinterRegistry
6
6
 
7
7
  def visit_extend(node)
@@ -10,17 +10,32 @@ module SCSSLint
10
10
  end
11
11
  end
12
12
 
13
+ def visit_function(node)
14
+ check_declared_name(node, 'function')
15
+ yield # Continue into content block of this function definition
16
+ end
17
+
13
18
  def visit_mixin(node)
14
- check(node, 'mixin')
19
+ check_name_use(node, 'mixin')
15
20
  yield # Continue into content block of this mixin's block
16
21
  end
17
22
 
23
+ def visit_mixindef(node)
24
+ check_declared_name(node, 'mixin')
25
+ yield # Continue into content block of this mixin definition
26
+ end
27
+
18
28
  def visit_script_funcall(node)
19
- check(node, 'function') unless FUNCTION_WHITELIST.include?(node.name)
29
+ check_name_use(node, 'function') unless FUNCTION_WHITELIST.include?(node.name)
20
30
  end
21
31
 
22
32
  def visit_script_variable(node)
23
- check(node, 'variable')
33
+ check_name_use(node, 'variable')
34
+ end
35
+
36
+ def visit_variable(node)
37
+ check_declared_name(node, 'variable')
38
+ yield # Continue into expression tree for this variable definition
24
39
  end
25
40
 
26
41
  private
@@ -32,7 +47,16 @@ module SCSSLint
32
47
  translateX translateY translateZ
33
48
  ].to_set
34
49
 
35
- def check(node, node_type)
50
+ def check_declared_name(node, node_type)
51
+ if node_has_bad_name?(node)
52
+ fixed_name = node.name.downcase.gsub(/_/, '-')
53
+
54
+ add_lint(node, "Name of #{node_type} `#{node.name}` should " <<
55
+ "be written in lowercase as `#{fixed_name}`")
56
+ end
57
+ end
58
+
59
+ def check_name_use(node, node_type)
36
60
  add_name_lint(node, node.name, node_type) if node_has_bad_name?(node)
37
61
  end
38
62
 
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module SCSSLint
3
- VERSION = '0.17.1'
3
+ VERSION = '0.17.2'
4
4
  end
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.17.1
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Causes Engineering
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-19 00:00:00.000000000 Z
12
+ date: 2014-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.6.0
48
+ version: 1.6.1
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 1.6.0
55
+ version: 1.6.1
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rspec
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -97,7 +97,6 @@ files:
97
97
  - lib/scss_lint/linter/space_before_brace.rb
98
98
  - lib/scss_lint/linter/capitalization_in_selector.rb
99
99
  - lib/scss_lint/linter/indentation.rb
100
- - lib/scss_lint/linter/declared_name.rb
101
100
  - lib/scss_lint/linter/sorted_properties.rb
102
101
  - lib/scss_lint/linter/trailing_semicolon_after_property_value.rb
103
102
  - lib/scss_lint/linter/shorthand.rb
@@ -110,8 +109,8 @@ files:
110
109
  - lib/scss_lint/linter/compass/property_with_mixin.rb
111
110
  - lib/scss_lint/linter/space_after_property_name.rb
112
111
  - lib/scss_lint/linter/property_spelling.rb
113
- - lib/scss_lint/linter/usage_name.rb
114
112
  - lib/scss_lint/linter/url_quotes.rb
113
+ - lib/scss_lint/linter/name_format.rb
115
114
  - lib/scss_lint/linter/space_between_parens.rb
116
115
  - lib/scss_lint/linter/border_zero.rb
117
116
  - lib/scss_lint/linter/space_after_property_colon.rb
@@ -1,33 +0,0 @@
1
- module SCSSLint
2
- # Checks that the declared names of functions, mixins, and variables are all
3
- # lowercase and use hyphens instead of underscores.
4
- class Linter::DeclaredName < Linter
5
- include LinterRegistry
6
-
7
- def visit_function(node)
8
- check(node, 'function')
9
- yield # Continue into content block of this function definition
10
- end
11
-
12
- def visit_mixindef(node)
13
- check(node, 'mixin')
14
- yield # Continue into content block of this mixin definition
15
- end
16
-
17
- def visit_variable(node)
18
- check(node, 'variable')
19
- yield # Continue into expression tree for this variable definition
20
- end
21
-
22
- private
23
-
24
- def check(node, node_type)
25
- if node_has_bad_name?(node)
26
- fixed_name = node.name.downcase.gsub(/_/, '-')
27
-
28
- add_lint(node, "Name of #{node_type} `#{node.name}` should " <<
29
- "be written in lowercase as `#{fixed_name}`")
30
- end
31
- end
32
- end
33
- end