Remove extraneous blank lines

This commit is contained in:
Sijawusz Pur Rahnama 2021-01-17 18:24:49 +01:00
parent af5d825015
commit 928a260d51
12 changed files with 0 additions and 26 deletions

View file

@ -44,7 +44,6 @@ module Ameba::AST
# end # end
# end # end
# ``` # ```
#
def in_loop? def in_loop?
@parent.loop? @parent.loop?
end end

View file

@ -28,7 +28,6 @@ module Ameba::AST
# ``` # ```
# Assignment.new(node, variable, scope) # Assignment.new(node, variable, scope)
# ``` # ```
#
def initialize(@node, @variable, @scope) def initialize(@node, @variable, @scope)
if scope = @variable.scope if scope = @variable.scope
@branch = Branch.of(@node, scope) @branch = Branch.of(@node, scope)
@ -95,7 +94,6 @@ module Ameba::AST
# puts(b) # puts(b)
# end # end
# ``` # ```
#
def transformed? def transformed?
return false unless (assign = node).is_a?(Crystal::Assign) return false unless (assign = node).is_a?(Crystal::Assign)
return false unless (value = assign.value).is_a?(Crystal::Call) return false unless (value = assign.value).is_a?(Crystal::Call)

View file

@ -27,7 +27,6 @@ module Ameba::AST
# ``` # ```
# Variable.new(node, scope) # Variable.new(node, scope)
# ``` # ```
#
def initialize(@node, @scope) def initialize(@node, @scope)
end end
@ -45,7 +44,6 @@ module Ameba::AST
# variable.assign(node2) # variable.assign(node2)
# variable.assignment.size # => 2 # variable.assignment.size # => 2
# ``` # ```
#
def assign(node, scope) def assign(node, scope)
assignments << Assignment.new(node, self, scope) assignments << Assignment.new(node, self, scope)
@ -69,7 +67,6 @@ module Ameba::AST
# variable = Variable.new(node, scope) # variable = Variable.new(node, scope)
# variable.reference(var_node, some_scope) # variable.reference(var_node, some_scope)
# ``` # ```
#
def reference(node : Crystal::Var, scope : Scope) def reference(node : Crystal::Var, scope : Scope)
Reference.new(node, scope).tap do |reference| Reference.new(node, scope).tap do |reference|
references << reference references << reference

View file

@ -15,7 +15,6 @@ module Ameba::AST
# ``` # ```
# visitor = Ameba::AST::NodeVisitor.new(rule, source) # visitor = Ameba::AST::NodeVisitor.new(rule, source)
# ``` # ```
#
def initialize(@rule, @source) def initialize(@rule, @source)
@source.ast.accept self @source.ast.accept self
end end

View file

@ -20,7 +20,6 @@ module Ameba::Formatter
# ExplainFormatter.new output, # ExplainFormatter.new output,
# {file: path, line: line_number, column: column_number} # {file: path, line: line_number, column: column_number}
# ``` # ```
#
def initialize(@output, loc) def initialize(@output, loc)
@location = Crystal::Location.new(loc[:file], loc[:line], loc[:column]) @location = Crystal::Location.new(loc[:file], loc[:line], loc[:column])
end end

View file

@ -7,7 +7,6 @@ module Ameba
# ``` # ```
# find_files_by_globs(["**/*.cr", "!lib"]) # find_files_by_globs(["**/*.cr", "!lib"])
# ``` # ```
#
def find_files_by_globs(globs) def find_files_by_globs(globs)
rejected = rejected_globs(globs) rejected = rejected_globs(globs)
selected = globs - rejected selected = globs - rejected
@ -20,7 +19,6 @@ module Ameba
# ``` # ```
# expand(["spec/*.cr", "src"]) # => all files in src folder + first level specs # expand(["spec/*.cr", "src"]) # => all files in src folder + first level specs
# ``` # ```
#
def expand(globs) def expand(globs)
globs.flat_map do |glob| globs.flat_map do |glob|
glob += "/**/*.cr" if File.directory?(glob) glob += "/**/*.cr" if File.directory?(glob)

View file

@ -36,7 +36,6 @@ module Ameba
# Time.epoch(1483859302) # Time.epoch(1483859302)
# end # end
# ``` # ```
#
def location_disabled?(location, rule) def location_disabled?(location, rule)
return false if rule.name.in?(Rule::SPECIAL) return false if rule.name.in?(Rule::SPECIAL)
return false unless line_number = location.try &.line_number.try &.- 1 return false unless line_number = location.try &.line_number.try &.- 1
@ -65,7 +64,6 @@ module Ameba
# line = "# # ameba:disable Rule1, Rule2" # line = "# # ameba:disable Rule1, Rule2"
# parse_inline_directive(line) # => nil # parse_inline_directive(line) # => nil
# ``` # ```
#
def parse_inline_directive(line) def parse_inline_directive(line)
if directive = COMMENT_DIRECTIVE_REGEX.match(line) if directive = COMMENT_DIRECTIVE_REGEX.match(line)
return if commented_out?(line.gsub(directive[0], "")) return if commented_out?(line.gsub(directive[0], ""))

View file

@ -50,7 +50,6 @@ module Ameba::Rule
# source = MyRule.new.catch(source) # source = MyRule.new.catch(source)
# source.valid? # source.valid?
# ``` # ```
#
def catch(source : Source) def catch(source : Source)
source.tap { |s| test s } source.tap { |s| test s }
end end
@ -65,7 +64,6 @@ module Ameba::Rule
# #
# MyRule.new.name # => "MyRule" # MyRule.new.name # => "MyRule"
# ``` # ```
#
def name def name
{{@type}}.rule_name {{@type}}.rule_name
end end
@ -79,7 +77,6 @@ module Ameba::Rule
# #
# MyGroup::MyRule.new.group # => "MyGroup" # MyGroup::MyRule.new.group # => "MyGroup"
# ``` # ```
#
def group def group
{{@type}}.group_name {{@type}}.group_name
end end
@ -91,7 +88,6 @@ module Ameba::Rule
# ``` # ```
# my_rule.excluded?(source) # => true or false # my_rule.excluded?(source) # => true or false
# ``` # ```
#
def excluded?(source) def excluded?(source)
excluded.try &.any? do |path| excluded.try &.any? do |path|
source.matches_path?(path) || source.matches_path?(path) ||
@ -105,7 +101,6 @@ module Ameba::Rule
# ``` # ```
# my_rule.special? # => true or false # my_rule.special? # => true or false
# ``` # ```
#
def special? def special?
name.in?(SPECIAL) name.in?(SPECIAL)
end end

View file

@ -38,7 +38,6 @@ module Ameba
# #
# Ameba::Runner.new config # Ameba::Runner.new config
# ``` # ```
#
def initialize(config : Config) def initialize(config : Config)
@sources = config.sources @sources = config.sources
@formatter = config.formatter @formatter = config.formatter
@ -64,7 +63,6 @@ module Ameba
# runner = Ameba::Runner.new config # runner = Ameba::Runner.new config
# runner.run # => returns runner again # runner.run # => returns runner again
# ``` # ```
#
def run def run
@formatter.started @sources @formatter.started @sources
channels = @sources.map { Channel(Exception?).new } channels = @sources.map { Channel(Exception?).new }
@ -112,7 +110,6 @@ module Ameba
# runner.run # runner.run
# runner.explain({file: file, line: l, column: c}) # runner.explain({file: file, line: l, column: c})
# ``` # ```
#
def explain(location, output = STDOUT) def explain(location, output = STDOUT)
Formatter::ExplainFormatter.new(output, location).finished @sources Formatter::ExplainFormatter.new(output, location).finished @sources
end end
@ -125,7 +122,6 @@ module Ameba
# runner.run # runner.run
# runner.success? # => true or false # runner.success? # => true or false
# ``` # ```
#
def success? def success?
@sources.all? do |source| @sources.all? do |source|
source.issues source.issues

View file

@ -23,7 +23,6 @@ module Ameba
# Severity.parse("convention") # => Severity::Convention # Severity.parse("convention") # => Severity::Convention
# Severity.parse("foo-bar") # => Exception: Incorrect severity name # Severity.parse("foo-bar") # => Exception: Incorrect severity name
# ``` # ```
#
def self.parse(name : String) def self.parse(name : String)
super name super name
rescue ArgumentError rescue ArgumentError

View file

@ -19,7 +19,6 @@ module Ameba
# path = "./src/source.cr" # path = "./src/source.cr"
# Ameba::Source.new File.read(path), path # Ameba::Source.new File.read(path), path
# ``` # ```
#
def initialize(@code, @path = "") def initialize(@code, @path = "")
end end

View file

@ -18,7 +18,6 @@ module Ameba
# source = Ameba::Source.new code, path # source = Ameba::Source.new code, path
# Ameba::Tokenizer.new(source) # Ameba::Tokenizer.new(source)
# ``` # ```
#
def initialize(source) def initialize(source)
@lexer = Crystal::Lexer.new source.code @lexer = Crystal::Lexer.new source.code
@lexer.count_whitespace = true @lexer.count_whitespace = true
@ -33,7 +32,6 @@ module Ameba
# lexer = Crystal::Lexer.new(code) # lexer = Crystal::Lexer.new(code)
# Ameba::Tokenizer.new(lexer) # Ameba::Tokenizer.new(lexer)
# ``` # ```
#
def initialize(@lexer : Crystal::Lexer) def initialize(@lexer : Crystal::Lexer)
end end
@ -44,7 +42,6 @@ module Ameba
# puts token # puts token
# end # end
# ``` # ```
#
def run(&block : Crystal::Token -> _) def run(&block : Crystal::Token -> _)
run_normal_state @lexer, &block run_normal_state @lexer, &block
true true