Class: RuboCop::Cop::Kata::RealWords
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Kata::RealWords
- Defined in:
- lib/rubocop/cop/kata/real_words.rb
Constant Summary collapse
- MSG =
"%s is not in the dictionary — restore the underscore between smashed words, spell the " \ "abbreviation out, or add it to `Terms` if it is one domain term here."
- ABBREVIATION_MSG =
"%s is an abbreviation; spell the word out."- WORDS =
File.("../../../../data/words.txt.gz", __dir__)
- SOFTWARE =
File.("../../../../data/software.txt.gz", __dir__)
- EXTRA =
File.("../../../../data/supplement.txt", __dir__)
- DICTIONARY =
Set.new( [WORDS, SOFTWARE].flat_map { Zlib.gunzip(File.binread(it)).split("\n") } + File.readlines(EXTRA, chomp: true) ).freeze
- SIGIL =
/\A(@@|@|\$)/- DERIVATIONS =
[ [/s\z/, ""], [/es\z/, ""], [/ies\z/, "y"], [/able\z/, ""], [/able\z/, "e"], [/([b-df-hj-np-tv-z])\1able\z/, '\1'], [/er\z/, ""], [/[eo]r\z/, "e"], [/ier\z/, "y"], [/([b-df-hj-np-tv-z])\1er\z/, '\1'], [/or\z/, ""], [/less\z/, ""] ].freeze
Instance Method Summary collapse
- #on_arg(node) ⇒ Object
- #on_cvasgn(node) ⇒ Object
- #on_def(node) ⇒ Object
- #on_defs(node) ⇒ Object
- #on_gvasgn(node) ⇒ Object
- #on_ivasgn(node) ⇒ Object
- #on_kwarg(node) ⇒ Object
- #on_kwoptarg(node) ⇒ Object
- #on_lvasgn(node) ⇒ Object
- #on_optarg(node) ⇒ Object
Instance Method Details
#on_arg(node) ⇒ Object
36 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 36 def on_arg(node) = check(node, node.name) |
#on_cvasgn(node) ⇒ Object
32 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 32 def on_cvasgn(node) = check(node, node.name) |
#on_def(node) ⇒ Object
24 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 24 def on_def(node) = check(node, node.method_name) |
#on_defs(node) ⇒ Object
26 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 26 def on_defs(node) = check(node, node.method_name) |
#on_gvasgn(node) ⇒ Object
34 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 34 def on_gvasgn(node) = check(node, node.name) |
#on_ivasgn(node) ⇒ Object
30 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 30 def on_ivasgn(node) = check(node, node.name) |
#on_kwarg(node) ⇒ Object
40 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 40 def on_kwarg(node) = check(node, node.name) |
#on_kwoptarg(node) ⇒ Object
42 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 42 def on_kwoptarg(node) = check(node, node.name) |
#on_lvasgn(node) ⇒ Object
28 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 28 def on_lvasgn(node) = check(node, node.name) |
#on_optarg(node) ⇒ Object
38 |
# File 'lib/rubocop/cop/kata/real_words.rb', line 38 def on_optarg(node) = check(node, node.name) |