Class: Dash::Dockerfile::Rules::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dash/dockerfile/rules/base.rb

Overview

A rule looks at the analysis context and returns findings. Nothing else: no IO, no state, no ordering assumptions about the other rules.

The id is derived from the class name and is a public string — operators put it in report: ignore:, so renaming a rule class renames a config value.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Base

Returns a new instance of Base.



19
20
21
# File 'lib/dash/dockerfile/rules/base.rb', line 19

def initialize(context)
  @context = context
end

Instance Attribute Details

#context ⇒ Object (readonly)

Returns the value of attribute context.



10
11
12
# File 'lib/dash/dockerfile/rules/base.rb', line 10

def context
  @context
end

Class Method Details

.id ⇒ Object



14
15
16
# File 'lib/dash/dockerfile/rules/base.rb', line 14

def id
  @id ||= name.demodulize.underscore.dasherize
end

Instance Method Details

#findings ⇒ Object



23
24
25
# File 'lib/dash/dockerfile/rules/base.rb', line 23

def findings
  []
end