Fix newly found issues

This commit is contained in:
Sijawusz Pur Rahnama 2021-01-25 02:34:33 +01:00
parent 0739fad670
commit a53d44617d
5 changed files with 6 additions and 8 deletions

View file

@ -120,7 +120,7 @@ module Ameba
it "returns list of sources" do
config.sources.size.should be > 0
config.sources.first.should be_a Source
config.sources.any? { |s| s.fullpath == __FILE__ }.should be_true
config.sources.any?(&.fullpath.==(__FILE__)).should be_true
end
it "returns a list of sources mathing globs" do
@ -130,7 +130,7 @@ module Ameba
it "returns a lisf of sources excluding 'Excluded'" do
config.excluded = %w(**/config_spec.cr)
config.sources.any? { |s| s.fullpath == __FILE__ }.should be_false
config.sources.any?(&.fullpath.==(__FILE__)).should be_false
end
end

View file

@ -4,9 +4,7 @@ module Ameba
describe Severity do
describe "#symbol" do
it "returns the symbol for each severity in the enum" do
Severity.values.each do |severity|
severity.symbol.should_not be_nil
end
Severity.values.each(&.symbol.should_not(be_nil))
end
it "returns symbol for Error" do

View file

@ -78,7 +78,7 @@ module Ameba::AST
# scope.find_variable("foo")
# ```
def find_variable(name : String)
variables.find { |v| v.name == name } || outer_scope.try &.find_variable(name)
variables.find(&.name.==(name)) || outer_scope.try &.find_variable(name)
end
# Creates a new assignment for the variable.

View file

@ -11,7 +11,7 @@ module Ameba
rejected = rejected_globs(globs)
selected = globs - rejected
expand(selected) - expand(rejected.map! { |p| p[1..-1] })
expand(selected) - expand(rejected.map!(&.[1..-1]))
end
# Expands globs. Globs can point to files or even directories.

View file

@ -126,7 +126,7 @@ module Ameba
@sources.all? do |source|
source.issues
.reject(&.disabled?)
.none? { |issue| issue.rule.severity <= @severity }
.none?(&.rule.severity.<=(@severity))
end
end