mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Readability-related refactors
This commit is contained in:
parent
a6ebb48f14
commit
e668ba5bf5
24 changed files with 89 additions and 61 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue