From c7c75ee36a8fa9122e1228748a27827903e8e5f8 Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Tue, 22 Nov 2022 19:46:38 +0100 Subject: [PATCH] `Rule#enabled` -> `Rule#enabled?` --- spec/ameba/base_spec.cr | 2 +- spec/ameba/config_spec.cr | 6 +++--- src/ameba/config.cr | 2 +- src/ameba/runner.cr | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/ameba/base_spec.cr b/spec/ameba/base_spec.cr index 508091b5..21ced084 100644 --- a/spec/ameba/base_spec.cr +++ b/spec/ameba/base_spec.cr @@ -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 diff --git a/spec/ameba/config_spec.cr b/spec/ameba/config_spec.cr index 03bd26a6..d738310f 100644 --- a/spec/ameba/config_spec.cr +++ b/spec/ameba/config_spec.cr @@ -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 diff --git a/src/ameba/config.cr b/src/ameba/config.cr index 8f5b52a4..515e4fd8 100644 --- a/src/ameba/config.cr +++ b/src/ameba/config.cr @@ -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 %} diff --git a/src/ameba/runner.cr b/src/ameba/runner.cr index a987db12..2f8ee72b 100644 --- a/src/ameba/runner.cr +++ b/src/ameba/runner.cr @@ -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