diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /rubocop/cop/filename_length.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'rubocop/cop/filename_length.rb')
-rw-r--r-- | rubocop/cop/filename_length.rb | 8 |
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 |