Rule#enabled -> Rule#enabled?

This commit is contained in:
Sijawusz Pur Rahnama 2022-11-22 19:46:38 +01:00
parent 31392046e0
commit c7c75ee36a
4 changed files with 7 additions and 7 deletions

View file

@ -25,7 +25,7 @@ module Ameba::Rule
subject = DummyRule.new
it "is enabled by default" do
subject.enabled.should be_true
subject.enabled?.should be_true
end
it "has a description property" do

View file

@ -170,7 +170,7 @@ module Ameba
name = DummyRule.rule_name
config.update_rule name, enabled: false
rule = config.rules.find!(&.name.== name)
rule.enabled.should be_false
rule.enabled?.should be_false
end
it "updates excluded property" do
@ -189,7 +189,7 @@ module Ameba
name = DummyRule.rule_name
config.update_rules [name], enabled: false
rule = config.rules.find!(&.name.== name)
rule.enabled.should be_false
rule.enabled?.should be_false
end
it "updates multiple rules by excluded property" do
@ -204,7 +204,7 @@ module Ameba
group = DummyRule.group_name
config.update_rules [group], enabled: false
rule = config.rules.find!(&.name.== DummyRule.rule_name)
rule.enabled.should be_false
rule.enabled?.should be_false
end
it "updates a group by excluded property" do

View file

@ -247,7 +247,7 @@ class Ameba::Config
{% if properties["enabled".id] == nil %}
@[YAML::Field(key: "Enabled")]
property enabled = true
property? enabled = true
{% end %}
{% if properties["severity".id] == nil %}

View file

@ -62,7 +62,7 @@ module Ameba
@sources = config.sources
@formatter = config.formatter
@severity = config.severity
@rules = config.rules.select(&.enabled).reject!(&.special?)
@rules = config.rules.select(&.enabled?).reject!(&.special?)
@autocorrect = config.autocorrect?
@unneeded_disable_directive_rule =
@ -220,7 +220,7 @@ module Ameba
private def check_unneeded_directives(source)
return unless rule = @unneeded_disable_directive_rule
return unless rule.enabled
return unless rule.enabled?
rule.test(source)
end