struct Ameba::Rule::Lint::PercentArrays

Overview

A rule that disallows some unwanted symbols in percent array literals.

For example, this is usually written by mistake:

%i(:one, :two)
%w("one", "two")

And the expected example is:

%i(one two)
%w(one two)

YAML configuration example:

Lint/PercentArrays:
  Enabled: true
  StringArrayUnwantedSymbols: ',"'
  SymbolArrayUnwantedSymbols: ',:'

Defined in:

ameba/rule/lint/percent_array.cr

Constant Summary

MSG = "Symbols `%s` may be unwanted in %s array literals"

Constructors

Instance Method Summary

Instance methods inherited from struct Ameba::Rule::Base

catch(source : Source) catch, excluded?(source) excluded?, group group, initialize initialize, name name, special? special?, test(source : Source, node : Crystal::ASTNode, *opts)
test(source : Source)
test

Constructor methods inherited from struct Ameba::Rule::Base

new new

Class methods inherited from struct Ameba::Rule::Base

parsed_doc parsed_doc

Constructor Detail

def self.new(config = nil) #

A rule that disallows some unwanted symbols in percent array literals.

For example, this is usually written by mistake:

%i(:one, :two)
%w("one", "two")

And the expected example is:

%i(one two)
%w(one two)

YAML configuration example:

Lint/PercentArrays:
  Enabled: true
  StringArrayUnwantedSymbols: ',"'
  SymbolArrayUnwantedSymbols: ',:'

[View source]

Instance Method Detail

def test(source) #

[View source]