Class: SCSSLint::Linter
- Inherits:
-
Sass::Tree::Visitors::Base
- Object
- Sass::Tree::Visitors::Base
- SCSSLint::Linter
- Includes:
- SelectorVisitor, Utils
- Defined in:
- lib/scss_lint/linter.rb
Overview
Defines common functionality available to all linters.
Direct Known Subclasses
BangFormat, BorderZero, ColorKeyword, ColorVariable, Comment, Compass, DebugStatement, DeclarationOrder, DuplicateProperty, ElsePlacement, EmptyLineBetweenBlocks, EmptyRule, FinalNewline, HexLength, HexNotation, HexValidation, IdSelector, ImportPath, ImportantRule, Indentation, LeadingZero, MergeableSelector, NameFormat, NestingDepth, PlaceholderInExtend, PropertyCount, PropertySortOrder, PropertySpelling, PropertyUnits, QualifyingElement, SelectorDepth, SelectorFormat, Shorthand, SingleLinePerProperty, SingleLinePerSelector, SpaceAfterComma, SpaceAfterPropertyColon, SpaceAfterPropertyName, SpaceBeforeBrace, SpaceBetweenParens, StringQuotes, TrailingSemicolon, TrailingZero, UnnecessaryMantissa, UnnecessaryParentReference, UrlFormat, UrlQuotes, VariableForProperty, VendorPrefix, ZeroUnit
Defined Under Namespace
Classes: BangFormat, BorderZero, ColorKeyword, ColorVariable, Comment, Compass, DebugStatement, DeclarationOrder, DuplicateProperty, ElsePlacement, EmptyLineBetweenBlocks, EmptyRule, FinalNewline, HexLength, HexNotation, HexValidation, IdSelector, ImportPath, ImportantRule, Indentation, LeadingZero, MergeableSelector, NameFormat, NestingDepth, PlaceholderInExtend, PropertyCount, PropertySortOrder, PropertySpelling, PropertyUnits, QualifyingElement, SelectorDepth, SelectorFormat, Shorthand, SingleLinePerProperty, SingleLinePerSelector, SpaceAfterComma, SpaceAfterPropertyColon, SpaceAfterPropertyName, SpaceBeforeBrace, SpaceBetweenParens, StringQuotes, TrailingSemicolon, TrailingZero, UnnecessaryMantissa, UnnecessaryParentReference, UrlFormat, UrlQuotes, VariableForProperty, VendorPrefix, ZeroUnit
Constant Summary
Constants included from Utils
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
-
#lints ⇒ Object
readonly
Returns the value of attribute lints.
Instance Method Summary collapse
-
#initialize ⇒ Linter
constructor
Create a linter.
-
#name ⇒ Object
Return the human-friendly name of this linter as specified in the configuration file and in lint descriptions.
-
#run(engine, config) ⇒ Array<Lint>
Run this linter against a parsed document with the given configuration, returning the lints that were found.
Methods included from Utils
#color?, #color_hex?, #color_keyword?, #color_keyword_to_code, #extract_string_selectors, #node_ancestor, #node_siblings, #pluralize, #previous_node, #remove_quoted_strings, #same_position?
Methods included from SelectorVisitor
Constructor Details
#initialize ⇒ Linter
Create a linter.
10 11 12 |
# File 'lib/scss_lint/linter.rb', line 10 def initialize @lints = [] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/scss_lint/linter.rb', line 7 def config @config end |
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
7 8 9 |
# File 'lib/scss_lint/linter.rb', line 7 def engine @engine end |
#lints ⇒ Object (readonly)
Returns the value of attribute lints.
7 8 9 |
# File 'lib/scss_lint/linter.rb', line 7 def lints @lints end |
Instance Method Details
#name ⇒ Object
Return the human-friendly name of this linter as specified in the configuration file and in lint descriptions.
31 32 33 |
# File 'lib/scss_lint/linter.rb', line 31 def name self.class.name.split('::')[2..-1].join('::') end |
#run(engine, config) ⇒ Array<Lint>
Run this linter against a parsed document with the given configuration, returning the lints that were found.
20 21 22 23 24 25 26 27 |
# File 'lib/scss_lint/linter.rb', line 20 def run(engine, config) @lints = [] @config = config @engine = engine @comment_processor = ControlCommentProcessor.new(self) visit(engine.tree) @lints = @comment_processor.filter_lints(@lints) end |