mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Doc tweaks
This commit is contained in:
parent
99c81d3630
commit
a8fca61b22
11 changed files with 16 additions and 15 deletions
|
@ -32,7 +32,7 @@ module Ameba::AST
|
|||
def initialize(@node, @parent)
|
||||
end
|
||||
|
||||
# Returns true if current branch is in a loop, false - otherwise.
|
||||
# Returns `true` if current branch is in a loop, `false` - otherwise.
|
||||
# For example, this branch is in a loop:
|
||||
#
|
||||
# ```
|
||||
|
|
|
@ -35,7 +35,8 @@ module Ameba::AST
|
|||
def initialize(@node, @parent = nil)
|
||||
end
|
||||
|
||||
# Returns true if this node or one of the parent branchables is a loop, false otherwise.
|
||||
# Returns `true` if this node or one of the parent branchables is a loop,
|
||||
# `false` otherwise.
|
||||
def loop?
|
||||
loop?(node) || !!parent.try(&.loop?)
|
||||
end
|
||||
|
|
|
@ -153,7 +153,7 @@ module Ameba::AST
|
|||
outer_scope.nil?
|
||||
end
|
||||
|
||||
# Returns true if var is an argument in current scope, `false` otherwise.
|
||||
# Returns `true` if var is an argument in current scope, `false` otherwise.
|
||||
def arg?(var)
|
||||
case current_node = node
|
||||
when Crystal::Def
|
||||
|
|
|
@ -31,7 +31,7 @@ module Ameba::AST
|
|||
def initialize(@node, @variable)
|
||||
end
|
||||
|
||||
# Returns true if the name starts with '_', false if not.
|
||||
# Returns `true` if the name starts with '_', `false` if not.
|
||||
def ignored?
|
||||
name.starts_with? '_'
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ module Ameba::AST
|
|||
@variable.referenced? && !!@branch.try(&.in_loop?)
|
||||
end
|
||||
|
||||
# Returns true if this assignment is an op assign, false if not.
|
||||
# Returns `true` if this assignment is an op assign, `false` if not.
|
||||
# For example, this is an op assign:
|
||||
#
|
||||
# ```
|
||||
|
@ -51,7 +51,7 @@ module Ameba::AST
|
|||
node.is_a?(Crystal::OpAssign)
|
||||
end
|
||||
|
||||
# Returns true if this assignment is in a branch, false if not.
|
||||
# Returns `true` if this assignment is in a branch, `false` if not.
|
||||
# For example, this assignment is in a branch:
|
||||
#
|
||||
# ```
|
||||
|
|
|
@ -20,7 +20,7 @@ module Ameba::AST
|
|||
end
|
||||
|
||||
# A main visit method that accepts `Crystal::ASTNode`.
|
||||
# Returns true meaning all child nodes will be traversed.
|
||||
# Returns `true`, meaning all child nodes will be traversed.
|
||||
def visit(node : Crystal::ASTNode)
|
||||
true
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ class Ameba::Config
|
|||
# ```
|
||||
property excluded : Array(String)
|
||||
|
||||
# Returns true if correctable issues should be autocorrected.
|
||||
# Returns `true` if correctable issues should be autocorrected.
|
||||
property? autocorrect = false
|
||||
|
||||
@rule_groups : Hash(String, Array(Rule::Base))
|
||||
|
|
|
@ -10,8 +10,8 @@ module Ameba
|
|||
Enable
|
||||
end
|
||||
|
||||
# Returns true if current location is disabled for a particular rule,
|
||||
# false otherwise.
|
||||
# Returns `true` if current location is disabled for a particular rule,
|
||||
# `false` otherwise.
|
||||
#
|
||||
# Location is disabled in two cases:
|
||||
# 1. The line of the location ends with a comment directive.
|
||||
|
@ -74,7 +74,7 @@ module Ameba
|
|||
}
|
||||
end
|
||||
|
||||
# Returns true if the line at the given `line_number` is a comment.
|
||||
# Returns `true` if the line at the given `line_number` is a comment.
|
||||
def comment?(line_number : Int32)
|
||||
return unless line = lines[line_number]?
|
||||
comment?(line)
|
||||
|
|
|
@ -94,7 +94,7 @@ module Ameba::Rule
|
|||
end
|
||||
end
|
||||
|
||||
# Returns true if this rule is special and behaves differently than
|
||||
# Returns `true` if this rule is special and behaves differently than
|
||||
# usual rules.
|
||||
#
|
||||
# ```
|
||||
|
|
|
@ -46,7 +46,7 @@ module Ameba
|
|||
# Checks for unneeded disable directives. Always inspects a source last
|
||||
@unneeded_disable_directive_rule : Rule::Base?
|
||||
|
||||
# Returns true if correctable issues should be autocorrected.
|
||||
# Returns `true` if correctable issues should be autocorrected.
|
||||
private getter? autocorrect : Bool
|
||||
|
||||
# Instantiates a runner using a `config`.
|
||||
|
@ -162,7 +162,7 @@ module Ameba
|
|||
end
|
||||
|
||||
# Indicates whether the last inspection successful or not.
|
||||
# It returns true if no issues matching severity in sources found, false otherwise.
|
||||
# It returns `true` if no issues matching severity in sources found, `false` otherwise.
|
||||
#
|
||||
# ```
|
||||
# runner = Ameba::Runner.new config
|
||||
|
|
|
@ -65,7 +65,7 @@ class Ameba::Source
|
|||
@action_root = Rewriter::Action.new(0, code.size)
|
||||
end
|
||||
|
||||
# Returns true if no (non trivial) update has been recorded
|
||||
# Returns `true` if no (non trivial) update has been recorded
|
||||
def empty?
|
||||
@action_root.empty?
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue