rubocop-shopify 2.15.0 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1418 -0
- data/lib/rubocop/shopify/gem_version_string_comparable_backport.rb +28 -0
- data/lib/tasks/config.rake +30 -0
- metadata +5 -2
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This is true for Ruby 3.2+, so once support for 3.1 is dropped, we can remove this.
|
4
|
+
# Until then, some installations may have a recent enough version of RubyGems, but it is not guaranteed.
|
5
|
+
return if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("3.5.6")
|
6
|
+
|
7
|
+
module RuboCop
|
8
|
+
module Shopify
|
9
|
+
# Backport rubygems/rubygems#5275, so we can compare `Gem::Version`s directly against `String`s.
|
10
|
+
#
|
11
|
+
# Gem::Version.new("1.2.3") > "1.2"
|
12
|
+
#
|
13
|
+
# Without this, to support Ruby < 3.2, we would have to create a new `Gem::Version` instance ourselves.
|
14
|
+
#
|
15
|
+
# Gem::Version.new("1.2.3") > Gem::Version.new("1.2")
|
16
|
+
#
|
17
|
+
# This would get very verbose in our RuboCop config files.
|
18
|
+
module GemVersionStringComparableBackport
|
19
|
+
def <=>(other)
|
20
|
+
return self <=> self.class.new(other) if (String === other) && self.class.correct?(other)
|
21
|
+
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
Gem::Version.prepend(self)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop"
|
4
|
+
|
5
|
+
namespace :config do
|
6
|
+
desc "Dump the full RuboCop config as a YAML file for testing"
|
7
|
+
task :dump, [:target] do |_task, args|
|
8
|
+
file = "rubocop.yml"
|
9
|
+
target = args.fetch(:target, "test/fixtures/full_config.yml")
|
10
|
+
|
11
|
+
file_config = RuboCop::ConfigLoader.load_file(file)
|
12
|
+
config = RuboCop::ConfigLoader.merge_with_default(file_config, file)
|
13
|
+
output = config.to_h.to_yaml.gsub(config.base_dir_for_path_parameters, "")
|
14
|
+
|
15
|
+
# Removing trailing whitespaces from each line due to older libyaml versions
|
16
|
+
# converting nil hash values into whitespaces. GitHub actions is still stuck
|
17
|
+
# with libyaml < 0.2.5. This line can be removed once it is upgraded. Psych
|
18
|
+
# can be used to check for the running libyaml version:
|
19
|
+
#
|
20
|
+
# ```ruby
|
21
|
+
# require "psych"
|
22
|
+
# puts Psych::LIBYAML_VERSION
|
23
|
+
# ```
|
24
|
+
#
|
25
|
+
# For more info, see: https://github.com/yaml/libyaml/pull/186
|
26
|
+
output.gsub!(/\s\n/, "\n")
|
27
|
+
|
28
|
+
File.write(target, output)
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-shopify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.15.
|
4
|
+
version: 2.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify Engineering
|
@@ -32,13 +32,16 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- LICENSE.md
|
35
|
+
- README.md
|
36
|
+
- lib/rubocop/shopify/gem_version_string_comparable_backport.rb
|
37
|
+
- lib/tasks/config.rake
|
35
38
|
- rubocop-cli.yml
|
36
39
|
- rubocop.yml
|
37
40
|
homepage: https://shopify.github.io/ruby-style-guide/
|
38
41
|
licenses:
|
39
42
|
- MIT
|
40
43
|
metadata:
|
41
|
-
source_code_uri: https://github.com/Shopify/ruby-style-guide/tree/v2.15.
|
44
|
+
source_code_uri: https://github.com/Shopify/ruby-style-guide/tree/v2.15.1
|
42
45
|
allowed_push_host: https://rubygems.org
|
43
46
|
post_install_message:
|
44
47
|
rdoc_options: []
|