2018-06-10 21:15:12 +00:00
|
|
|
module Ameba
|
|
|
|
# Represents an issue reported by Ameba.
|
2021-01-26 06:38:19 +00:00
|
|
|
struct Issue
|
|
|
|
enum Status
|
|
|
|
Enabled
|
|
|
|
Disabled
|
|
|
|
end
|
|
|
|
|
2018-06-10 21:15:12 +00:00
|
|
|
# A rule that triggers this issue.
|
2021-01-26 06:38:19 +00:00
|
|
|
getter rule : Rule::Base
|
2018-06-10 21:15:12 +00:00
|
|
|
|
|
|
|
# Location of the issue.
|
2021-01-26 06:38:19 +00:00
|
|
|
getter location : Crystal::Location?
|
2018-06-10 21:15:12 +00:00
|
|
|
|
|
|
|
# End location of the issue.
|
2021-01-26 06:38:19 +00:00
|
|
|
getter end_location : Crystal::Location?
|
2018-06-10 21:15:12 +00:00
|
|
|
|
|
|
|
# Issue message.
|
2021-01-26 06:38:19 +00:00
|
|
|
getter message : String
|
2018-06-10 21:15:12 +00:00
|
|
|
|
|
|
|
# Issue status.
|
2021-01-26 06:38:19 +00:00
|
|
|
getter status : Status
|
|
|
|
|
|
|
|
delegate :enabled?, :disabled?,
|
|
|
|
to: status
|
|
|
|
|
|
|
|
def initialize(@rule, @location, @end_location, @message, status : Status? = nil)
|
|
|
|
@status = status || Status::Enabled
|
2018-06-10 21:15:12 +00:00
|
|
|
end
|
2019-10-27 15:39:59 +00:00
|
|
|
|
|
|
|
def syntax?
|
|
|
|
rule.is_a?(Rule::Lint::Syntax)
|
|
|
|
end
|
2018-06-10 21:15:12 +00:00
|
|
|
end
|
|
|
|
end
|