Class: Rubocop::Cop::Cop
- Inherits:
-
Object
- Object
- Rubocop::Cop::Cop
- Defined in:
- lib/rubocop/cop/cop.rb
Direct Known Subclasses
Alias, AlignParameters, AmpersandsPipesVsAndOr, AvoidClassVars, AvoidFor, AvoidPerlBackrefs, AvoidPerlisms, ClassAndModuleCamelCase, CollectionMethods, DefWithParentheses, DefWithoutParentheses, EmptyLines, Encoding, EndOfLine, FavorSprintf, FavorUnlessOverNegatedIf, FavorUntilOverNegatedWhile, HashSyntax, IfUnlessModifier, IfWithSemicolon, Indentation, LineLength, MethodAndVariableSnakeCase, MultilineBlocks, MultilineIfThen, MultilineTernaryOperator, NestedTernaryOperator, NewLambdaLiteral, NumericLiterals, OneLineConditional, ParameterLists, ParenthesesAroundCondition, Semicolon, SingleLineBlocks, SpaceAfterColon, SpaceAfterComma, SpaceAfterSemicolon, SpaceAroundBraces, SpaceAroundEqualsInParameterDefault, SpaceAroundOperators, SpaceInsideBrackets, SpaceInsideParens, StringLiterals, SymbolSnakeCase, Syntax, Tab, TrailingWhitespace, UnlessElse, VariableInterpolation, WhenThen, WhileUntilModifier
Class Attribute Summary collapse
-
.all ⇒ Object
Returns the value of attribute all.
-
.config ⇒ Object
Returns the value of attribute config.
Instance Attribute Summary collapse
-
#correlations ⇒ Object
writeonly
Sets the attribute correlations.
-
#offences ⇒ Object
Returns the value of attribute offences.
Class Method Summary collapse
Instance Method Summary collapse
- #add_offence(severity, line_number, message) ⇒ Object
- #has_report? ⇒ Boolean
-
#initialize ⇒ Cop
constructor
A new instance of Cop.
Constructor Details
#initialize ⇒ Cop
Returns a new instance of Cop.
49 50 51 |
# File 'lib/rubocop/cop/cop.rb', line 49 def initialize @offences = [] end |
Class Attribute Details
.all ⇒ Object
Returns the value of attribute all.
41 42 43 |
# File 'lib/rubocop/cop/cop.rb', line 41 def all @all end |
.config ⇒ Object
Returns the value of attribute config.
42 43 44 |
# File 'lib/rubocop/cop/cop.rb', line 42 def config @config end |
Instance Attribute Details
#correlations=(value) ⇒ Object (writeonly)
Sets the attribute correlations
35 36 37 |
# File 'lib/rubocop/cop/cop.rb', line 35 def correlations=(value) @correlations = value end |
#offences ⇒ Object
Returns the value of attribute offences.
34 35 36 |
# File 'lib/rubocop/cop/cop.rb', line 34 def offences @offences end |
Class Method Details
.inherited(subclass) ⇒ Object
45 46 47 |
# File 'lib/rubocop/cop/cop.rb', line 45 def self.inherited(subclass) all << subclass end |
Instance Method Details
#add_offence(severity, line_number, message) ⇒ Object
57 58 59 |
# File 'lib/rubocop/cop/cop.rb', line 57 def add_offence(severity, line_number, ) @offences << Offence.new(severity, line_number, ) end |
#has_report? ⇒ Boolean
53 54 55 |
# File 'lib/rubocop/cop/cop.rb', line 53 def has_report? !@offences.empty? end |