Class: Reek::Report::GithubReport::WorkflowCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/reek/report/github_report.rb

Overview

Represents a smell as a GitHub Workflow command.

Instance Method Summary collapse

Constructor Details

#initialize(smell) ⇒ WorkflowCommand

Returns a new instance of WorkflowCommand.



27
28
29
# File 'lib/reek/report/github_report.rb', line 27

def initialize(smell)
  @smell = smell
end

Instance Method Details

#fileObject (private)



41
42
43
# File 'lib/reek/report/github_report.rb', line 41

def file
  @smell.source
end

#lineObject (private)



45
46
47
# File 'lib/reek/report/github_report.rb', line 45

def line
  @smell.lines.first
end

#messageObject (private)



49
50
51
# File 'lib/reek/report/github_report.rb', line 49

def message
  @smell.base_message.gsub('%', '%25').gsub("\r", '%0D').gsub("\n", '%0A')
end

#to_sObject



31
32
33
34
35
36
37
# File 'lib/reek/report/github_report.rb', line 31

def to_s
  format(
    "::warning file=%<file>s,line=%<line>d::%<message>s\n",
    file: file,
    line: line,
    message: message)
end