Merge pull request #209 from crystal-ameba/Sija/fix-missed-operator

Add ~ as the prefix operator to the Style/VerboseBlock rule
This commit is contained in:
Sijawusz Pur Rahnama 2021-03-02 15:28:00 +01:00 committed by GitHub
commit 6e622456ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -84,6 +84,7 @@ module Ameba::Rule::Style
source = Source.new %( source = Source.new %(
(1..3).sum { |i| +i } (1..3).sum { |i| +i }
(1..3).sum { |i| -i } (1..3).sum { |i| -i }
(1..3).sum { |i| ~i }
) )
rule = VerboseBlock.new rule = VerboseBlock.new
rule rule

View file

@ -51,7 +51,7 @@ module Ameba::Rule::Style
a_location.line_number == b_location.line_number a_location.line_number == b_location.line_number
end end
private PREFIX_OPERATORS = {"+", "-"} private PREFIX_OPERATORS = {"+", "-", "~"}
private OPERATOR_CHARS = private OPERATOR_CHARS =
{'[', ']', '!', '=', '>', '<', '~', '+', '-', '*', '/', '%', '^', '|', '&'} {'[', ']', '!', '=', '>', '<', '~', '+', '-', '*', '/', '%', '^', '|', '&'}