Skip to content

Commit

Permalink
Fix new offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
nobodywasishere committed Feb 3, 2025
1 parent 5f4b1d8 commit e080de7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions spec/ameba/rule/documentation/documentation_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Ameba::Rule::Documentation
private macro bag
end
CRYSTAL
CRYSTAL
end

it "passes for documented public types" do
Expand Down Expand Up @@ -59,31 +59,31 @@ module Ameba::Rule::Documentation
# bag
macro bag
end
CRYSTAL
CRYSTAL
end

it "fails if there is an undocumented public type" do
expect_issue subject, <<-CRYSTAL
class Foo
# ^^^^^^^^^ error: Missing documentation
# ^^^^^^^ error: Missing documentation
end
module Bar
# ^^^^^^^^^^ error: Missing documentation
# ^^^^^^^^ error: Missing documentation
end
enum Baz
# ^^^^^^^^ error: Missing documentation
# ^^^^^^ error: Missing documentation
end
def bat
# ^^^^^^^ error: Missing documentation
# ^^^^^ error: Missing documentation
end
macro bag
# ^^^^^^^^^ error: Missing documentation
# ^^^^^^^ error: Missing documentation
end
CRYSTAL
CRYSTAL
end

context "properties" do
Expand Down
10 changes: 5 additions & 5 deletions spec/ameba/rule/lint/empty_ensure_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ module Ameba::Rule::Lint
ensure
nil
end
CRYSTAL
CRYSTAL
end

it "fails if there is an empty ensure in method" do
expect_issue subject, <<-CRYSTAL
def method
do_some_stuff
ensure
# ^^^^^^ error: Empty `ensure` block detected
# ^^^^ error: Empty `ensure` block detected
end
CRYSTAL
CRYSTAL
end

it "fails if there is an empty ensure in a block" do
Expand All @@ -43,10 +43,10 @@ module Ameba::Rule::Lint
rescue
do_some_other_stuff
ensure
# ^^^^^^ error: Empty `ensure` block detected
# ^^^^ error: Empty `ensure` block detected
# nothing here
end
CRYSTAL
CRYSTAL
end
end
end
24 changes: 12 additions & 12 deletions spec/ameba/rule/lint/shadowed_exception_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Ameba::Rule::Lint
rescue e : Exception
handle_exception
end
CRYSTAL
CRYSTAL
end

it "fails if there is a shadowed exception" do
Expand All @@ -38,7 +38,7 @@ module Ameba::Rule::Lint
# ^^^^^^^^^^^^^ error: Shadowed exception found: `ArgumentError`
handle_argument_error_exception
end
CRYSTAL
CRYSTAL
end

it "fails if there is a custom shadowed exceptions" do
Expand All @@ -51,7 +51,7 @@ module Ameba::Rule::Lint
# ^^^^^^^^^^^^^^^^ error: Shadowed exception found: `MySuperException`
3
end
CRYSTAL
CRYSTAL
end

it "fails if there is a shadowed exception in a type list" do
Expand All @@ -60,7 +60,7 @@ module Ameba::Rule::Lint
rescue Exception | IndexError
# ^^^^^^^^^^ error: Shadowed exception found: `IndexError`
end
CRYSTAL
CRYSTAL
end

it "fails if there is a first shadowed exception in a type list" do
Expand All @@ -72,7 +72,7 @@ module Ameba::Rule::Lint
# ^^^^^^^^^ error: Shadowed exception found: `Exception`
rescue
end
CRYSTAL
CRYSTAL
end

it "fails if there is a shadowed duplicated exception" do
Expand All @@ -83,7 +83,7 @@ module Ameba::Rule::Lint
rescue IndexError
# ^^^^^^^^^^ error: Shadowed exception found: `IndexError`
end
CRYSTAL
CRYSTAL
end

it "fails if there is a shadowed duplicated exception in a type list" do
Expand All @@ -93,7 +93,7 @@ module Ameba::Rule::Lint
rescue ArgumentError | IndexError
# ^^^^^^^^^^ error: Shadowed exception found: `IndexError`
end
CRYSTAL
CRYSTAL
end

it "fails if there is only shadowed duplicated exceptions" do
Expand All @@ -104,7 +104,7 @@ module Ameba::Rule::Lint
# ^^^^^^^^^^ error: Shadowed exception found: `IndexError`
rescue Exception
end
CRYSTAL
CRYSTAL
end

it "fails if there is only shadowed duplicated exceptions in a type list" do
Expand All @@ -113,7 +113,7 @@ module Ameba::Rule::Lint
rescue IndexError | IndexError
# ^^^^^^^^^^ error: Shadowed exception found: `IndexError`
end
CRYSTAL
CRYSTAL
end

it "fails if all rescues are shadowed and there is a catch-all rescue" do
Expand All @@ -129,7 +129,7 @@ module Ameba::Rule::Lint
# ^^^^^^^^ error: Shadowed exception found: `KeyError`
rescue
end
CRYSTAL
CRYSTAL
end

it "fails if there are shadowed exception with args" do
Expand All @@ -140,7 +140,7 @@ module Ameba::Rule::Lint
# ^^^^^^^^^^ error: Shadowed exception found: `IndexError`
rescue
end
CRYSTAL
CRYSTAL
end

it "fails if there are multiple shadowed exceptions" do
Expand All @@ -152,7 +152,7 @@ module Ameba::Rule::Lint
rescue IndexError
# ^^^^^^^^^^ error: Shadowed exception found: `IndexError`
end
CRYSTAL
CRYSTAL
end

it "fails if there are multiple shadowed exceptions in a type list" do
Expand Down

0 comments on commit e080de7

Please sign in to comment.