Class: Homebrew::Style::Offense Private

Inherits:
Object
  • Object
show all
Defined in:
style.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

A style offense.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Offense

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns a new instance of Offense.



311
312
313
314
315
316
317
318
# File 'style.rb', line 311

def initialize(json)
  @severity = json["severity"]
  @message = json["message"]
  @cop_name = json["cop_name"]
  @corrected = json["corrected"]
  location = json["location"]
  @location = SourceLocation.new(location.fetch("line"), location["column"])
end

Instance Attribute Details

#cop_nameObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



309
310
311
# File 'style.rb', line 309

def cop_name
  @cop_name
end

#correctedObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



309
310
311
# File 'style.rb', line 309

def corrected
  @corrected
end

#locationObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



309
310
311
# File 'style.rb', line 309

def location
  @location
end

#messageObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



309
310
311
# File 'style.rb', line 309

def message
  @message
end

#severityObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



309
310
311
# File 'style.rb', line 309

def severity
  @severity
end

Instance Method Details

#corrected?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


324
325
326
# File 'style.rb', line 324

def corrected?
  @corrected
end

#severity_codeObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



320
321
322
# File 'style.rb', line 320

def severity_code
  @severity[0].upcase
end