Skip to content

Commit 45c2884

Browse files
authored
Merge pull request #234 from mamhoff/standardrb
Switch to standardrb
2 parents ac54042 + 9181f3c commit 45c2884

25 files changed

+235
-510
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# .git-blame-ignore-revs
2+
# Convert to standardrb
3+
e466db2b9cf9ae6f8b905bedb758228204ee80ab

.rubocop-https---relaxed-ruby-style-rubocop-yml

Lines changed: 0 additions & 153 deletions
This file was deleted.

.rubocop.yml

Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,8 @@
1-
inherit_from:
2-
- https://relaxed.ruby.style/rubocop.yml
1+
require:
2+
- standard
33

4-
Gemspec/RequiredRubyVersion:
5-
Enabled: false
6-
Layout/EmptyLinesAroundAttributeAccessor:
7-
Enabled: true
8-
Layout/SpaceAroundMethodCallOperator:
9-
Enabled: true
10-
Lint/DeprecatedOpenSSLConstant:
11-
Enabled: true
12-
Lint/MixedRegexpCaptureTypes:
13-
Enabled: true
14-
Lint/RaiseException:
15-
Enabled: true
16-
Lint/StructNewOverride:
17-
Enabled: true
18-
Style/AccessorGrouping:
19-
Enabled: true
20-
Style/BisectedAttrAccessor:
21-
Enabled: true
22-
Style/ExponentialNotation:
23-
Enabled: true
24-
Style/HashEachMethods:
25-
Enabled: true
26-
Style/HashTransformKeys:
27-
Enabled: true
28-
Style/HashTransformValues:
29-
Enabled: true
30-
Style/RedundantAssignment:
31-
Enabled: true
32-
Style/RedundantFetchBlock:
33-
Enabled: true
34-
Style/RedundantRegexpCharacterClass:
35-
Enabled: true
36-
Style/RedundantRegexpEscape:
37-
Enabled: true
38-
Style/SlicingWithRange:
39-
Enabled: true
40-
41-
# Disable this cop until this isssue gets a clear answer:
42-
# https://github.com/rubocop/rubocop/issues/10675
43-
Gemspec/DeprecatedAttributeAssignment:
44-
Enabled: false
4+
inherit_gem:
5+
standard: config/base.yml
456

467
AllCops:
478
TargetRubyVersion: 3.0
48-
Exclude:
49-
- tmp/**/*
50-
- "vendor/**/*"
51-
# Generated binstubs
52-
- bin/rake
53-
NewCops: enable
54-
55-
Style/FrozenStringLiteralComment:
56-
Exclude:
57-
- "**/bin/*"
58-
- "**/exe/*"
59-
- "spec/**/*"

.standard.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parallel: true # default: false
2+
format: progress # default: Standard::Formatter

Gemfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
77
# Specify your gem's dependencies in solidus_dev_support.gemspec
88
gemspec
99

10-
branch = ENV.fetch('SOLIDUS_BRANCH', 'main')
11-
gem 'solidus', github: 'solidusio/solidus', branch: branch
10+
branch = ENV.fetch("SOLIDUS_BRANCH", "main")
11+
gem "solidus", github: "solidusio/solidus", branch: branch
1212

1313
rails_version = ENV.fetch("RAILS_VERSION", "7.0")
14-
gem 'rails', "~> #{rails_version}"
14+
gem "rails", "~> #{rails_version}"
1515

16-
gem 'bundler'
17-
gem 'rake'
16+
gem "bundler"
17+
gem "rake"
1818

1919
# These gems will be used by the temporary extensions generated by tests
2020
group :test do
21-
gem 'mysql2'
22-
gem 'pg'
23-
gem 'solidus_auth_devise'
24-
gem 'sqlite3', rails_version < '7.2' ? '~> 1.4' : '~> 2.0'
21+
gem "mysql2"
22+
gem "pg"
23+
gem "solidus_auth_devise"
24+
gem "sqlite3", (rails_version < "7.2") ? "~> 1.4" : "~> 2.0"
2525
end
2626

2727
# Use a local Gemfile to include development dependencies that might not be
2828
# relevant for the project or for other contributors, e.g.: `gem 'pry-debug'`.
29-
eval_gemfile 'Gemfile-local' if File.exist? 'Gemfile-local'
29+
eval_gemfile "Gemfile-local" if File.exist? "Gemfile-local"
3030

3131
if rails_version == "7.0"
32-
gem 'concurrent-ruby', '< 1.3.5'
32+
gem "concurrent-ruby", "< 1.3.5"
3333
end

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ jobs:
168168
### RuboCop configuration
169169
170170
solidus_dev_support includes a default [RuboCop](https://github.com/rubocop-hq/rubocop)
171-
configuration for Solidus extensions. Currently, this is based on
172-
[Relaxed Ruby Style](https://relaxed.ruby.style) with a few customizations, but in the future we
173-
plan to provide custom cops to ensure your extension follows established Solidus best practices.
171+
configuration for Solidus extensions. This configuration is based on the excellent [`standardrb`](https://github.com/standardrb/standard) gem.
174172

175173
We strongly recommend including the RuboCop configuration in your extension. All you have to do is
176174
add this to your `.rubocop.yml`:

bin/setup

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env ruby
2-
require 'fileutils'
2+
require "fileutils"
33
include FileUtils # rubocop:disable Style/MixinUsage
44

5-
GEM_ROOT = File.expand_path('..', __dir__)
5+
GEM_ROOT = File.expand_path("..", __dir__)
66

77
def system(*args)
8-
puts "$ #{args.size == 1 ? args.first : args.shelljoin}"
8+
puts "$ #{(args.size == 1) ? args.first : args.shelljoin}"
99
super
1010
end
1111

@@ -16,5 +16,5 @@ end
1616
cd GEM_ROOT
1717

1818
puts "\n== Installing Ruby dependencies =="
19-
system! %{gem install bundler --conservative}
20-
system! %{bundle check || bundle install}
19+
system! %(gem install bundler --conservative)
20+
system! %(bundle check || bundle install)

bin/solidus

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env ruby
22

3-
require 'bundler/setup'
3+
require "bundler/setup"
44
load "#{__dir__}/../exe/solidus"

exe/solidus

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
require 'solidus_dev_support/solidus_command'
4+
require "solidus_dev_support/solidus_command"
55

66
SolidusDevSupport::SolidusCommand.start

lib/solidus_dev_support.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Error < StandardError; end
77

88
class << self
99
def reset_spree_preferences_deprecated?
10-
first_version_without_reset = Gem::Requirement.new('>= 2.9')
10+
first_version_without_reset = Gem::Requirement.new(">= 2.9")
1111
first_version_without_reset.satisfied_by?(Spree.solidus_gem_version)
1212
end
1313
end

0 commit comments

Comments
 (0)