Class: Hanamismith::Builders::Reek

Inherits:
Rubysmith::Builders::Reek
  • Object
show all
Defined in:
lib/hanamismith/builders/reek.rb

Overview

Builds project skeleton Reek code quality support.

Instance Method Summary collapse

Instance Method Details

#add_duplicate_exclusionObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/hanamismith/builders/reek.rb', line 20

def add_duplicate_exclusion
  with_template.insert_before(
    /LongParameterList:\n/,
    <<~DETECTORS.gsub(/^/, "  ")
      DuplicateMethodCall:
        exclude:
          - UniversalLoggerPatch#_log_structured
    DETECTORS
  )
end

#add_too_many_statements_exclusionObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/hanamismith/builders/reek.rb', line 31

def add_too_many_statements_exclusion
  with_template.insert_after(
    /enabled:\sfalse\n/,
    <<~DETECTORS.gsub(/^/, "  ")
      TooManyStatements:
        exclude:
          - UniversalLoggerPatch#_log_structured
    DETECTORS
  )
end

#callObject



11
12
13
14
15
16
17
18
# File 'lib/hanamismith/builders/reek.rb', line 11

def call
  return false unless settings.build_reek

  super
  add_duplicate_exclusion
  add_too_many_statements_exclusion
  true
end

#with_templateObject



42
43
44
# File 'lib/hanamismith/builders/reek.rb', line 42

def with_template
  builder.call settings.with(template_path: "%project_name%/.reek.yml.erb")
end