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 it "returns list of sources" do
config.sources.size.should be > 0 config.sources.size.should be > 0
config.sources.first.should be_a Source 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 end
it "returns a list of sources mathing globs" do it "returns a list of sources mathing globs" do
@ -130,7 +130,7 @@ module Ameba
it "returns a lisf of sources excluding 'Excluded'" do it "returns a lisf of sources excluding 'Excluded'" do
config.excluded = %w(**/config_spec.cr) 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
end end

View file

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

View file

@ -78,7 +78,7 @@ module Ameba::AST
# scope.find_variable("foo") # scope.find_variable("foo")
# ``` # ```
def find_variable(name : String) 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 end
# Creates a new assignment for the variable. # Creates a new assignment for the variable.

View file

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

View file

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