diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-03-04 12:21:01 +0100 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-03-04 19:25:30 +0100 |
commit | a4c2a86fd9450e6824ed79a852ab1ab7ee45320e (patch) | |
tree | 13bd1f8d10820bda3f5c2d9cb54219d8505a2be5 | |
parent | d88d2b4e1a46706a14c8eb821c76aab2775209ff (diff) | |
download | bundler-a4c2a86fd9450e6824ed79a852ab1ab7ee45320e.tar.gz |
Auto-correct `Style/MutableConstant` rubocop offenses
-rw-r--r-- | .rubocop_todo.yml | 13 | ||||
-rw-r--r-- | lib/bundler/cli/doctor.rb | 4 | ||||
-rw-r--r-- | lib/bundler/lockfile_parser.rb | 4 | ||||
-rw-r--r-- | lib/bundler/ruby_version.rb | 2 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 4 | ||||
-rw-r--r-- | lib/bundler/yaml_serializer.rb | 4 | ||||
-rw-r--r-- | spec/support/matchers.rb | 2 |
7 files changed, 10 insertions, 23 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 013f193f74..9d99727107 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -473,19 +473,6 @@ Style/MultilineIfModifier: - 'lib/bundler/runtime.rb' - 'lib/bundler/source/rubygems.rb' -# Offense count: 10 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: literals, strict -Style/MutableConstant: - Exclude: - - 'lib/bundler/cli/doctor.rb' - - 'lib/bundler/lockfile_parser.rb' - - 'lib/bundler/ruby_version.rb' - - 'lib/bundler/settings.rb' - - 'lib/bundler/yaml_serializer.rb' - - 'spec/support/matchers.rb' - # Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. diff --git a/lib/bundler/cli/doctor.rb b/lib/bundler/cli/doctor.rb index 3e0898ff8a..6d038937c0 100644 --- a/lib/bundler/cli/doctor.rb +++ b/lib/bundler/cli/doctor.rb @@ -4,8 +4,8 @@ require "rbconfig" module Bundler class CLI::Doctor - DARWIN_REGEX = /\s+(.+) \(compatibility / - LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/ + DARWIN_REGEX = /\s+(.+) \(compatibility /.freeze + LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/.freeze attr_reader :options diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index cd42919da2..19084f12b9 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -23,7 +23,7 @@ module Bundler PATH = "PATH".freeze PLUGIN = "PLUGIN SOURCE".freeze SPECS = " specs:".freeze - OPTIONS = /^ ([a-z]+): (.*)$/i + OPTIONS = /^ ([a-z]+): (.*)$/i.freeze SOURCE = [GIT, GEM, PATH, PLUGIN].freeze SECTIONS_BY_VERSION_INTRODUCED = { @@ -183,7 +183,7 @@ module Bundler (?:-(.*))?\))? # Optional platform (!)? # Optional pinned marker $ # Line end - /xo + /xo.freeze def parse_dependency(line) return unless line =~ NAME_VERSION diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb index ebfdb1a086..80dc444f93 100644 --- a/lib/bundler/ruby_version.rb +++ b/lib/bundler/ruby_version.rb @@ -49,7 +49,7 @@ module Bundler ([\d.]+) # ruby version (?:p(-?\d+))? # optional patchlevel (?:\s\((\S+)\s(.+)\))? # optional engine info - /xo + /xo.freeze # Returns a RubyVersion from the given string. # @param [String] the version string to match. diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index ff9a5f57af..c9294ca801 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -421,7 +421,7 @@ module Bundler ) \2 # matching closing quote $ - }xo + }xo.freeze def load_config(config_file) return {} if !config_file || ignore_config? @@ -444,7 +444,7 @@ module Bundler (https?.*?) # URI (\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key \z - /ix + /ix.freeze # TODO: duplicates Rubygems#normalize_uri # TODO: is this the correct place to validate mirror URIs? diff --git a/lib/bundler/yaml_serializer.rb b/lib/bundler/yaml_serializer.rb index 0fd81c40ef..c9ab5a4907 100644 --- a/lib/bundler/yaml_serializer.rb +++ b/lib/bundler/yaml_serializer.rb @@ -32,7 +32,7 @@ module Bundler (.*) # value \1 # matching closing quote $ - /xo + /xo.freeze HASH_REGEX = / ^ @@ -45,7 +45,7 @@ module Bundler (.*) # value \3 # matching closing quote $ - /xo + /xo.freeze def load(str) res = {} diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index fb124b30cc..2e2c51edfa 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -60,7 +60,7 @@ module Spec end end - MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/ + MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/.freeze RSpec::Matchers.define :eq_err do |expected| diffable |