Skip to content

Commit b92ef4b

Browse files
authored
chore: add standardrb (#512)
* chore: test rails 8.0 explicitly * chore: add mutex_m as a dependency * chore: autocorrect hash spacing * chore: autocorrect string literals
1 parent 9a96300 commit b92ef4b

File tree

105 files changed

+1234
-1111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+1234
-1111
lines changed

.github/workflows/ruby.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
]
2424
experimental: [false]
2525
include:
26-
- ruby: "3.3"
26+
- ruby: "3.4.0-preview2"
2727
os: ubuntu-latest
28-
gemfile: Gemfile-rails-edge
28+
gemfile: "Gemfile-rails.8.0.x"
2929
experimental: true
30-
- ruby: "3.4.0-preview1"
30+
- ruby: "3.4.0-preview2"
3131
os: ubuntu-latest
3232
gemfile: Gemfile-rails-edge
3333
experimental: true

.rubocop.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
inherit_from: .rubocop_todo.yml
22

33
require:
4+
- standard
45
- rubocop-performance
56
- rubocop-minitest
67

8+
inherit_gem:
9+
standard: config/ruby-3.0.yml
10+
711
inherit_mode:
812
merge:
913
- Exclude
1014

1115
AllCops:
16+
TargetRubyVersion: 3.0
17+
SuggestExtensions: false
18+
NewCops: enable
1219
Exclude:
1320
- "node_modules/**/*"
1421
- "**/*/node_modules/**/*"
@@ -18,15 +25,10 @@ AllCops:
1825
- "vendor/bundle"
1926
- "tmp/**/*"
2027
- "test/mounted_app/test/dummy/bin/*"
21-
TargetRubyVersion: 2.5
2228

2329
Style/IfUnlessModifier:
2430
Enabled: false
2531

26-
Lint/UnusedMethodArgument:
27-
Exclude:
28-
- "vite_rails/lib/vite_rails/tag_helpers.rb"
29-
3032
Style/RescueModifier:
3133
Enabled: false
3234

@@ -39,6 +41,12 @@ Style/GuardClause:
3941
Style/MultilineBlockChain:
4042
Enabled: false
4143

44+
Style/HashEachMethods:
45+
Enabled: false
46+
47+
Layout/LineLength:
48+
Enabled: false
49+
4250
Layout/ElseAlignment:
4351
Enabled: false
4452

@@ -51,6 +59,9 @@ Layout/IndentationWidth:
5159
Gemspec/RequiredRubyVersion:
5260
Enabled: false
5361

62+
Gemspec/DevelopmentDependencies:
63+
Enabled: false
64+
5465
Layout/IndentationConsistency:
5566
Enabled: false
5667

@@ -69,9 +80,6 @@ Style/Documentation:
6980
Naming/RescuedExceptionsVariableName:
7081
PreferredName: error
7182

72-
Layout/SpaceInsideStringInterpolation:
73-
EnforcedStyle: space
74-
7583
Layout/MultilineMethodCallIndentation:
7684
EnforcedStyle: indented
7785

@@ -93,6 +101,12 @@ Style/MissingRespondToMissing:
93101
Style/ParallelAssignment:
94102
Enabled: false
95103

104+
Style/FetchEnvVar:
105+
Enabled: false
106+
107+
Style/SuperWithArgsParentheses:
108+
Enabled: false
109+
96110
Style/TrailingCommaInArrayLiteral:
97111
EnforcedStyleForMultiline: comma
98112

@@ -149,3 +163,13 @@ Security/YAMLLoad:
149163

150164
Style/MutableConstant:
151165
Enabled: false
166+
167+
Minitest/MultipleAssertions:
168+
Enabled: false
169+
170+
Minitest/AssertRaisesWithRegexpArgument:
171+
Enabled: false
172+
173+
Minitest/UselessAssertion:
174+
Exclude:
175+
- test/helper_test.rb

.rubocop_todo.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-10-30 16:53:53 UTC using RuboCop version 1.28.2.
3+
# on 2024-11-05 13:37:33 UTC using RuboCop version 1.66.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 46
10-
# This cop supports safe auto-correction (--auto-correct).
11-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
12-
# URISchemes: http, https
13-
Layout/LineLength:
14-
Max: 222
9+
# Offense count: 1
10+
# Configuration parameters: AllowComments, AllowEmptyLambdas.
11+
Lint/EmptyBlock:
12+
Exclude:
13+
- 'test/mounted_app/test/dummy/config/initializers/content_security_policy.rb'
14+
15+
# Offense count: 1
16+
# Configuration parameters: AllowComments.
17+
Lint/EmptyClass:
18+
Exclude:
19+
- 'test/test_app/config/application.rb'

Gemfile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44

5-
gem 'rails'
5+
gem "rails"
66

7-
gemspec path: './vite_ruby'
8-
gemspec path: './vite_rails'
9-
gemspec path: './vite_plugin_legacy'
7+
gemspec path: "./vite_ruby"
8+
gemspec path: "./vite_rails"
9+
gemspec path: "./vite_plugin_legacy"
1010

1111
group :development, :test do
12-
gem 'benchmark-ips'
13-
gem 'rubocop', '~> 1.9'
14-
gem 'rubocop-minitest', '~> 0.10'
15-
gem 'rubocop-performance', '~> 1.9'
12+
gem "benchmark-ips"
13+
gem "rubocop"
14+
gem "rubocop-minitest"
15+
gem "rubocop-performance"
16+
gem "standard", require: false
1617
end

Gemfile.lock

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ PATH
1717
vite_ruby (3.9.0)
1818
dry-cli (>= 0.7, < 2)
1919
logger (~> 1.6)
20+
mutex_m
2021
rack-proxy (~> 0.6, >= 0.6.1)
2122
zeitwerk (~> 2.2)
2223

@@ -110,19 +111,21 @@ GEM
110111
date (3.3.3)
111112
docile (1.4.0)
112113
drb (2.2.1)
113-
dry-cli (1.1.0)
114+
dry-cli (1.2.0)
114115
erubi (1.13.0)
115116
globalid (1.2.1)
116117
activesupport (>= 6.1)
117-
i18n (1.14.5)
118+
i18n (1.14.6)
118119
concurrent-ruby (~> 1.0)
119120
io-console (0.7.2)
120-
irb (1.14.0)
121+
irb (1.14.1)
121122
rdoc (>= 4.0.0)
122123
reline (>= 0.4.2)
123-
json (2.6.3)
124+
json (2.7.6)
125+
language_server-protocol (3.17.0.3)
126+
lint_roller (1.1.0)
124127
logger (1.6.1)
125-
loofah (2.22.0)
128+
loofah (2.23.1)
126129
crass (~> 1.0.2)
127130
nokogiri (>= 1.12.0)
128131
m (1.6.2)
@@ -159,7 +162,7 @@ GEM
159162
mini_portile2 (~> 2.8.2)
160163
racc (~> 1.4)
161164
parallel (1.26.3)
162-
parser (3.3.5.0)
165+
parser (3.3.6.0)
163166
ast (~> 2.4.1)
164167
racc
165168
pry (0.14.2)
@@ -171,16 +174,15 @@ GEM
171174
psych (5.1.2)
172175
stringio
173176
racc (1.8.1)
174-
rack (3.1.7)
177+
rack (3.1.8)
175178
rack-proxy (0.7.7)
176179
rack
177180
rack-session (2.0.0)
178181
rack (>= 3.0.0)
179182
rack-test (2.1.0)
180183
rack (>= 1.3)
181-
rackup (2.1.0)
184+
rackup (2.2.0)
182185
rack (>= 3)
183-
webrick (~> 1.8)
184186
rails (7.1.0)
185187
actioncable (= 7.1.0)
186188
actionmailbox (= 7.1.0)
@@ -217,37 +219,48 @@ GEM
217219
regexp_parser (2.9.2)
218220
reline (0.5.10)
219221
io-console (~> 0.5)
220-
rexml (3.3.9)
221-
rubocop (1.28.2)
222+
rubocop (1.66.1)
223+
json (~> 2.3)
224+
language_server-protocol (>= 3.17.0)
222225
parallel (~> 1.10)
223-
parser (>= 3.1.0.0)
226+
parser (>= 3.3.0.2)
224227
rainbow (>= 2.2.2, < 4.0)
225-
regexp_parser (>= 1.8, < 3.0)
226-
rexml
227-
rubocop-ast (>= 1.17.0, < 2.0)
228+
regexp_parser (>= 2.4, < 3.0)
229+
rubocop-ast (>= 1.32.2, < 2.0)
228230
ruby-progressbar (~> 1.7)
229-
unicode-display_width (>= 1.4.0, < 3.0)
230-
rubocop-ast (1.33.0)
231+
unicode-display_width (>= 2.4.0, < 3.0)
232+
rubocop-ast (1.34.0)
231233
parser (>= 3.3.1.0)
232-
rubocop-minitest (0.19.1)
234+
rubocop-minitest (0.27.0)
233235
rubocop (>= 0.90, < 2.0)
234-
rubocop-performance (1.13.3)
235-
rubocop (>= 1.7.0, < 2.0)
236-
rubocop-ast (>= 0.4.0)
236+
rubocop-performance (1.22.1)
237+
rubocop (>= 1.48.1, < 2.0)
238+
rubocop-ast (>= 1.31.1, < 2.0)
237239
ruby-progressbar (1.13.0)
238240
simplecov (0.17.1)
239241
docile (~> 1.1)
240242
json (>= 1.8, < 3)
241243
simplecov-html (~> 0.10.0)
242244
simplecov-html (0.10.2)
243245
spring (2.1.1)
246+
standard (1.41.1)
247+
language_server-protocol (~> 3.17.0.2)
248+
lint_roller (~> 1.0)
249+
rubocop (~> 1.66.0)
250+
standard-custom (~> 1.0.0)
251+
standard-performance (~> 1.5)
252+
standard-custom (1.0.2)
253+
lint_roller (~> 1.0)
254+
rubocop (~> 1.50)
255+
standard-performance (1.5.0)
256+
lint_roller (~> 1.1)
257+
rubocop-performance (~> 1.22.0)
244258
stringio (3.1.1)
245259
thor (1.3.2)
246260
timeout (0.4.0)
247261
tzinfo (2.0.6)
248262
concurrent-ruby (~> 1.0)
249263
unicode-display_width (2.6.0)
250-
webrick (1.8.1)
251264
websocket-driver (0.7.6)
252265
websocket-extensions (>= 0.1.0)
253266
websocket-extensions (0.1.5)
@@ -265,11 +278,12 @@ DEPENDENCIES
265278
pry-byebug (~> 3.9)
266279
rails
267280
rake (~> 13.0)
268-
rubocop (~> 1.9)
269-
rubocop-minitest (~> 0.10)
270-
rubocop-performance (~> 1.9)
281+
rubocop
282+
rubocop-minitest
283+
rubocop-performance
271284
simplecov (< 0.18)
272285
spring (~> 2.1)
286+
standard
273287
vite_plugin_legacy!
274288
vite_rails!
275289
vite_ruby!

Rakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

3-
require 'rake/testtask'
3+
require "rake/testtask"
44

55
Rake::TestTask.new do |t|
6-
t.libs << 'test'
7-
t.test_files = FileList['test/**/*_test.rb']
6+
t.libs << "test"
7+
t.test_files = FileList["test/**/*_test.rb"]
88
t.verbose = true
99
end
1010

bin/m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
# this file is here to facilitate running it.
99
#
1010

11-
require 'pathname'
12-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
1313
Pathname.new(__FILE__).realpath)
1414

15-
bundle_binstub = File.expand_path('bundle', __dir__)
15+
bundle_binstub = File.expand_path("bundle", __dir__)
1616

1717
if File.file?(bundle_binstub)
18-
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
18+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
1919
load(bundle_binstub)
2020
else
2121
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
2222
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
2323
end
2424
end
2525

26-
require 'rubygems'
27-
require 'bundler/setup'
26+
require "rubygems"
27+
require "bundler/setup"
2828

2929
ARGV.each_with_index do |arg, index|
30-
ARGV[index] = arg.sub(File.expand_path(Dir.pwd), '')
30+
ARGV[index] = arg.sub(File.expand_path(Dir.pwd), "")
3131
end
3232

33-
load Gem.bin_path('m', 'm')
33+
load Gem.bin_path("m", "m")

bin/rake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
# this file is here to facilitate running it.
99
#
1010

11-
require 'pathname'
12-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
1313
Pathname.new(__FILE__).realpath)
1414

15-
bundle_binstub = File.expand_path('bundle', __dir__)
15+
bundle_binstub = File.expand_path("bundle", __dir__)
1616

1717
if File.file?(bundle_binstub)
18-
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
18+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
1919
load(bundle_binstub)
2020
else
2121
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
2222
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
2323
end
2424
end
2525

26-
require 'rubygems'
27-
require 'bundler/setup'
26+
require "rubygems"
27+
require "bundler/setup"
2828

29-
load Gem.bin_path('rake', 'rake')
29+
load Gem.bin_path("rake", "rake")

0 commit comments

Comments
 (0)