mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Merge branch 'master' into develop
This commit is contained in:
commit
58d7775d65
6 changed files with 19 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
name: ameba
|
name: ameba
|
||||||
version: 0.14.1
|
version: 0.14.2
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- Vitalii Elenhaupt <velenhaupt@gmail.com>
|
- Vitalii Elenhaupt <velenhaupt@gmail.com>
|
||||||
|
|
|
@ -26,6 +26,15 @@ module Ameba::Rule::Style
|
||||||
subject.catch(source).should_not be_valid
|
subject.catch(source).should_not be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not report if there .is_a? call within block with multiple arguments" do
|
||||||
|
source = Source.new %(
|
||||||
|
t.all? { |_, v| v.is_a?(String) }
|
||||||
|
t.all? { |foo, bar| foo.is_a?(String) }
|
||||||
|
t.all? { |foo, bar| bar.is_a?(String) }
|
||||||
|
)
|
||||||
|
subject.catch(source).should be_valid
|
||||||
|
end
|
||||||
|
|
||||||
context "properties" do
|
context "properties" do
|
||||||
it "allows to configure filter_names" do
|
it "allows to configure filter_names" do
|
||||||
source = Source.new %(
|
source = Source.new %(
|
||||||
|
|
|
@ -92,6 +92,7 @@ module Ameba::Rule::Style
|
||||||
.catch(source).should be_valid
|
.catch(source).should be_valid
|
||||||
rule
|
rule
|
||||||
.tap(&.exclude_prefix_operators = false)
|
.tap(&.exclude_prefix_operators = false)
|
||||||
|
.tap(&.exclude_operators = false)
|
||||||
.catch(source).should_not be_valid
|
.catch(source).should_not be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -190,7 +191,10 @@ module Ameba::Rule::Style
|
||||||
(1..3).map { |i| i.in?(1, *foo, 3, **bar) }
|
(1..3).map { |i| i.in?(1, *foo, 3, **bar) }
|
||||||
(1..3).join(separator: '.') { |i| i.to_s }
|
(1..3).join(separator: '.') { |i| i.to_s }
|
||||||
)
|
)
|
||||||
subject.catch(source).should_not be_valid
|
rule = VerboseBlock.new
|
||||||
|
rule
|
||||||
|
.tap(&.exclude_operators = false)
|
||||||
|
.catch(source).should_not be_valid
|
||||||
source.issues.size.should eq(short_block_variants.size)
|
source.issues.size.should eq(short_block_variants.size)
|
||||||
|
|
||||||
source.issues.each_with_index do |issue, i|
|
source.issues.each_with_index do |issue, i|
|
||||||
|
|
|
@ -24,6 +24,7 @@ module Ameba::Rule::Performance
|
||||||
# ```
|
# ```
|
||||||
class MapInsteadOfBlock < Base
|
class MapInsteadOfBlock < Base
|
||||||
properties do
|
properties do
|
||||||
|
enabled false
|
||||||
description "Identifies usage of `join/sum/product` calls that follow `map`."
|
description "Identifies usage of `join/sum/product` calls that follow `map`."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ module Ameba::Rule::Style
|
||||||
return unless (body = block.body).is_a?(Crystal::IsA)
|
return unless (body = block.body).is_a?(Crystal::IsA)
|
||||||
return unless (path = body.const).is_a?(Crystal::Path)
|
return unless (path = body.const).is_a?(Crystal::Path)
|
||||||
return unless body.obj.is_a?(Crystal::Var)
|
return unless body.obj.is_a?(Crystal::Var)
|
||||||
|
return if block.args.size > 1
|
||||||
|
|
||||||
name = path.names.join("::")
|
name = path.names.join("::")
|
||||||
name = "::#{name}" if path.global? && !body.nil_check?
|
name = "::#{name}" if path.global? && !body.nil_check?
|
||||||
|
|
|
@ -22,7 +22,7 @@ module Ameba::Rule::Style
|
||||||
# ExcludeMultipleLineBlocks: true
|
# ExcludeMultipleLineBlocks: true
|
||||||
# ExcludeCallsWithBlocks: true
|
# ExcludeCallsWithBlocks: true
|
||||||
# ExcludePrefixOperators: true
|
# ExcludePrefixOperators: true
|
||||||
# ExcludeOperators: false
|
# ExcludeOperators: true
|
||||||
# ExcludeSetters: false
|
# ExcludeSetters: false
|
||||||
# MaxLineLength: ~
|
# MaxLineLength: ~
|
||||||
# MaxLength: 50 # use ~ to disable
|
# MaxLength: 50 # use ~ to disable
|
||||||
|
@ -34,7 +34,7 @@ module Ameba::Rule::Style
|
||||||
exclude_multiple_line_blocks true
|
exclude_multiple_line_blocks true
|
||||||
exclude_calls_with_block true
|
exclude_calls_with_block true
|
||||||
exclude_prefix_operators true
|
exclude_prefix_operators true
|
||||||
exclude_operators false
|
exclude_operators true
|
||||||
exclude_setters false
|
exclude_setters false
|
||||||
|
|
||||||
max_line_length : Int32? = nil # 100
|
max_line_length : Int32? = nil # 100
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue