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, Comment, Compass, DebugStatement, DeclarationOrder, DuplicateProperty, ElsePlacement, EmptyLineBetweenBlocks, EmptyRule, FinalNewline, HexLength, HexNotation, HexValidation, IdSelector, ImportPath, Indentation, LeadingZero, MergeableSelector, NameFormat, NestingDepth, PlaceholderInExtend, PropertySortOrder, PropertySpelling, QualifyingElement, SelectorDepth, SelectorFormat, Shorthand, SingleLinePerProperty, SingleLinePerSelector, SpaceAfterComma, SpaceAfterPropertyColon, SpaceAfterPropertyName, SpaceBeforeBrace, SpaceBetweenParens, StringQuotes, TrailingSemicolon, TrailingZero, UnnecessaryMantissa, UnnecessaryParentReference, UrlFormat, UrlQuotes, VendorPrefixes, ZeroUnit
Defined Under Namespace
Classes: BangFormat, BorderZero, ColorKeyword, Comment, Compass, DebugStatement, DeclarationOrder, DuplicateProperty, ElsePlacement, EmptyLineBetweenBlocks, EmptyRule, FinalNewline, HexLength, HexNotation, HexValidation, IdSelector, ImportPath, Indentation, LeadingZero, MergeableSelector, NameFormat, NestingDepth, PlaceholderInExtend, PropertySortOrder, PropertySpelling, QualifyingElement, SelectorDepth, SelectorFormat, Shorthand, SingleLinePerProperty, SingleLinePerSelector, SpaceAfterComma, SpaceAfterPropertyColon, SpaceAfterPropertyName, SpaceBeforeBrace, SpaceBetweenParens, StringQuotes, TrailingSemicolon, TrailingZero, UnnecessaryMantissa, UnnecessaryParentReference, UrlFormat, UrlQuotes, VendorPrefixes, ZeroUnit
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
A new instance of Linter.
-
#name ⇒ Object
Return the human-friendly name of this linter as specified in the configuration file and in lint descriptions.
-
#run(engine, config) ⇒ Object
Run this linter against a parsed document with a given configuration.
Methods included from Utils
#extract_string_selectors, #node_siblings, #pluralize, #previous_node, #remove_quoted_strings, #same_position?
Methods included from SelectorVisitor
Constructor Details
#initialize ⇒ Linter
Returns a new instance of Linter.
9 10 11 |
# File 'lib/scss_lint/linter.rb', line 9 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.
27 28 29 |
# File 'lib/scss_lint/linter.rb', line 27 def name self.class.name.split('::')[2..-1].join('::') end |
#run(engine, config) ⇒ Object
Run this linter against a parsed document with a given configuration.
17 18 19 20 21 22 23 |
# File 'lib/scss_lint/linter.rb', line 17 def run(engine, config) @config = config @engine = engine @comment_processor = ControlCommentProcessor.new(self) visit(engine.tree) @lints = @comment_processor.filter_lints(@lints) end |