mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Rename RedundantParentheses
-> ParenthesesAroundCondition
Also rename the option: `parenthesized_assignments` -> `allow_safe_assignment`
This commit is contained in:
parent
0b0a815c31
commit
5ee4074c1b
2 changed files with 14 additions and 13 deletions
|
@ -1,9 +1,9 @@
|
|||
require "../../../spec_helper"
|
||||
|
||||
module Ameba::Rule::Style
|
||||
subject = RedundantParentheses.new
|
||||
subject = ParenthesesAroundCondition.new
|
||||
|
||||
describe RedundantParentheses do
|
||||
describe ParenthesesAroundCondition do
|
||||
{% for keyword in %w(if unless while until) %}
|
||||
context "{{ keyword.id }}" do
|
||||
it "reports if redundant parentheses are found" do
|
||||
|
@ -51,7 +51,7 @@ module Ameba::Rule::Style
|
|||
end
|
||||
|
||||
it "allows to configure assignments" do
|
||||
rule = Rule::Style::RedundantParentheses.new
|
||||
rule = Rule::Style::ParenthesesAroundCondition.new
|
||||
rule.exclude_ternary = false
|
||||
|
||||
expect_issue rule, <<-CRYSTAL
|
||||
|
@ -75,7 +75,7 @@ module Ameba::Rule::Style
|
|||
end
|
||||
end
|
||||
|
||||
context "#parenthesized_assignments=" do
|
||||
context "#allow_safe_assignment=" do
|
||||
it "reports assignments by default" do
|
||||
expect_issue subject, <<-CRYSTAL
|
||||
if (foo = @foo)
|
||||
|
@ -98,8 +98,8 @@ module Ameba::Rule::Style
|
|||
end
|
||||
|
||||
it "allows to configure assignments" do
|
||||
rule = Rule::Style::RedundantParentheses.new
|
||||
rule.parenthesized_assignments = true
|
||||
rule = Rule::Style::ParenthesesAroundCondition.new
|
||||
rule.allow_safe_assignment = true
|
||||
|
||||
expect_issue rule, <<-CRYSTAL
|
||||
if foo = @foo
|
Loading…
Add table
Add a link
Reference in a new issue