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: false) check method ABC complexity",
  "--no-hard-tab-indent",     "(default: false) check hard tab indent",
  "--no-hash-comma",          "(default: false) check last comma in Hash literal",
  "--no-long-line",           "(default: false) check line length",
  "--no-long-method",         "(default: false) check method height",
  "--no-trailing-whitespace", "(default: false) check trailing whitespace",
  "--no-unused-method",       "(default: false) check unused method",
  "--no-detail",              "(default: false) only render summary",
  "--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.



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

def initialize(*)
  super
  configure_checker_options
end

Class Method Details

.parse(argv = ARGV) ⇒ Object



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

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

Instance Method Details

#optionsObject



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

def options
  @options ||= {}
end

#parseObject



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

def parse(*)
  super
  options
end