Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
gemfile: [Gemfile, gemfiles/minimum_rubocop.gemfile]
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ["3.1", "3.2", "3.3"]

env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
Expand Down
30 changes: 15 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
rubocop-shopify (2.15.1)
rubocop (~> 1.51)
rubocop (~> 1.62)

GEM
remote: https://rubygems.org/
Expand All @@ -12,12 +12,12 @@ GEM
byebug (11.1.3)
coderay (1.1.3)
diffy (3.4.3)
json (2.7.2)
language_server-protocol (3.17.0.3)
json (2.10.1)
language_server-protocol (3.17.0.4)
method_source (1.0.0)
minitest (5.25.4)
parallel (1.24.0)
parser (3.3.1.0)
parallel (1.26.3)
parser (3.3.7.1)
ast (~> 2.4.1)
racc
pry (0.14.2)
Expand All @@ -26,26 +26,26 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
racc (1.7.3)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.0)
rexml (3.2.6)
rubocop (1.63.4)
regexp_parser (2.10.0)
rubocop (1.71.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.38.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.0)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
unicode-display_width (2.5.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)

PLATFORMS
ruby
Expand Down
66 changes: 66 additions & 0 deletions bin/sort-cops
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'yaml'

def extract_cop_entries(content)
# Extract all cop configurations (entries that start with a department name)
cop_pattern = /^[A-Z][A-Za-z]+\/[A-Za-z]+:/
cops = {}

current_cop = nil
current_config = []

content.each_line do |line|
if line.match?(cop_pattern)
# Save previous cop if exists
if current_cop
cops[current_cop] = current_config.join
end

# Start new cop
current_cop = line.split(':').first
current_config = [line]
elsif current_cop
current_config << line
end
end

# Save last cop
if current_cop
cops[current_cop] = current_config.join
end

cops
end

def sort_cops(file_path)
content = File.read(file_path)

# Extract header (content before first cop)
first_cop_pattern = /^[A-Z][A-Za-z]+\/[A-Za-z]+:/
header_end = content.index(content.lines.find { |line| line.match?(first_cop_pattern) })
header = content[0...header_end]

# Extract and sort cops
cops = extract_cop_entries(content)
sorted_cops = cops.sort_by { |name, _| name }

# Generate new content
new_content = header

sorted_cops.each do |_, config|
new_content << config
end

# Write sorted content back to file
File.write(file_path, new_content)
end

if ARGV.empty?
puts "Usage: ruby sort_cops.rb path/to/rubocop.yml"
exit 1
end

sort_cops(ARGV[0])
puts "Successfully sorted cops in #{ARGV[0]}"
44 changes: 0 additions & 44 deletions rubocop-cli.yml

This file was deleted.

4 changes: 2 additions & 2 deletions rubocop-shopify.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
"allowed_push_host" => "https://rubygems.org",
}

s.required_ruby_version = ">= 3.0.0"
s.required_ruby_version = ">= 3.1.0"

s.add_dependency("rubocop", "~> 1.51")
s.add_dependency("rubocop", "~> 1.62")
end
Loading
Loading