Class: Sloplint::Rule

Inherits:
Data
  • Object
show all
Defined in:
lib/sloplint/rules.rb

Overview

A rule is data, not code. See docs/SPEC.md "Rule model".

count_group: a Regexp scanned over the matched text to tally items; when set, the Note carries count and the message may interpolate %count. skip: Regexps that, if they match the matched text, drop the note (exclusions). default_on: false keeps a noisy rule out of the default run (still selectable).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(count_group: nil, skip: [], rationale: nil, default_on: true, **rest) ⇒ Rule

Returns a new instance of Rule.



14
15
16
# File 'lib/sloplint/rules.rb', line 14

def initialize(count_group: nil, skip: [], rationale: nil, default_on: true, **rest)
  super
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def category
  @category
end

#count_groupObject (readonly)

Returns the value of attribute count_group

Returns:

  • (Object)

    the current value of count_group



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def count_group
  @count_group
end

#default_onObject (readonly)

Returns the value of attribute default_on

Returns:

  • (Object)

    the current value of default_on



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def default_on
  @default_on
end

#examples_badObject (readonly)

Returns the value of attribute examples_bad

Returns:

  • (Object)

    the current value of examples_bad



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def examples_bad
  @examples_bad
end

#examples_okObject (readonly)

Returns the value of attribute examples_ok

Returns:

  • (Object)

    the current value of examples_ok



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def examples_ok
  @examples_ok
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def id
  @id
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def message
  @message
end

#patternObject (readonly)

Returns the value of attribute pattern

Returns:

  • (Object)

    the current value of pattern



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def pattern
  @pattern
end

#rationaleObject (readonly)

Returns the value of attribute rationale

Returns:

  • (Object)

    the current value of rationale



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def rationale
  @rationale
end

#severityObject (readonly)

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def severity
  @severity
end

#skipObject (readonly)

Returns the value of attribute skip

Returns:

  • (Object)

    the current value of skip



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def skip
  @skip
end

#suggestionObject (readonly)

Returns the value of attribute suggestion

Returns:

  • (Object)

    the current value of suggestion



10
11
12
# File 'lib/sloplint/rules.rb', line 10

def suggestion
  @suggestion
end