From 6d0b12c70fb10f586aebc3863247475a1d6aa386 Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Wed, 27 Dec 2023 19:38:44 +0100 Subject: [PATCH] Cleanup docs --- src/ameba/formatter/base_formatter.cr | 6 +++--- src/ameba/rule/base.cr | 5 +++-- src/ameba/rule/naming/block_parameter_name.cr | 2 +- src/ameba/rule/style/verbose_block.cr | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ameba/formatter/base_formatter.cr b/src/ameba/formatter/base_formatter.cr index 4009c992..a6ceafdf 100644 --- a/src/ameba/formatter/base_formatter.cr +++ b/src/ameba/formatter/base_formatter.cr @@ -17,13 +17,13 @@ module Ameba::Formatter # A list of sources to inspect is passed as an argument. def started(sources); end - # Callback that indicates when source inspection is finished. + # Callback that indicates when source inspection is started. # A corresponding source is passed as an argument. - def source_finished(source : Source); end + def source_started(source : Source); end # Callback that indicates when source inspection is finished. # A corresponding source is passed as an argument. - def source_started(source : Source); end + def source_finished(source : Source); end # Callback that indicates when inspection is finished. # A list of inspected sources is passed as an argument. diff --git a/src/ameba/rule/base.cr b/src/ameba/rule/base.cr index f28c83d0..242c86f0 100644 --- a/src/ameba/rule/base.cr +++ b/src/ameba/rule/base.cr @@ -32,14 +32,15 @@ module Ameba::Rule # This method is designed to test the source passed in. If source has issues # that are tested by this rule, it should add an issue. # - # Be default it uses a node visitor to traverse all the nodes in the source. + # By default it uses a node visitor to traverse all the nodes in the source. + # # NOTE: Must be overridden for other type of rules. def test(source : Source) AST::NodeVisitor.new self, source end + # NOTE: Can't be abstract def test(source : Source, node : Crystal::ASTNode, *opts) - # can't be abstract end # A convenient addition to `#test` method that does the same diff --git a/src/ameba/rule/naming/block_parameter_name.cr b/src/ameba/rule/naming/block_parameter_name.cr index 2311b890..71e6a6a8 100644 --- a/src/ameba/rule/naming/block_parameter_name.cr +++ b/src/ameba/rule/naming/block_parameter_name.cr @@ -41,7 +41,7 @@ module Ameba::Rule::Naming end private def valid_name?(name) - return true if name.blank? # happens with compound names like `(arg1, arg2)` + return true if name.blank? # TODO: handle unpacked variables return true if name.in?(allowed_names) return false if name.in?(forbidden_names) diff --git a/src/ameba/rule/style/verbose_block.cr b/src/ameba/rule/style/verbose_block.cr index fb69f14f..fee2cecd 100644 --- a/src/ameba/rule/style/verbose_block.cr +++ b/src/ameba/rule/style/verbose_block.cr @@ -230,7 +230,7 @@ module Ameba::Rule::Style # we filter out the blocks that are of call type - `i.to_i64.odd?` return unless (body = block.body).is_a?(Crystal::Call) - # we need to "unwind" the chain calls, so the final receiver object + # we need to "unwind" the call chain, so the final receiver object # ends up being a variable - `i` obj = body.obj while obj.is_a?(Crystal::Call)