shard-ameba/src/ameba/issue.cr

36 lines
704 B
Crystal
Raw Normal View History

2018-06-10 21:15:12 +00:00
module Ameba
# Represents an issue reported by Ameba.
struct Issue
enum Status
Enabled
Disabled
end
2018-06-10 21:15:12 +00:00
# A rule that triggers this issue.
getter rule : Rule::Base
2018-06-10 21:15:12 +00:00
# Location of the issue.
getter location : Crystal::Location?
2018-06-10 21:15:12 +00:00
# End location of the issue.
getter end_location : Crystal::Location?
2018-06-10 21:15:12 +00:00
# Issue message.
getter message : String
2018-06-10 21:15:12 +00:00
# Issue status.
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
def syntax?
rule.is_a?(Rule::Lint::Syntax)
end
2018-06-10 21:15:12 +00:00
end
end