Skip to content

Commit

Permalink
chore: add standardrb (#512)
Browse files Browse the repository at this point in the history
* chore: test rails 8.0 explicitly
* chore: add mutex_m as a dependency
* chore: autocorrect hash spacing
* chore: autocorrect string literals
  • Loading branch information
ElMassimo authored Nov 5, 2024
1 parent 9a96300 commit b92ef4b
Show file tree
Hide file tree
Showing 105 changed files with 1,234 additions and 1,111 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
]
experimental: [false]
include:
- ruby: "3.3"
- ruby: "3.4.0-preview2"
os: ubuntu-latest
gemfile: Gemfile-rails-edge
gemfile: "Gemfile-rails.8.0.x"
experimental: true
- ruby: "3.4.0-preview1"
- ruby: "3.4.0-preview2"
os: ubuntu-latest
gemfile: Gemfile-rails-edge
experimental: true
Expand Down
40 changes: 32 additions & 8 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
inherit_from: .rubocop_todo.yml

require:
- standard
- rubocop-performance
- rubocop-minitest

inherit_gem:
standard: config/ruby-3.0.yml

inherit_mode:
merge:
- Exclude

AllCops:
TargetRubyVersion: 3.0
SuggestExtensions: false
NewCops: enable
Exclude:
- "node_modules/**/*"
- "**/*/node_modules/**/*"
Expand All @@ -18,15 +25,10 @@ AllCops:
- "vendor/bundle"
- "tmp/**/*"
- "test/mounted_app/test/dummy/bin/*"
TargetRubyVersion: 2.5

Style/IfUnlessModifier:
Enabled: false

Lint/UnusedMethodArgument:
Exclude:
- "vite_rails/lib/vite_rails/tag_helpers.rb"

Style/RescueModifier:
Enabled: false

Expand All @@ -39,6 +41,12 @@ Style/GuardClause:
Style/MultilineBlockChain:
Enabled: false

Style/HashEachMethods:
Enabled: false

Layout/LineLength:
Enabled: false

Layout/ElseAlignment:
Enabled: false

Expand All @@ -51,6 +59,9 @@ Layout/IndentationWidth:
Gemspec/RequiredRubyVersion:
Enabled: false

Gemspec/DevelopmentDependencies:
Enabled: false

Layout/IndentationConsistency:
Enabled: false

Expand All @@ -69,9 +80,6 @@ Style/Documentation:
Naming/RescuedExceptionsVariableName:
PreferredName: error

Layout/SpaceInsideStringInterpolation:
EnforcedStyle: space

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Expand All @@ -93,6 +101,12 @@ Style/MissingRespondToMissing:
Style/ParallelAssignment:
Enabled: false

Style/FetchEnvVar:
Enabled: false

Style/SuperWithArgsParentheses:
Enabled: false

Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma

Expand Down Expand Up @@ -149,3 +163,13 @@ Security/YAMLLoad:

Style/MutableConstant:
Enabled: false

Minitest/MultipleAssertions:
Enabled: false

Minitest/AssertRaisesWithRegexpArgument:
Enabled: false

Minitest/UselessAssertion:
Exclude:
- test/helper_test.rb
19 changes: 12 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-10-30 16:53:53 UTC using RuboCop version 1.28.2.
# on 2024-11-05 13:37:33 UTC using RuboCop version 1.66.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 46
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 222
# Offense count: 1
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'test/mounted_app/test/dummy/config/initializers/content_security_policy.rb'

# Offense count: 1
# Configuration parameters: AllowComments.
Lint/EmptyClass:
Exclude:
- 'test/test_app/config/application.rb'
19 changes: 10 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

gem 'rails'
gem "rails"

gemspec path: './vite_ruby'
gemspec path: './vite_rails'
gemspec path: './vite_plugin_legacy'
gemspec path: "./vite_ruby"
gemspec path: "./vite_rails"
gemspec path: "./vite_plugin_legacy"

group :development, :test do
gem 'benchmark-ips'
gem 'rubocop', '~> 1.9'
gem 'rubocop-minitest', '~> 0.10'
gem 'rubocop-performance', '~> 1.9'
gem "benchmark-ips"
gem "rubocop"
gem "rubocop-minitest"
gem "rubocop-performance"
gem "standard", require: false
end
64 changes: 39 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ PATH
vite_ruby (3.9.0)
dry-cli (>= 0.7, < 2)
logger (~> 1.6)
mutex_m
rack-proxy (~> 0.6, >= 0.6.1)
zeitwerk (~> 2.2)

Expand Down Expand Up @@ -110,19 +111,21 @@ GEM
date (3.3.3)
docile (1.4.0)
drb (2.2.1)
dry-cli (1.1.0)
dry-cli (1.2.0)
erubi (1.13.0)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
io-console (0.7.2)
irb (1.14.0)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.6.3)
json (2.7.6)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
logger (1.6.1)
loofah (2.22.0)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
m (1.6.2)
Expand Down Expand Up @@ -159,7 +162,7 @@ GEM
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.26.3)
parser (3.3.5.0)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
pry (0.14.2)
Expand All @@ -171,16 +174,15 @@ GEM
psych (5.1.2)
stringio
racc (1.8.1)
rack (3.1.7)
rack (3.1.8)
rack-proxy (0.7.7)
rack
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rackup (2.2.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.0)
actioncable (= 7.1.0)
actionmailbox (= 7.1.0)
Expand Down Expand Up @@ -217,37 +219,48 @@ GEM
regexp_parser (2.9.2)
reline (0.5.10)
io-console (~> 0.5)
rexml (3.3.9)
rubocop (1.28.2)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.17.0, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.33.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.34.0)
parser (>= 3.3.1.0)
rubocop-minitest (0.19.1)
rubocop-minitest (0.27.0)
rubocop (>= 0.90, < 2.0)
rubocop-performance (1.13.3)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
spring (2.1.1)
standard (1.41.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.66.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.5)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.5.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.22.0)
stringio (3.1.1)
thor (1.3.2)
timeout (0.4.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
webrick (1.8.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand All @@ -265,11 +278,12 @@ DEPENDENCIES
pry-byebug (~> 3.9)
rails
rake (~> 13.0)
rubocop (~> 1.9)
rubocop-minitest (~> 0.10)
rubocop-performance (~> 1.9)
rubocop
rubocop-minitest
rubocop-performance
simplecov (< 0.18)
spring (~> 2.1)
standard
vite_plugin_legacy!
vite_rails!
vite_ruby!
Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

require 'rake/testtask'
require "rake/testtask"

Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/**/*_test.rb']
t.libs << "test"
t.test_files = FileList["test/**/*_test.rb"]
t.verbose = true
end

Expand Down
16 changes: 8 additions & 8 deletions bin/m
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path('bundle', __dir__)
bundle_binstub = File.expand_path("bundle", __dir__)

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

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

ARGV.each_with_index do |arg, index|
ARGV[index] = arg.sub(File.expand_path(Dir.pwd), '')
ARGV[index] = arg.sub(File.expand_path(Dir.pwd), "")
end

load Gem.bin_path('m', 'm')
load Gem.bin_path("m", "m")
14 changes: 7 additions & 7 deletions bin/rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path('bundle', __dir__)
bundle_binstub = File.expand_path("bundle", __dir__)

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

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

load Gem.bin_path('rake', 'rake')
load Gem.bin_path("rake", "rake")
Loading

0 comments on commit b92ef4b

Please sign in to comment.