mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Rule#enabled
-> Rule#enabled?
This commit is contained in:
parent
31392046e0
commit
c7c75ee36a
4 changed files with 7 additions and 7 deletions
|
@ -25,7 +25,7 @@ module Ameba::Rule
|
||||||
subject = DummyRule.new
|
subject = DummyRule.new
|
||||||
|
|
||||||
it "is enabled by default" do
|
it "is enabled by default" do
|
||||||
subject.enabled.should be_true
|
subject.enabled?.should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has a description property" do
|
it "has a description property" do
|
||||||
|
|
|
@ -170,7 +170,7 @@ module Ameba
|
||||||
name = DummyRule.rule_name
|
name = DummyRule.rule_name
|
||||||
config.update_rule name, enabled: false
|
config.update_rule name, enabled: false
|
||||||
rule = config.rules.find!(&.name.== name)
|
rule = config.rules.find!(&.name.== name)
|
||||||
rule.enabled.should be_false
|
rule.enabled?.should be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
it "updates excluded property" do
|
it "updates excluded property" do
|
||||||
|
@ -189,7 +189,7 @@ module Ameba
|
||||||
name = DummyRule.rule_name
|
name = DummyRule.rule_name
|
||||||
config.update_rules [name], enabled: false
|
config.update_rules [name], enabled: false
|
||||||
rule = config.rules.find!(&.name.== name)
|
rule = config.rules.find!(&.name.== name)
|
||||||
rule.enabled.should be_false
|
rule.enabled?.should be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
it "updates multiple rules by excluded property" do
|
it "updates multiple rules by excluded property" do
|
||||||
|
@ -204,7 +204,7 @@ module Ameba
|
||||||
group = DummyRule.group_name
|
group = DummyRule.group_name
|
||||||
config.update_rules [group], enabled: false
|
config.update_rules [group], enabled: false
|
||||||
rule = config.rules.find!(&.name.== DummyRule.rule_name)
|
rule = config.rules.find!(&.name.== DummyRule.rule_name)
|
||||||
rule.enabled.should be_false
|
rule.enabled?.should be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
it "updates a group by excluded property" do
|
it "updates a group by excluded property" do
|
||||||
|
|
|
@ -247,7 +247,7 @@ class Ameba::Config
|
||||||
|
|
||||||
{% if properties["enabled".id] == nil %}
|
{% if properties["enabled".id] == nil %}
|
||||||
@[YAML::Field(key: "Enabled")]
|
@[YAML::Field(key: "Enabled")]
|
||||||
property enabled = true
|
property? enabled = true
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
{% if properties["severity".id] == nil %}
|
{% if properties["severity".id] == nil %}
|
||||||
|
|
|
@ -62,7 +62,7 @@ module Ameba
|
||||||
@sources = config.sources
|
@sources = config.sources
|
||||||
@formatter = config.formatter
|
@formatter = config.formatter
|
||||||
@severity = config.severity
|
@severity = config.severity
|
||||||
@rules = config.rules.select(&.enabled).reject!(&.special?)
|
@rules = config.rules.select(&.enabled?).reject!(&.special?)
|
||||||
@autocorrect = config.autocorrect?
|
@autocorrect = config.autocorrect?
|
||||||
|
|
||||||
@unneeded_disable_directive_rule =
|
@unneeded_disable_directive_rule =
|
||||||
|
@ -220,7 +220,7 @@ module Ameba
|
||||||
|
|
||||||
private def check_unneeded_directives(source)
|
private def check_unneeded_directives(source)
|
||||||
return unless rule = @unneeded_disable_directive_rule
|
return unless rule = @unneeded_disable_directive_rule
|
||||||
return unless rule.enabled
|
return unless rule.enabled?
|
||||||
|
|
||||||
rule.test(source)
|
rule.test(source)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue