From 7192b64df0bafef4026e29ae736fa6e7088ccf6c Mon Sep 17 00:00:00 2001 From: Vitalii Elenhaupt Date: Fri, 11 Mar 2022 18:00:25 +0200 Subject: [PATCH] Fix rest of the specs --- spec/ameba/rule/lint/empty_ensure_spec.cr | 2 +- spec/ameba/rule/lint/shadowed_exception_spec.cr | 2 +- ...ble_directive_spec.cr => unneeded_disable_directive_spec.cr} | 0 src/ameba/inline_comments.cr | 2 +- src/ameba/rule/style/redundant_begin.cr | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename spec/ameba/rule/lint/{unneded_disable_directive_spec.cr => unneeded_disable_directive_spec.cr} (100%) diff --git a/spec/ameba/rule/lint/empty_ensure_spec.cr b/spec/ameba/rule/lint/empty_ensure_spec.cr index bba7a6d8..d979306e 100644 --- a/spec/ameba/rule/lint/empty_ensure_spec.cr +++ b/spec/ameba/rule/lint/empty_ensure_spec.cr @@ -61,7 +61,7 @@ module Ameba::Rule::Lint issue = s.issues.first issue.rule.should_not be_nil - issue.location.to_s.should eq "source.cr:2:3" + issue.location.to_s.should eq "source.cr:1:1" issue.end_location.to_s.should eq "source.cr:6:3" issue.message.should eq "Empty `ensure` block detected" end diff --git a/spec/ameba/rule/lint/shadowed_exception_spec.cr b/spec/ameba/rule/lint/shadowed_exception_spec.cr index 5b7d4933..9546d7d4 100644 --- a/spec/ameba/rule/lint/shadowed_exception_spec.cr +++ b/spec/ameba/rule/lint/shadowed_exception_spec.cr @@ -166,7 +166,7 @@ module Ameba::Rule::Lint issue = s.issues.first issue.rule.should_not be_nil - issue.location.to_s.should eq "source.cr:2:3" + issue.location.to_s.should eq "source.cr:1:1" issue.end_location.to_s.should eq "source.cr:4:3" issue.message.should eq( "Exception handler has shadowed exceptions: IndexError" diff --git a/spec/ameba/rule/lint/unneded_disable_directive_spec.cr b/spec/ameba/rule/lint/unneeded_disable_directive_spec.cr similarity index 100% rename from spec/ameba/rule/lint/unneded_disable_directive_spec.cr rename to spec/ameba/rule/lint/unneeded_disable_directive_spec.cr diff --git a/src/ameba/inline_comments.cr b/src/ameba/inline_comments.cr index 648f1f98..160a9144 100644 --- a/src/ameba/inline_comments.cr +++ b/src/ameba/inline_comments.cr @@ -95,7 +95,7 @@ module Ameba commented = false lexer = Crystal::Lexer.new(line).tap(&.comments_enabled = true) - Tokenizer.new(lexer).run { |t| commented = true if t.type == :COMMENT } + Tokenizer.new(lexer).run { |t| commented = true if t.type.comment? } commented end end diff --git a/src/ameba/rule/style/redundant_begin.cr b/src/ameba/rule/style/redundant_begin.cr index 7db7baa0..9e5609ac 100644 --- a/src/ameba/rule/style/redundant_begin.cr +++ b/src/ameba/rule/style/redundant_begin.cr @@ -90,7 +90,7 @@ module Ameba::Rule::Style end private def redundant_begin_in_expressions?(node) - node.keyword == :begin + node.keyword == Crystal::Expressions::Keyword::Begin end private def inner_handler?(handler)