Class: Hashira::CLI::Options

Inherits:
Data
  • Object
show all
Defined in:
lib/hashira/cli/options.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#baselineObject (readonly)

Returns the value of attribute baseline

Returns:

  • (Object)

    the current value of baseline



4
5
6
# File 'lib/hashira/cli/options.rb', line 4

def baseline
  @baseline
end

#compactObject (readonly)

Returns the value of attribute compact

Returns:

  • (Object)

    the current value of compact



4
5
6
# File 'lib/hashira/cli/options.rb', line 4

def compact
  @compact
end

#directoriesObject (readonly)

Returns the value of attribute directories

Returns:

  • (Object)

    the current value of directories



4
5
6
# File 'lib/hashira/cli/options.rb', line 4

def directories
  @directories
end

#fail_onObject (readonly)

Returns the value of attribute fail_on

Returns:

  • (Object)

    the current value of fail_on



4
5
6
# File 'lib/hashira/cli/options.rb', line 4

def fail_on
  @fail_on
end

#modeObject (readonly)

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



4
5
6
# File 'lib/hashira/cli/options.rb', line 4

def mode
  @mode
end

#onlyObject (readonly)

Returns the value of attribute only

Returns:

  • (Object)

    the current value of only



4
5
6
# File 'lib/hashira/cli/options.rb', line 4

def only
  @only
end

#packagingObject (readonly)

Returns the value of attribute packaging

Returns:

  • (Object)

    the current value of packaging



4
5
6
# File 'lib/hashira/cli/options.rb', line 4

def packaging
  @packaging
end

#skipObject (readonly)

Returns the value of attribute skip

Returns:

  • (Object)

    the current value of skip



4
5
6
# File 'lib/hashira/cli/options.rb', line 4

def skip
  @skip
end

#topObject (readonly)

Returns the value of attribute top

Returns:

  • (Object)

    the current value of top



4
5
6
# File 'lib/hashira/cli/options.rb', line 4

def top
  @top
end

Class Method Details

.build(mode) ⇒ Object



8
9
10
11
12
13
# File 'lib/hashira/cli/options.rb', line 8

def self.build(mode)
  new(
    directories: [], baseline: "", fail_on: [], skip: [], only: [],
    packaging: :auto, top: nil, compact: nil, mode:
  )
end

.parse(argv) ⇒ Object



6
# File 'lib/hashira/cli/options.rb', line 6

def self.parse(argv) = CommandLine.new(argv).options

Instance Method Details

#analyzersObject



23
# File 'lib/hashira/cli/options.rb', line 23

def analyzers = Hashira::Pipeline::ANALYZERS - skip

#pipelineObject



15
16
17
18
19
20
21
# File 'lib/hashira/cli/options.rb', line 15

def pipeline
  chosen = Hashira::Project.new(directories)
  told = Hashira::Report::Notices.new
  told.scanning(chosen.files.size)
  told.rails if directories.empty? && File.exist?("config/application.rb")
  Hashira::Pipeline.new(chosen, enabled: analyzers, packaging:, only:)
end