Class: Guideline::OptionParser

Inherits:
OptionParser
  • Object
show all
Defined in:
lib/guideline/option_parser.rb

Defined Under Namespace

Classes: Argument

Constant Summary collapse

OPTIONS =
[
  "--no-abc-complexity",      "(default: true) check method ABC complexity",
  "--no-hard-tab-indent",     "(default: true) check hard tab indent",
  "--no-hash-comma",          "(default: true) check last comma in Hash literal",
  "--no-long-line",           "(default: true) check line length",
  "--no-long-method",         "(default: true) check method height",
  "--no-trailing-whitespace", "(default: true) check trailing whitespace",
  "--no-unused-method",       "(default: true) check unused method",
  "--abc-complexity=",        "(default:   15) threshold of ABC complexity",
  "--long-line=",             "(default:   80) threshold of long line",
  "--long-method=",           "(default:   10) threshold of long method",
  "--path=",                  "(default:   ./) checked file or dir or glob pattern",
]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptionParser

Returns a new instance of OptionParser.



23
24
25
26
# File 'lib/guideline/option_parser.rb', line 23

def initialize(*)
  super
  configure_checker_options
end

Class Method Details

.parse(argv = ARGV) ⇒ Object



19
20
21
# File 'lib/guideline/option_parser.rb', line 19

def self.parse(argv = ARGV)
  new.parse(argv)
end

Instance Method Details

#optionsObject



33
34
35
# File 'lib/guideline/option_parser.rb', line 33

def options
  @options ||= {}
end

#parseObject



28
29
30
31
# File 'lib/guideline/option_parser.rb', line 28

def parse(*)
  super
  options
end