mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Line lenght: 80 symbols
This commit is contained in:
parent
374956f3dd
commit
1a3bb3629e
2 changed files with 5 additions and 5 deletions
|
@ -2,7 +2,7 @@ require "../../spec_helper"
|
|||
|
||||
module Ameba::Rules
|
||||
subject = LineLength.new
|
||||
long_line = "*" * 80
|
||||
long_line = "*" * 81
|
||||
|
||||
describe LineLength do
|
||||
it "passes if all lines are shorter than 80 symbols" do
|
||||
|
@ -11,7 +11,7 @@ module Ameba::Rules
|
|||
end
|
||||
|
||||
it "passes if line consists of 79 symbols" do
|
||||
source = Source.new "*" * 79
|
||||
source = Source.new "*" * 80
|
||||
subject.catch(source).should be_valid
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ module Ameba::Rules
|
|||
error = source.errors.first
|
||||
error.rule.should eq subject
|
||||
error.pos.should eq 1
|
||||
error.message.should eq "Line too long (80 symbols)"
|
||||
error.message.should eq "Line too long (81 symbols)"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
module Ameba::Rules
|
||||
# A rule that disallows lines longer than 79 symbols.
|
||||
# A rule that disallows lines longer than 80 symbols.
|
||||
#
|
||||
struct LineLength < Rule
|
||||
def test(source)
|
||||
source.lines.each_with_index do |line, index|
|
||||
next unless line.size > 79
|
||||
next unless line.size > 80
|
||||
source.error self, index + 1,
|
||||
"Line too long (#{line.size} symbols)"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue