From 3eb9c87d1e465df815fb8d98e6120769f7ca88c3 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Fri, 18 Sep 2020 20:18:17 +0530 Subject: [PATCH] Change cop name to RequireHardcodingLib The cop name, RelativeWithRelativePath, wasn't generic and wasn't clear enough by the name as to what this cop is trying to do. Therefore, renaming to RequireHardcodingLib. Signed-off-by: Utkarsh Gupta --- config/default.yml | 12 ++++++------ ...th_relative_path.rb => require_hardcoding_lib.rb} | 2 +- lib/rubocop/cop/packaging_cops.rb | 2 +- ...e_path_spec.rb => require_hardcoding_lib_spec.rb} | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) rename lib/rubocop/cop/packaging/{require_with_relative_path.rb => require_hardcoding_lib.rb} (98%) rename spec/rubocop/cop/packaging/{require_with_relative_path_spec.rb => require_hardcoding_lib_spec.rb} (98%) diff --git a/config/default.yml b/config/default.yml index 83505f2..7419c02 100644 --- a/config/default.yml +++ b/config/default.yml @@ -12,14 +12,14 @@ Packaging/GemspecGit: VersionAdded: '0.1' VersionChanged: '0.1' -Packaging/RequireRelativeHardcodingLib: - Description: 'Avoid using `require_relative` with relative path to lib.' +Packaging/RequireHardcodingLib: + Description: 'Avoid using `require` with relative path to lib.' Enabled: true - VersionAdded: '0.2' + VersionAdded: '0.4' VersionChanged: '0.5' -Packaging/RequireWithRelativePath: - Description: 'Avoid using `require` with relative path to lib.' +Packaging/RequireRelativeHardcodingLib: + Description: 'Avoid using `require_relative` with relative path to lib.' Enabled: true - VersionAdded: '0.4' + VersionAdded: '0.2' VersionChanged: '0.5' diff --git a/lib/rubocop/cop/packaging/require_with_relative_path.rb b/lib/rubocop/cop/packaging/require_hardcoding_lib.rb similarity index 98% rename from lib/rubocop/cop/packaging/require_with_relative_path.rb rename to lib/rubocop/cop/packaging/require_hardcoding_lib.rb index d9d004f..a7c7719 100644 --- a/lib/rubocop/cop/packaging/require_with_relative_path.rb +++ b/lib/rubocop/cop/packaging/require_hardcoding_lib.rb @@ -34,7 +34,7 @@ module Packaging # :nodoc: # # good # require "baz/qux" # - class RequireWithRelativePath < Base + class RequireHardcodingLib < Base include RuboCop::Packaging::LibHelperModule extend AutoCorrector diff --git a/lib/rubocop/cop/packaging_cops.rb b/lib/rubocop/cop/packaging_cops.rb index 1d4debe..03a20cf 100644 --- a/lib/rubocop/cop/packaging_cops.rb +++ b/lib/rubocop/cop/packaging_cops.rb @@ -2,5 +2,5 @@ require_relative "packaging/bundler_setup_in_tests" require_relative "packaging/gemspec_git" +require_relative "packaging/require_hardcoding_lib" require_relative "packaging/require_relative_hardcoding_lib" -require_relative "packaging/require_with_relative_path" diff --git a/spec/rubocop/cop/packaging/require_with_relative_path_spec.rb b/spec/rubocop/cop/packaging/require_hardcoding_lib_spec.rb similarity index 98% rename from spec/rubocop/cop/packaging/require_with_relative_path_spec.rb rename to spec/rubocop/cop/packaging/require_hardcoding_lib_spec.rb index 1a652af..6a1593b 100644 --- a/spec/rubocop/cop/packaging/require_with_relative_path_spec.rb +++ b/spec/rubocop/cop/packaging/require_hardcoding_lib_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -RSpec.describe RuboCop::Cop::Packaging::RequireWithRelativePath, :config do - let(:message) { RuboCop::Cop::Packaging::RequireWithRelativePath::MSG } +RSpec.describe RuboCop::Cop::Packaging::RequireHardcodingLib, :config do + let(:message) { RuboCop::Cop::Packaging::RequireHardcodingLib::MSG } let(:project_root) { RuboCop::ConfigLoader.project_root }