mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
fix restriction issue (#271)
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
This commit is contained in:
parent
8a12229116
commit
1bef5fc5c1
2 changed files with 13 additions and 3 deletions
|
@ -36,7 +36,7 @@ module Ameba
|
||||||
# Time.epoch(1483859302)
|
# Time.epoch(1483859302)
|
||||||
# end
|
# end
|
||||||
# ```
|
# ```
|
||||||
def location_disabled?(location, rule)
|
def location_disabled?(location : Crystal::Location?, rule)
|
||||||
return false if rule.name.in?(Rule::SPECIAL)
|
return false if rule.name.in?(Rule::SPECIAL)
|
||||||
return false unless line_number = location.try &.line_number.try &.- 1
|
return false unless line_number = location.try &.line_number.try &.- 1
|
||||||
return false unless line = lines[line_number]?
|
return false unless line = lines[line_number]?
|
||||||
|
|
|
@ -5,7 +5,12 @@ module Ameba
|
||||||
getter issues = [] of Issue
|
getter issues = [] of Issue
|
||||||
|
|
||||||
# Adds a new issue to the list of issues.
|
# Adds a new issue to the list of issues.
|
||||||
def add_issue(rule, location, end_location, message, status : Issue::Status? = nil, block : (Source::Corrector ->)? = nil) : Issue
|
def add_issue(rule,
|
||||||
|
location : Crystal::Location?,
|
||||||
|
end_location : Crystal::Location?,
|
||||||
|
message : String,
|
||||||
|
status : Issue::Status? = nil,
|
||||||
|
block : (Source::Corrector ->)? = nil) : Issue
|
||||||
status ||=
|
status ||=
|
||||||
Issue::Status::Disabled if location_disabled?(location, rule)
|
Issue::Status::Disabled if location_disabled?(location, rule)
|
||||||
|
|
||||||
|
@ -15,7 +20,12 @@ module Ameba
|
||||||
end
|
end
|
||||||
|
|
||||||
# :ditto:
|
# :ditto:
|
||||||
def add_issue(rule, location, end_location, message, status : Issue::Status? = nil, &block : Source::Corrector ->) : Issue
|
def add_issue(rule,
|
||||||
|
location : Crystal::Location,
|
||||||
|
end_location : Crystal::Location,
|
||||||
|
message : String,
|
||||||
|
status : Issue::Status? = nil,
|
||||||
|
&block : Source::Corrector ->) : Issue
|
||||||
add_issue rule, location, end_location, message, status, block
|
add_issue rule, location, end_location, message, status, block
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue