From 1a3bb3629e4400c5a49f8cbbb436b665070592be Mon Sep 17 00:00:00 2001 From: Vitalii Elenhaupt Date: Mon, 6 Nov 2017 08:54:59 +0200 Subject: [PATCH] Line lenght: 80 symbols --- spec/ameba/rules/line_length_spec.cr | 6 +++--- src/ameba/rules/line_length.cr | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/ameba/rules/line_length_spec.cr b/spec/ameba/rules/line_length_spec.cr index b34bde5c..cdf19676 100644 --- a/spec/ameba/rules/line_length_spec.cr +++ b/spec/ameba/rules/line_length_spec.cr @@ -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 diff --git a/src/ameba/rules/line_length.cr b/src/ameba/rules/line_length.cr index 3d6e2c0d..150a8045 100644 --- a/src/ameba/rules/line_length.cr +++ b/src/ameba/rules/line_length.cr @@ -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