Class: Checkstyle::FileReviewer

Inherits:
Object
  • Object
show all
Defined in:
lib/checkstyle/file_reviewer.rb

Constant Summary collapse

HEADERS =
{ 'Authorization' => "token #{ENV['GITHUB_TOKEN']}" }
RUBOCOP_QUOTES =
[
  "> - Robo, excuse me, Robo. Any special message for all the kids watching at home?\n> - Stay out of trouble.",
  '> Four... three... two... one... I am now authorized to use physical force!',
  '> Thank you for your co-operation. Good night.',
  '> Serve the public trust. Protect the innocent. Uphold the law.',
  '> Your move, creep.',
  '> Come quietly or there will be trouble.',
  '> You are under arrest.',
  "> Dead or alive, you're coming with me!",
  '> Oooh, guns guns guns!',
  '> Excuse me, I have to go. Somewhere there is a crime happening.'
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository, file_path, violations) ⇒ FileReviewer

Returns a new instance of FileReviewer.



23
24
25
26
27
# File 'lib/checkstyle/file_reviewer.rb', line 23

def initialize(repository, file_path, violations)
  @file_path = file_path
  @violations = violations
  @repository = repository
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



21
22
23
# File 'lib/checkstyle/file_reviewer.rb', line 21

def file_path
  @file_path
end

#repositoryObject (readonly)

Returns the value of attribute repository.



21
22
23
# File 'lib/checkstyle/file_reviewer.rb', line 21

def repository
  @repository
end

#violationsObject (readonly)

Returns the value of attribute violations.



21
22
23
# File 'lib/checkstyle/file_reviewer.rb', line 21

def violations
  @violations
end

Instance Method Details

#reviewObject



29
30
31
32
33
# File 'lib/checkstyle/file_reviewer.rb', line 29

def review
  log "Reviewing file #{file_path}"

  violations.each { |violation| comment_violation(violation) }
end