Class: RuboCop::Cop::Kata::RealWords

Inherits:
Base
  • Object
show all
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.expand_path("../../../../data/words.txt.gz", __dir__)
EXTRA =
File.expand_path("../../../../data/supplement.txt", __dir__)
DICTIONARY =
Set.new(
  Zlib.gunzip(File.binread(WORDS)).split("\n") + File.readlines(EXTRA, chomp: true)
).freeze
SIGIL =
/\A(@@|@|\$)/

Instance Method Summary collapse

Instance Method Details

#on_arg(node) ⇒ Object



28
# File 'lib/rubocop/cop/kata/real_words.rb', line 28

def on_arg(node) = check(node, node.name)

#on_cvasgn(node) ⇒ Object



24
# File 'lib/rubocop/cop/kata/real_words.rb', line 24

def on_cvasgn(node) = check(node, node.name)

#on_def(node) ⇒ Object



16
# File 'lib/rubocop/cop/kata/real_words.rb', line 16

def on_def(node) = check(node, node.method_name)

#on_defs(node) ⇒ Object



18
# File 'lib/rubocop/cop/kata/real_words.rb', line 18

def on_defs(node) = check(node, node.method_name)

#on_gvasgn(node) ⇒ Object



26
# File 'lib/rubocop/cop/kata/real_words.rb', line 26

def on_gvasgn(node) = check(node, node.name)

#on_ivasgn(node) ⇒ Object



22
# File 'lib/rubocop/cop/kata/real_words.rb', line 22

def on_ivasgn(node) = check(node, node.name)

#on_kwarg(node) ⇒ Object



32
# File 'lib/rubocop/cop/kata/real_words.rb', line 32

def on_kwarg(node) = check(node, node.name)

#on_kwoptarg(node) ⇒ Object



34
# File 'lib/rubocop/cop/kata/real_words.rb', line 34

def on_kwoptarg(node) = check(node, node.name)

#on_lvasgn(node) ⇒ Object



20
# File 'lib/rubocop/cop/kata/real_words.rb', line 20

def on_lvasgn(node) = check(node, node.name)

#on_optarg(node) ⇒ Object



30
# File 'lib/rubocop/cop/kata/real_words.rb', line 30

def on_optarg(node) = check(node, node.name)