Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'rubocop/cop/filename_length.rb')
-rw-r--r--rubocop/cop/filename_length.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/rubocop/cop/filename_length.rb b/rubocop/cop/filename_length.rb
index 815db7de3f5..948f69cc88c 100644
--- a/rubocop/cop/filename_length.rb
+++ b/rubocop/cop/filename_length.rb
@@ -2,7 +2,7 @@
module RuboCop
module Cop
- class FilenameLength < Cop
+ class FilenameLength < RuboCop::Cop::Base
include RangeHelp
FILEPATH_MAX_BYTES = 256
@@ -10,14 +10,14 @@ module RuboCop
MSG_FILEPATH_LEN = "This file path is too long. It should be #{FILEPATH_MAX_BYTES} or less"
MSG_FILENAME_LEN = "This file name is too long. It should be #{FILENAME_MAX_BYTES} or less"
- def investigate(processed_source)
+ def on_new_investigation
file_path = processed_source.file_path
return if config.file_to_exclude?(file_path)
if file_path.bytesize > FILEPATH_MAX_BYTES
- add_offense(nil, location: source_range(processed_source.buffer, 1, 0, 1), message: MSG_FILEPATH_LEN)
+ add_offense(source_range(processed_source.buffer, 1, 0), message: MSG_FILEPATH_LEN)
elsif File.basename(file_path).bytesize > FILENAME_MAX_BYTES
- add_offense(nil, location: source_range(processed_source.buffer, 1, 0, 1), message: MSG_FILENAME_LEN)
+ add_offense(source_range(processed_source.buffer, 1, 0), message: MSG_FILENAME_LEN)
end
end
end