Class: Dash::Dockerfile::Finding

Inherits:
Struct
  • Object
show all
Defined in:
lib/dash/dockerfile/finding.rb

Overview

One piece of advice about the Dockerfile or the build context.

rule is a stable public string an operator can put in report: ignore:, so renaming one is a breaking change to their deploy.yml. location is whatever they should open: a Dockerfile line, .dockerignore, build context, or a deploy.yml key.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#location ⇒ Object

Returns the value of attribute location

Returns:

  • (Object) —

    the current value of location



6
7
8
# File 'lib/dash/dockerfile/finding.rb', line 6

def location
  @location
end

#message ⇒ Object

Returns the value of attribute message

Returns:

  • (Object) —

    the current value of message



6
7
8
# File 'lib/dash/dockerfile/finding.rb', line 6

def message
  @message
end

#rule ⇒ Object

Returns the value of attribute rule

Returns:

  • (Object) —

    the current value of rule



6
7
8
# File 'lib/dash/dockerfile/finding.rb', line 6

def rule
  @rule
end

#severity ⇒ Object

Returns the value of attribute severity

Returns:

  • (Object) —

    the current value of severity



6
7
8
# File 'lib/dash/dockerfile/finding.rb', line 6

def severity
  @severity
end

#suggestion ⇒ Object

Returns the value of attribute suggestion

Returns:

  • (Object) —

    the current value of suggestion



6
7
8
# File 'lib/dash/dockerfile/finding.rb', line 6

def suggestion
  @suggestion
end

Class Method Details

.from_h(hash) ⇒ Object



11
12
13
14
15
# File 'lib/dash/dockerfile/finding.rb', line 11

def self.from_h(hash)
  hash = hash.transform_keys(&:to_sym)

  new(**hash.slice(:rule, :location, :message, :suggestion), severity: hash[:severity].to_sym)
end

Instance Method Details

#to_h ⇒ Object



17
18
19
# File 'lib/dash/dockerfile/finding.rb', line 17

def to_h
  { rule: rule, severity: severity.to_s, location: location, message: message, suggestion: suggestion }
end

#warn? ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/dash/dockerfile/finding.rb', line 7

def warn?
  severity == :warn
end