mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Ignore files with extensions other than .cr
This commit is contained in:
parent
a2c9aa67cc
commit
a661cf10fc
2 changed files with 8 additions and 1 deletions
|
@ -9,6 +9,11 @@ module Ameba::Rule::Lint
|
||||||
expect_no_issues subject, code: "", path: "src/spec/foo/bar.cr"
|
expect_no_issues subject, code: "", path: "src/spec/foo/bar.cr"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "passes if file extension is not `.cr`" do
|
||||||
|
expect_no_issues subject, code: "", path: "spec/foo.json"
|
||||||
|
expect_no_issues subject, code: "", path: "spec/foo/bar.json"
|
||||||
|
end
|
||||||
|
|
||||||
it "passes if filename is correct" do
|
it "passes if filename is correct" do
|
||||||
expect_no_issues subject, code: "", path: "spec/foo_spec.cr"
|
expect_no_issues subject, code: "", path: "spec/foo_spec.cr"
|
||||||
expect_no_issues subject, code: "", path: "spec/foo/bar_spec.cr"
|
expect_no_issues subject, code: "", path: "spec/foo/bar_spec.cr"
|
||||||
|
|
|
@ -28,8 +28,10 @@ module Ameba::Rule::Lint
|
||||||
name = path_.stem
|
name = path_.stem
|
||||||
path = path_.to_s
|
path = path_.to_s
|
||||||
|
|
||||||
# check files only within spec/ directory
|
# check only files within spec/ directory
|
||||||
return unless path.starts_with?("spec/")
|
return unless path.starts_with?("spec/")
|
||||||
|
# check only files with `.cr` extension
|
||||||
|
return unless path.ends_with?(".cr")
|
||||||
# ignore files having `_spec` suffix
|
# ignore files having `_spec` suffix
|
||||||
return if name.ends_with?("_spec")
|
return if name.ends_with?("_spec")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue