mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Bump default value of LargeNumbers#int_min_digits
to 6
As most of the error codes are smaller than 6 digits
This commit is contained in:
parent
276b429e70
commit
1795bd2959
2 changed files with 7 additions and 6 deletions
|
@ -6,6 +6,7 @@ module Ameba
|
||||||
private def it_transforms(number, expected)
|
private def it_transforms(number, expected)
|
||||||
it "transforms large number #{number}" do
|
it "transforms large number #{number}" do
|
||||||
rule = Rule::Style::LargeNumbers.new
|
rule = Rule::Style::LargeNumbers.new
|
||||||
|
rule.int_min_digits = 5
|
||||||
|
|
||||||
source = expect_issue rule, <<-CRYSTAL, number: number
|
source = expect_issue rule, <<-CRYSTAL, number: number
|
||||||
number = %{number}
|
number = %{number}
|
||||||
|
|
|
@ -6,17 +6,17 @@ module Ameba::Rule::Style
|
||||||
# For example, these are considered invalid:
|
# For example, these are considered invalid:
|
||||||
#
|
#
|
||||||
# ```
|
# ```
|
||||||
# 10000
|
# 100000
|
||||||
# 141592654
|
# 141592654
|
||||||
# 5.12345
|
# 5.123456
|
||||||
# ```
|
# ```
|
||||||
#
|
#
|
||||||
# And has to be rewritten as the following:
|
# And has to be rewritten as the following:
|
||||||
#
|
#
|
||||||
# ```
|
# ```
|
||||||
# 10_000
|
# 100_000
|
||||||
# 141_592_654
|
# 141_592_654
|
||||||
# 5.123_45
|
# 5.123_456
|
||||||
# ```
|
# ```
|
||||||
#
|
#
|
||||||
# YAML configuration example:
|
# YAML configuration example:
|
||||||
|
@ -24,13 +24,13 @@ module Ameba::Rule::Style
|
||||||
# ```
|
# ```
|
||||||
# Style/LargeNumbers:
|
# Style/LargeNumbers:
|
||||||
# Enabled: true
|
# Enabled: true
|
||||||
# IntMinDigits: 5 # i.e. integers higher than 9999
|
# IntMinDigits: 6 # i.e. integers higher than 99999
|
||||||
# ```
|
# ```
|
||||||
class LargeNumbers < Base
|
class LargeNumbers < Base
|
||||||
properties do
|
properties do
|
||||||
enabled true
|
enabled true
|
||||||
description "Disallows usage of large numbers without underscore"
|
description "Disallows usage of large numbers without underscore"
|
||||||
int_min_digits 5
|
int_min_digits 6
|
||||||
end
|
end
|
||||||
|
|
||||||
MSG = "Large numbers should be written with underscores: %s"
|
MSG = "Large numbers should be written with underscores: %s"
|
||||||
|
|
Loading…
Reference in a new issue