Readability-related refactors

This commit is contained in:
Sijawusz Pur Rahnama 2022-11-14 01:24:29 +01:00
parent a6ebb48f14
commit e668ba5bf5
24 changed files with 89 additions and 61 deletions

View file

@ -191,7 +191,7 @@ module Ameba::AST
it "returns true if node is nested to Crystal::Macro" do
nodes = as_nodes %(
macro included
{{@type.each do |type| a = type end}}
{{ @type.each do |type| a = type end }}
end
)
outer_scope = Scope.new nodes.macro_nodes.first

View file

@ -40,7 +40,9 @@ module Ameba
---
Globs: 100
CONFIG
expect_raises(Exception, "incorrect 'Globs' section in a config file") { Config.new(yml) }
expect_raises(Exception, "Incorrect 'Globs' section in a config file") do
Config.new(yml)
end
end
it "initializes excluded as string" do
@ -68,7 +70,9 @@ module Ameba
---
Excluded: true
CONFIG
expect_raises(Exception, "incorrect 'Excluded' section in a config file") { Config.new(yml) }
expect_raises(Exception, "Incorrect 'Excluded' section in a config file") do
Config.new(yml)
end
end
end

View file

@ -211,11 +211,13 @@ module Ameba::Rule::Lint
end
def bar
{{@type.instance_vars.map do |ivar|
{{
@type.instance_vars.map do |ivar|
ivar.annotations(Name).each do |ann|
puts ann.args
end
end}}
end
}}
end
end
end

View file

@ -218,11 +218,11 @@ module Ameba::Rule::Lint
s = Source.new %(
record X do
macro foo(a, b)
{{a}} + {{b}}
{{ a }} + {{ b }}
end
macro bar(a, b, c)
{{a}} + {{b}} + {{c}}
{{ a }} + {{ b }} + {{ c }}
end
end
)

View file

@ -949,7 +949,7 @@ module Ameba::Rule::Lint
foo = 22
{% for x in %w(foo) %}
add({{x.id}})
add({{ x.id }})
{% end %}
)
subject.catch(s).should be_valid