From fbd658c07e3b67712723f057d6a7ef85b4c05a13 Mon Sep 17 00:00:00 2001 From: Mu-An Chiou Date: Tue, 29 Jan 2019 17:52:11 -0500 Subject: [PATCH 1/2] Update custom linter demo, following #69 --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ca9b63c2..dd25c0a3 100644 --- a/README.md +++ b/README.md @@ -395,16 +395,14 @@ module ERBLint end self.config_schema = ConfigSchema - def offenses(processed_source) - errors = [] + def run(processed_source) unless processed_source.file_content.include?('this file is fine') - errors << Offense.new( + add_offense( self, processed_source.to_source_range(0 ... processed_source.file_content.size), "This file isn't fine. #{@config.custom_message}" ) end - errors end end end From 029bc464f33c01a5229ceb2db144c0872fcc0b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E5=AE=89?= Date: Wed, 30 Jan 2019 12:42:31 -0500 Subject: [PATCH 2/2] remove self --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index dd25c0a3..d6eba2aa 100644 --- a/README.md +++ b/README.md @@ -398,8 +398,7 @@ module ERBLint def run(processed_source) unless processed_source.file_content.include?('this file is fine') add_offense( - self, - processed_source.to_source_range(0 ... processed_source.file_content.size), + processed_source.to_source_range(0...processed_source.file_content.size), "This file isn't fine. #{@config.custom_message}" ) end