scss-lint 0.7.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +7 -0
  2. data/lib/sass/script.rb +12 -0
  3. data/lib/scss_lint.rb +3 -1
  4. data/lib/scss_lint/cli.rb +27 -5
  5. data/lib/scss_lint/linter.rb +1 -1
  6. data/lib/scss_lint/linter/{border_zero_linter.rb → border_zero.rb} +1 -3
  7. data/lib/scss_lint/linter/capitalization_in_selector.rb +15 -0
  8. data/lib/scss_lint/linter/{comment_linter.rb → comment.rb} +1 -3
  9. data/lib/scss_lint/linter/{debug_linter.rb → debug_statement.rb} +1 -3
  10. data/lib/scss_lint/linter/{declaration_order_linter.rb → declaration_order.rb} +1 -3
  11. data/lib/scss_lint/linter/{declared_name_linter.rb → declared_name.rb} +9 -18
  12. data/lib/scss_lint/linter/{empty_rule_linter.rb → empty_rule.rb} +1 -3
  13. data/lib/scss_lint/linter/{hex_linter.rb → hex_format.rb} +1 -3
  14. data/lib/scss_lint/linter/no_zero_before_decimal.rb +22 -0
  15. data/lib/scss_lint/linter/placeholder_in_extend.rb +17 -0
  16. data/lib/scss_lint/linter/{property_format_linter.rb → property_format.rb} +1 -3
  17. data/lib/scss_lint/linter/{shorthand_linter.rb → shorthand.rb} +1 -3
  18. data/lib/scss_lint/linter/{single_line_per_selector_linter.rb → single_line_per_selector.rb} +0 -2
  19. data/lib/scss_lint/linter/sorted_properties.rb +68 -0
  20. data/lib/scss_lint/linter/space_before_brace.rb +17 -0
  21. data/lib/scss_lint/linter/{type_in_id_selector_linter.rb → type_in_id_selector.rb} +1 -3
  22. data/lib/scss_lint/linter/usage_name.rb +40 -0
  23. data/lib/scss_lint/linter/{zero_unit_linter.rb → zero_unit.rb} +1 -3
  24. data/lib/scss_lint/linter_registry.rb +2 -3
  25. data/lib/scss_lint/runner.rb +8 -10
  26. data/lib/scss_lint/utils.rb +38 -0
  27. data/lib/scss_lint/version.rb +1 -1
  28. metadata +34 -37
  29. data/lib/scss_lint/linter/sorted_properties_linter.rb +0 -27
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dbee51206b106602ef0961c6c03bfb6974d4f2eb
4
+ data.tar.gz: 2e87d30b614973420c6a8956ff4248325dbcc05d
5
+ SHA512:
6
+ metadata.gz: 4c3cba3c53f301916ee8ebcdab2e6ee7167e3014c7dae55bcf0b48a490f5f091cbb9ef20335a4133ab20de8b1e8b031900f6e6bf46b293b3a95e92a997195083
7
+ data.tar.gz: 10fc7fe143641a411666fe6ff26b434fe98d0fad0b58ac4e99113dd24e5fa09a0299a5ffdcded16bfd0eee8fff8728eeef4187e9a49aec8f74ba2f9adcc36302
@@ -0,0 +1,12 @@
1
+ # Contains extensions of Sass::Script::Nodes to add support for accessing
2
+ # various parts of the parse tree not provided out-of-the-box.
3
+ module Sass::Script
4
+ class Variable
5
+ # When accessing keyword arguments, the Sass parser treats the underscored
6
+ # name as canonical. Since this only matters during the compilation step, we
7
+ # can safely override the behaviour to return the original name.
8
+ def underscored_name
9
+ @name
10
+ end
11
+ end
12
+ end
data/lib/scss_lint.rb CHANGED
@@ -8,11 +8,13 @@ module SCSSLint
8
8
  autoload :Linter, 'scss_lint/linter'
9
9
  autoload :Reporter, 'scss_lint/reporter'
10
10
  autoload :Runner, 'scss_lint/runner'
11
+ autoload :Utils, 'scss_lint/utils'
11
12
  autoload :VERSION, 'scss_lint/version'
12
13
 
13
14
  # Preload Sass so we can monkey patch it
14
15
  require 'sass'
15
- require 'sass/tree'
16
+ require File.expand_path('sass/script', File.dirname(__FILE__))
17
+ require File.expand_path('sass/tree', File.dirname(__FILE__))
16
18
 
17
19
  # Load all linters
18
20
  Dir[File.expand_path('scss_lint/linter/*.rb', File.dirname(__FILE__))].each do |file|
data/lib/scss_lint/cli.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'scss_lint'
2
1
  require 'optparse'
3
2
 
4
3
  module SCSSLint
@@ -22,9 +21,18 @@ module SCSSLint
22
21
  options[:excluded_files] = files
23
22
  end
24
23
 
25
- opts.on('-i', '--ignore-linter linter,...', Array,
24
+ opts.on('-i', '--include-linter linter,...', Array,
25
+ 'Specify which linters you want to run') do |linters|
26
+ options[:included_linters] = linters
27
+ end
28
+
29
+ opts.on('-x', '--exclude-linter linter,...', Array,
26
30
  "Specify which linters you don't want to run") do |linters|
27
- options[:ignored_linters] = linters
31
+ options[:excluded_linters] = linters
32
+ end
33
+
34
+ opts.on_tail('--show-linters', 'Shows available linters') do
35
+ print_linters
28
36
  end
29
37
 
30
38
  opts.on_tail('-h', '--help', 'Show this message') do
@@ -35,7 +43,7 @@ module SCSSLint
35
43
  print_version opts.program_name, VERSION
36
44
  end
37
45
 
38
- opts.on('-x', '--xml', 'Output the results in XML format') do
46
+ opts.on('--xml', 'Output the results in XML format') do
39
47
  options[:reporter] = SCSSLint::Reporter::XMLReporter
40
48
  end
41
49
  end
@@ -55,7 +63,7 @@ module SCSSLint
55
63
  runner.run(find_files)
56
64
  report_lints(runner.lints)
57
65
  halt 1 if runner.lints?
58
- rescue NoFilesError, NoSuchLinter => ex
66
+ rescue NoFilesError, NoSuchLinter, Errno::ENOENT => ex
59
67
  puts ex.message
60
68
  halt -1
61
69
  end
@@ -77,6 +85,20 @@ module SCSSLint
77
85
  print output if output
78
86
  end
79
87
 
88
+ def print_linters
89
+ puts 'Installed linters:'
90
+
91
+ linter_names = LinterRegistry.linters.map do |linter|
92
+ linter.name.split('::').last
93
+ end
94
+
95
+ linter_names.sort.each do |linter_name|
96
+ puts " - #{linter_name}"
97
+ end
98
+
99
+ halt
100
+ end
101
+
80
102
  def print_help(help_message, err = nil)
81
103
  puts err, '' if err
82
104
  puts help_message
@@ -1,6 +1,6 @@
1
1
  module SCSSLint
2
2
  class Linter < Sass::Tree::Visitors::Base
3
- include LinterRegistry
3
+ include Utils
4
4
 
5
5
  attr_reader :engine, :lints
6
6
 
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::BorderZeroLinter < Linter
2
+ class Linter::BorderZero < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_prop(node)
@@ -0,0 +1,15 @@
1
+ module SCSSLint
2
+ class Linter::CapitalizationInSelector < Linter
3
+ include LinterRegistry
4
+
5
+ def visit_rule(node)
6
+ add_lint(node) if node.rule.first =~ /[A-Z]/
7
+
8
+ yield # Continue linting children
9
+ end
10
+
11
+ def description
12
+ 'Selectors should be lowercase'
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::CommentLinter < Linter
2
+ class Linter::Comment < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_comment(node)
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::DebugLinter < Linter
2
+ class Linter::DebugStatement < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_debug(node)
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::DeclarationOrderLinter < Linter
2
+ class Linter::DeclarationOrder < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  DECLARATION_ORDER = [
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::DeclaredNameLinter < Linter
2
+ class Linter::DeclaredName < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_function(node)
@@ -9,37 +7,30 @@ module SCSSLint
9
7
  yield # Continue into content block of this function definition
10
8
  end
11
9
 
12
- def visit_mixin(node)
13
- check(node)
14
- yield # Continue into content block of this mixin's block
15
- end
16
-
17
10
  def visit_mixindef(node)
18
11
  check(node)
19
12
  yield # Continue into content block of this mixin definition
20
13
  end
21
14
 
22
- def visit_variable(node)
23
- check(node)
24
- yield # Continue into expression tree for this variable definition
25
- end
26
-
27
- def visit_script_funcall(node)
28
- check(node)
15
+ def visit_rule(node)
16
+ add_lint(node) if selector_has_bad_placeholder?(node.rule)
17
+ yield # Continue linting into content block of this rule definition
29
18
  end
30
19
 
31
- def visit_script_variable(node)
20
+ def visit_variable(node)
32
21
  check(node)
22
+ yield # Continue into expression tree for this variable definition
33
23
  end
34
24
 
35
25
  def description
36
- 'Names of variables, functions, and mixins should be lowercase and not contain underscores. Use hyphens instead.'
26
+ 'Names of variables, functions, mixins, and placeholders should be ' <<
27
+ 'lowercase and use hyphens instead of underscores.'
37
28
  end
38
29
 
39
30
  private
40
31
 
41
32
  def check(node)
42
- add_lint(node) if node.name =~ /[_A-Z]/
33
+ add_lint(node) if node_has_bad_name?(node)
43
34
  end
44
35
  end
45
36
  end
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::EmptyRuleLinter < Linter
2
+ class Linter::EmptyRule < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_rule(node)
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::HexLinter < Linter
2
+ class Linter::HexFormat < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_root(node)
@@ -0,0 +1,22 @@
1
+ module SCSSLint
2
+ class Linter::NoZeroBeforeDecimal < Linter
3
+ include LinterRegistry
4
+
5
+ def visit_prop(node)
6
+ # Misleading, but anything that isn't Sass Script is considered an
7
+ # `identifier` in the context of a Sass::Script::String.
8
+ return unless node.value.is_a?(Sass::Script::String) && node.value.type == :identifier
9
+
10
+ # Remove string chunks (e.g. `"hello" 3 'world'` -> `3`
11
+ non_string_values = node.value.value.gsub(/"[^"]*"|'[^']'/, '').split
12
+
13
+ non_string_values.each do |value|
14
+ add_lint(node) if value =~ /\b0\.\d+/
15
+ end
16
+ end
17
+
18
+ def description
19
+ 'Leading zero should be omitted in fractional values'
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ module SCSSLint
2
+ class Linter::PlaceholderInExtend < Linter
3
+ include LinterRegistry
4
+
5
+ def visit_extend(node)
6
+ # The array returned by the parser is a bit awkward in that it splits on
7
+ # every word boundary (so %placeholder becomes ['%', 'placeholder']).
8
+ selector = node.selector.join
9
+
10
+ add_lint(node) unless selector.start_with?('%')
11
+ end
12
+
13
+ def description
14
+ 'Always use placeholder selectors (e.g. %some-placeholder) with @extend'
15
+ end
16
+ end
17
+ end
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::PropertyFormatLinter < Linter
2
+ class Linter::PropertyFormat < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_prop(node)
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::ShorthandLinter < Linter
2
+ class Linter::Shorthand < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_prop(node)
@@ -1,5 +1,3 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
2
  class Linter::SingleLinePerSelector < Linter
5
3
  include LinterRegistry
@@ -0,0 +1,68 @@
1
+ module SCSSLint
2
+ class Linter::SortedProperties < Linter
3
+ include LinterRegistry
4
+
5
+ def visit_rule(node)
6
+ # Ignore properties that contain interpolation
7
+ sortable_props = node.children.select do |child|
8
+ child.is_a?(Sass::Tree::PropNode) &&
9
+ child.name.all? { |part| part.is_a?(String) }
10
+ end
11
+
12
+ sortable_prop_names = sortable_props.map { |child| child.name.join }
13
+
14
+ sorted_prop_names = sortable_prop_names.map do |name|
15
+ /^(?<vendor>-\w+-)?(?<property>.+)/ =~ name
16
+ { name: name, vendor: vendor, property: property }
17
+ end.sort { |a, b| compare_properties(a, b) }
18
+ .map { |fields| fields[:name] }
19
+
20
+ sorted_prop_names.each_with_index do |name, index|
21
+ # Report the first property out of order with the sorted list
22
+ if name != sortable_prop_names[index]
23
+ add_lint(sortable_props[index])
24
+ break
25
+ end
26
+ end
27
+
28
+ yield # Continue linting children
29
+ end
30
+
31
+ def description
32
+ 'Properties should be sorted in alphabetical order, with ' <<
33
+ 'vendor-prefixed extensions before the standardized CSS property'
34
+ end
35
+
36
+ private
37
+
38
+ # Compares two properties which can contain a vendor prefix. It allows for a
39
+ # sort order like:
40
+ #
41
+ # p {
42
+ # border: ...
43
+ # -moz-border-radius: ...
44
+ # -o-border-radius: ...
45
+ # -webkit-border-radius: ...
46
+ # border-radius: ...
47
+ # color: ...
48
+ # }
49
+ #
50
+ # ...where vendor-prefixed properties come before the standard property, and
51
+ # are ordered amongst themselves by vendor prefix.
52
+ def compare_properties(a, b)
53
+ if a[:property] == b[:property]
54
+ if a[:vendor] && b[:vendor]
55
+ a[:vendor] <=> b[:vendor]
56
+ elsif a[:vendor]
57
+ -1
58
+ elsif b[:vendor]
59
+ 1
60
+ else
61
+ 0
62
+ end
63
+ else
64
+ a[:property] <=> b[:property]
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,17 @@
1
+ module SCSSLint
2
+ class Linter::SpaceBeforeBrace < Linter
3
+ include LinterRegistry
4
+
5
+ def visit_root(node)
6
+ engine.lines.each_with_index do |line, index|
7
+ line.scan /(?<![^ ] )\{$/ do |match|
8
+ @lints << Lint.new(engine.filename, index + 1, description)
9
+ end
10
+ end
11
+ end
12
+
13
+ def description
14
+ 'Opening curly braces ({) must be preceded by one space'
15
+ end
16
+ end
17
+ end
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::TypeInIdSelectorLinter < Linter
2
+ class Linter::TypeInIdSelector < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_rule(node)
@@ -0,0 +1,40 @@
1
+ module SCSSLint
2
+ class Linter::UsageName < Linter
3
+ include LinterRegistry
4
+
5
+ def visit_extend(node)
6
+ add_lint(node) if selector_has_bad_placeholder?(node.selector)
7
+ end
8
+
9
+ def visit_mixin(node)
10
+ check(node)
11
+ yield # Continue into content block of this mixin's block
12
+ end
13
+
14
+ def visit_script_funcall(node)
15
+ check(node) unless FUNCTION_WHITELIST.include?(node.name)
16
+ end
17
+
18
+ def visit_script_variable(node)
19
+ check(node)
20
+ end
21
+
22
+ def description
23
+ 'Usages of variables, functions, mixins, and placeholders should be ' <<
24
+ 'lowercase and use hyphens instead of underscores.'
25
+ end
26
+
27
+ private
28
+
29
+ FUNCTION_WHITELIST = %w[
30
+ rotateX rotateY rotateZ
31
+ scaleX scaleY scaleZ
32
+ skewX skewY
33
+ translateX translateY translateZ
34
+ ].to_set
35
+
36
+ def check(node)
37
+ add_lint(node) if node_has_bad_name?(node)
38
+ end
39
+ end
40
+ end
@@ -1,7 +1,5 @@
1
- require 'sass'
2
-
3
1
  module SCSSLint
4
- class Linter::ZeroUnitLinter < Linter
2
+ class Linter::ZeroUnit < Linter
5
3
  include LinterRegistry
6
4
 
7
5
  def visit_prop(node)
@@ -14,10 +14,9 @@ module SCSSLint
14
14
  def extract_linters_from(linter_names)
15
15
  linter_names.map do |linter_name|
16
16
  begin
17
- linter_class = linter_name.split('_').map(&:capitalize).join('')
18
- Linter.const_get(linter_class)
17
+ Linter.const_get(linter_name)
19
18
  rescue NameError
20
- raise NoSuchLinter.new("Linter #{linter_class} does not exist")
19
+ raise NoSuchLinter.new("Linter #{linter_name} does not exist")
21
20
  end
22
21
  end
23
22
  end
@@ -1,6 +1,3 @@
1
- require 'scss_lint'
2
- require 'sass'
3
-
4
1
  module SCSSLint
5
2
  class NoFilesError < StandardError; end
6
3
  class NoLintersError < StandardError; end
@@ -11,14 +8,15 @@ module SCSSLint
11
8
  def initialize(options = {})
12
9
  @lints = []
13
10
 
14
- ignored_linters = LinterRegistry.
15
- extract_linters_from(options.fetch(:ignored_linters, []))
11
+ included_linters = LinterRegistry.
12
+ extract_linters_from(options.fetch(:included_linters, []))
16
13
 
17
- @linters = LinterRegistry.linters.reject do |linter|
18
- ignored_linters.include?(linter)
19
- end.map do |linter_class|
20
- linter_class.new
21
- end
14
+ included_linters = LinterRegistry.linters if included_linters.empty?
15
+
16
+ excluded_linters = LinterRegistry.
17
+ extract_linters_from(options.fetch(:excluded_linters, []))
18
+
19
+ @linters = (included_linters - excluded_linters).map(&:new)
22
20
  end
23
21
 
24
22
  def run(files = [])
@@ -0,0 +1,38 @@
1
+ module SCSSLint
2
+ module Utils
3
+ # Given a selector array which is a list of strings with Sass::Script::Nodes
4
+ # interspersed within them, return an array of strings representing those
5
+ # selectors with the Sass::Script::Nodes removed (i.e., ignoring
6
+ # interpolation). For example:
7
+ #
8
+ # .selector-one, .selector-#{$var}-two
9
+ #
10
+ # becomes:
11
+ #
12
+ # .selector-one, .selector--two
13
+ #
14
+ # This is useful for lints that wish to ignore interpolation, since
15
+ # interpolation can't be resolved at this step.
16
+ def extract_string_selectors(selector_array)
17
+ selector_array.reject { |item| item.is_a? Sass::Script::Node }.
18
+ join.
19
+ split
20
+ end
21
+
22
+ # Given a selector array, returns whether it contains any placeholder
23
+ # selectors with invalid names.
24
+ def selector_has_bad_placeholder?(selector_array)
25
+ extract_string_selectors(selector_array).any? do |selector_str|
26
+ selector_str =~ /%\w*#{INVALID_NAME_CHARS}/
27
+ end
28
+ end
29
+
30
+ def node_has_bad_name?(node)
31
+ node.name =~ /#{INVALID_NAME_CHARS}/
32
+ end
33
+
34
+ private
35
+
36
+ INVALID_NAME_CHARS = '[_A-Z]'
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module SCSSLint
2
- VERSION = '0.7.1'
2
+ VERSION = '0.9.0'
3
3
  end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scss-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
5
- prerelease:
4
+ version: 0.9.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Causes Engineering
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-04 00:00:00.000000000 Z
11
+ date: 2013-09-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: colorize
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: sass
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '='
44
39
  - !ruby/object:Gem::Version
@@ -46,33 +41,29 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: nokogiri
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Opinionated tool that tells you whether or not your SCSS is "bad"
@@ -85,54 +76,60 @@ extensions: []
85
76
  extra_rdoc_files: []
86
77
  files:
87
78
  - lib/scss_lint/version.rb
79
+ - lib/scss_lint/utils.rb
88
80
  - lib/scss_lint/reporter/xml_reporter.rb
89
81
  - lib/scss_lint/reporter/default_reporter.rb
90
82
  - lib/scss_lint/runner.rb
91
83
  - lib/scss_lint/reporter.rb
92
84
  - lib/scss_lint/lint.rb
93
85
  - lib/scss_lint/linter.rb
94
- - lib/scss_lint/linter/declaration_order_linter.rb
95
- - lib/scss_lint/linter/border_zero_linter.rb
96
- - lib/scss_lint/linter/comment_linter.rb
97
- - lib/scss_lint/linter/empty_rule_linter.rb
98
- - lib/scss_lint/linter/debug_linter.rb
99
- - lib/scss_lint/linter/single_line_per_selector_linter.rb
100
- - lib/scss_lint/linter/sorted_properties_linter.rb
101
- - lib/scss_lint/linter/shorthand_linter.rb
102
- - lib/scss_lint/linter/type_in_id_selector_linter.rb
103
- - lib/scss_lint/linter/property_format_linter.rb
104
- - lib/scss_lint/linter/zero_unit_linter.rb
105
- - lib/scss_lint/linter/declared_name_linter.rb
106
- - lib/scss_lint/linter/hex_linter.rb
86
+ - lib/scss_lint/linter/property_format.rb
87
+ - lib/scss_lint/linter/space_before_brace.rb
88
+ - lib/scss_lint/linter/capitalization_in_selector.rb
89
+ - lib/scss_lint/linter/declared_name.rb
90
+ - lib/scss_lint/linter/sorted_properties.rb
91
+ - lib/scss_lint/linter/type_in_id_selector.rb
92
+ - lib/scss_lint/linter/shorthand.rb
93
+ - lib/scss_lint/linter/declaration_order.rb
94
+ - lib/scss_lint/linter/no_zero_before_decimal.rb
95
+ - lib/scss_lint/linter/zero_unit.rb
96
+ - lib/scss_lint/linter/placeholder_in_extend.rb
97
+ - lib/scss_lint/linter/usage_name.rb
98
+ - lib/scss_lint/linter/border_zero.rb
99
+ - lib/scss_lint/linter/debug_statement.rb
100
+ - lib/scss_lint/linter/hex_format.rb
101
+ - lib/scss_lint/linter/comment.rb
102
+ - lib/scss_lint/linter/empty_rule.rb
103
+ - lib/scss_lint/linter/single_line_per_selector.rb
107
104
  - lib/scss_lint/cli.rb
108
105
  - lib/scss_lint/engine.rb
109
106
  - lib/scss_lint/linter_registry.rb
110
107
  - lib/sass/tree.rb
108
+ - lib/sass/script.rb
111
109
  - lib/scss_lint.rb
112
110
  - bin/scss-lint
113
111
  homepage: http://github.com/causes/scss-lint
114
112
  licenses:
115
113
  - MIT
114
+ metadata: {}
116
115
  post_install_message:
117
116
  rdoc_options: []
118
117
  require_paths:
119
118
  - lib
120
119
  required_ruby_version: !ruby/object:Gem::Requirement
121
- none: false
122
120
  requirements:
123
- - - ! '>='
121
+ - - '>='
124
122
  - !ruby/object:Gem::Version
125
- version: '0'
123
+ version: 1.9.3
126
124
  required_rubygems_version: !ruby/object:Gem::Requirement
127
- none: false
128
125
  requirements:
129
- - - ! '>='
126
+ - - '>='
130
127
  - !ruby/object:Gem::Version
131
128
  version: '0'
132
129
  requirements: []
133
130
  rubyforge_project:
134
- rubygems_version: 1.8.23
131
+ rubygems_version: 2.0.2
135
132
  signing_key:
136
- specification_version: 3
133
+ specification_version: 4
137
134
  summary: SCSS lint tool
138
135
  test_files: []
@@ -1,27 +0,0 @@
1
- require 'sass'
2
-
3
- module SCSSLint
4
- class Linter::SortedPropertiesLinter < Linter
5
- include LinterRegistry
6
-
7
- def visit_rule(node)
8
- properties = node.children.select do |child|
9
- child.is_a?(Sass::Tree::PropNode)
10
- end
11
-
12
- prop_names = properties.map do |prop_node|
13
- prop_node.name.first.to_s
14
- end
15
-
16
- if prop_names.sort != prop_names
17
- add_lint(properties.first)
18
- end
19
-
20
- yield # Continue linting children
21
- end
22
-
23
- def description
24
- 'Properties should be sorted in alphabetical order'
25
- end
26
- end
27
- end