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)
 | 
					    def initialize(@node, @parent)
 | 
				
			||||||
    end
 | 
					    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:
 | 
					    # For example, this branch is in a loop:
 | 
				
			||||||
    #
 | 
					    #
 | 
				
			||||||
    # ```
 | 
					    # ```
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,8 @@ module Ameba::AST
 | 
				
			||||||
    def initialize(@node, @parent = nil)
 | 
					    def initialize(@node, @parent = nil)
 | 
				
			||||||
    end
 | 
					    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?
 | 
					    def loop?
 | 
				
			||||||
      loop?(node) || !!parent.try(&.loop?)
 | 
					      loop?(node) || !!parent.try(&.loop?)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -153,7 +153,7 @@ module Ameba::AST
 | 
				
			||||||
      outer_scope.nil?
 | 
					      outer_scope.nil?
 | 
				
			||||||
    end
 | 
					    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)
 | 
					    def arg?(var)
 | 
				
			||||||
      case current_node = node
 | 
					      case current_node = node
 | 
				
			||||||
      when Crystal::Def
 | 
					      when Crystal::Def
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@ module Ameba::AST
 | 
				
			||||||
    def initialize(@node, @variable)
 | 
					    def initialize(@node, @variable)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Returns true if the name starts with '_', false if not.
 | 
					    # Returns `true` if the name starts with '_', `false` if not.
 | 
				
			||||||
    def ignored?
 | 
					    def ignored?
 | 
				
			||||||
      name.starts_with? '_'
 | 
					      name.starts_with? '_'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ module Ameba::AST
 | 
				
			||||||
      @variable.referenced? && !!@branch.try(&.in_loop?)
 | 
					      @variable.referenced? && !!@branch.try(&.in_loop?)
 | 
				
			||||||
    end
 | 
					    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:
 | 
					    # For example, this is an op assign:
 | 
				
			||||||
    #
 | 
					    #
 | 
				
			||||||
    # ```
 | 
					    # ```
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,7 @@ module Ameba::AST
 | 
				
			||||||
      node.is_a?(Crystal::OpAssign)
 | 
					      node.is_a?(Crystal::OpAssign)
 | 
				
			||||||
    end
 | 
					    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:
 | 
					    # For example, this assignment is in a branch:
 | 
				
			||||||
    #
 | 
					    #
 | 
				
			||||||
    # ```
 | 
					    # ```
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ module Ameba::AST
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # A main visit method that accepts `Crystal::ASTNode`.
 | 
					    # 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)
 | 
					    def visit(node : Crystal::ASTNode)
 | 
				
			||||||
      true
 | 
					      true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,7 @@ class Ameba::Config
 | 
				
			||||||
  # ```
 | 
					  # ```
 | 
				
			||||||
  property excluded : Array(String)
 | 
					  property excluded : Array(String)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Returns true if correctable issues should be autocorrected.
 | 
					  # Returns `true` if correctable issues should be autocorrected.
 | 
				
			||||||
  property? autocorrect = false
 | 
					  property? autocorrect = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @rule_groups : Hash(String, Array(Rule::Base))
 | 
					  @rule_groups : Hash(String, Array(Rule::Base))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,8 +10,8 @@ module Ameba
 | 
				
			||||||
      Enable
 | 
					      Enable
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Returns true if current location is disabled for a particular rule,
 | 
					    # Returns `true` if current location is disabled for a particular rule,
 | 
				
			||||||
    # false otherwise.
 | 
					    # `false` otherwise.
 | 
				
			||||||
    #
 | 
					    #
 | 
				
			||||||
    # Location is disabled in two cases:
 | 
					    # Location is disabled in two cases:
 | 
				
			||||||
    #   1. The line of the location ends with a comment directive.
 | 
					    #   1. The line of the location ends with a comment directive.
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ module Ameba
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    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)
 | 
					    def comment?(line_number : Int32)
 | 
				
			||||||
      return unless line = lines[line_number]?
 | 
					      return unless line = lines[line_number]?
 | 
				
			||||||
      comment?(line)
 | 
					      comment?(line)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,7 +94,7 @@ module Ameba::Rule
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    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.
 | 
					    # usual rules.
 | 
				
			||||||
    #
 | 
					    #
 | 
				
			||||||
    # ```
 | 
					    # ```
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,7 @@ module Ameba
 | 
				
			||||||
    # Checks for unneeded disable directives. Always inspects a source last
 | 
					    # Checks for unneeded disable directives. Always inspects a source last
 | 
				
			||||||
    @unneeded_disable_directive_rule : Rule::Base?
 | 
					    @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
 | 
					    private getter? autocorrect : Bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Instantiates a runner using a `config`.
 | 
					    # Instantiates a runner using a `config`.
 | 
				
			||||||
| 
						 | 
					@ -162,7 +162,7 @@ module Ameba
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Indicates whether the last inspection successful or not.
 | 
					    # 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
 | 
					    # runner = Ameba::Runner.new config
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ class Ameba::Source
 | 
				
			||||||
      @action_root = Rewriter::Action.new(0, code.size)
 | 
					      @action_root = Rewriter::Action.new(0, code.size)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Returns true if no (non trivial) update has been recorded
 | 
					    # Returns `true` if no (non trivial) update has been recorded
 | 
				
			||||||
    def empty?
 | 
					    def empty?
 | 
				
			||||||
      @action_root.empty?
 | 
					      @action_root.empty?
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue