Skip to content

Commit a0e78ea

Browse files
authored
Switch Lint Checks in pre-commit (#1897)
* Switch Lint Checks in pre-commit * standardrb fixes * Fix the fixes
1 parent a3c5c77 commit a0e78ea

File tree

155 files changed

+1963
-1990
lines changed

Some content is hidden

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

155 files changed

+1963
-1990
lines changed

.erb-lint.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
exclude:
3+
- 'vendor/bundle/**/*'
4+
EnableDefaultLinters: true
5+
linters:
6+
SpaceAroundErbTag:
7+
enabled: true
8+
ExtraNewline:
9+
enabled: true

.pre-commit-config.yaml

+17-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.2.0
5+
rev: v3.4.0
66
hooks:
77
- id: trailing-whitespace
88
exclude: '\.enc$'
@@ -13,11 +13,20 @@ repos:
1313

1414
- repo: local
1515
hooks:
16-
- id: rubocop
17-
name: Running rubocop
18-
entry: rubocop
16+
- id: erblint
17+
name: ERBLint
18+
entry: erblint
1919
language: system
20-
pass_filenames: false
21-
#args: ['-a']
22-
always_run: true
23-
stages: [pre-commit]
20+
types: [html]
21+
files: \.html\.erb$
22+
pass_filenames: true
23+
24+
- repo: local
25+
hooks:
26+
- id: standardrb
27+
name: standardrb
28+
entry: standardrb
29+
language: system
30+
types: [ruby]
31+
files: \.rb$
32+
pass_filenames: true

Gemfile

+62-62
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
# frozen_string_literal: true
22

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

5-
ruby ENV['CUSTOM_RUBY_VERSION'] || '>=3.1.4'
5+
ruby ENV["CUSTOM_RUBY_VERSION"] || ">=3.1.4"
66

7-
gem 'rails', '~> 7.1.3'
7+
gem "rails", "~> 7.1.3"
88

99
group :development do
10-
gem 'listen'
10+
gem "listen"
1111

1212
# Visual Studio Additions
13-
gem 'rubocop'
14-
gem 'rubocop-performance'
15-
gem 'rubocop-rails'
16-
gem 'ruby-debug-ide'
13+
gem "ruby-debug-ide"
1714

18-
gem 'pry-rails'
15+
gem "pry-rails"
1916

2017
# Access an interactive console on exception pages or by
2118
# calling 'console' anywhere in the code.
22-
gem 'web-console', '>= 4.2.0'
19+
gem "web-console", ">= 4.2.0"
20+
21+
gem "derailed_benchmarks"
22+
gem "stackprof"
2323
end
2424

2525
group :test do
2626
# Adds support for Capybara system testing and selenium driver
27-
gem 'capybara', '>= 3.37.1', '< 4.0'
28-
gem 'minitest'
29-
gem 'minitest-rails', '>= 6.1.0'
30-
gem 'minitest-reporters'
31-
gem 'selenium-webdriver'
32-
gem 'webdrivers', '~> 5.3', require: false
27+
gem "capybara", ">= 3.37.1", "< 4.0"
28+
gem "minitest"
29+
gem "minitest-rails", ">= 6.1.0"
30+
gem "minitest-reporters"
31+
gem "selenium-webdriver"
32+
gem "webdrivers", "~> 5.3", require: false
3333
end
3434

3535
group :development, :test do
3636
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
37-
gem 'debase', '>= 0.2.5.beta2', platforms: %i[mri mingw x64_mingw]
38-
gem 'debug', platforms: %i[mri mingw x64_mingw]
37+
gem "debase", ">= 0.2.5.beta2", platforms: %i[mri mingw x64_mingw]
38+
gem "debug", platforms: %i[mri mingw x64_mingw]
39+
40+
gem "erb_lint", "~> 0.5.0"
41+
gem "standardrb", "~> 1.0"
3942
end
4043

41-
gem 'rack-attack'
42-
gem 'rack-cors'
44+
gem "rack-attack"
45+
gem "rack-cors"
4346

4447
# OSX: ../src/utils.h:33:10: fatal error: 'climits' file not found
4548
# From:
@@ -53,70 +56,67 @@ gem 'rack-cors'
5356
# $ bundle install
5457
# gem 'therubyracer'
5558
#
56-
gem 'high_voltage'
57-
gem 'kramdown', require: false
58-
gem 'lockbox'
59+
gem "high_voltage"
60+
gem "kramdown", require: false
61+
gem "lockbox"
5962

6063
# Reduces boot times through caching; required in config/boot.rb
61-
gem 'bootsnap', '>= 1.4.4', require: false
64+
gem "bootsnap", ">= 1.4.4", require: false
6265

6366
# Use SCSS for stylesheets
64-
gem 'sass-rails', '~> 6.0', '>= 6.0.0'
65-
gem 'terser', '~> 1.2'
67+
gem "sass-rails", "~> 6.0", ">= 6.0.0"
68+
gem "terser", "~> 1.2"
6669
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
67-
gem 'bootstrap', '5.2.3'
68-
gem 'json', '~> 2.7' # Legacy carry-over
69-
gem 'will_paginate', '~> 4.0.0'
70-
gem 'will_paginate-bootstrap-style'
70+
gem "bootstrap", "5.2.3"
71+
gem "json", "~> 2.7" # Legacy carry-over
72+
gem "will_paginate", "~> 4.0.0"
73+
gem "will_paginate-bootstrap-style"
7174

7275
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
73-
gem 'turbo-rails'
76+
gem "turbo-rails"
7477
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
75-
gem 'stimulus-rails'
78+
gem "stimulus-rails"
7679
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
77-
gem 'jbuilder'
80+
gem "jbuilder"
7881

7982
# Use Redis adapter to run Action Cable in production
8083
# gem 'redis', '~> 4.0'
8184
# Use ActiveModel has_secure_password
8285
# gem 'bcrypt', '~> 3.1.7'
8386

84-
gem 'apipie-rails'
85-
gem 'config'
86-
gem 'devise', '>= 4.9.0'
87-
gem 'foreman'
88-
gem 'lograge'
89-
gem 'mail_form', '>= 1.9.0'
90-
gem 'oj'
91-
gem 'puma'
92-
gem 'rollbar'
93-
gem 'simple_token_authentication'
94-
95-
gem 'devise-i18n'
96-
gem 'i18n-tasks', '~> 1.0.13' # , group: :development
97-
gem 'rails-i18n', '~> 7.0.8'
98-
gem 'route_translator', '>= 13.0.0'
99-
gem 'translation'
87+
gem "apipie-rails"
88+
gem "config"
89+
gem "devise", ">= 4.9.0"
90+
gem "foreman"
91+
gem "lograge"
92+
gem "mail_form", ">= 1.9.0"
93+
gem "oj"
94+
gem "puma"
95+
gem "rollbar"
96+
gem "simple_token_authentication"
97+
98+
gem "devise-i18n"
99+
gem "i18n-tasks", "~> 1.0.13" # , group: :development
100+
gem "rails-i18n", "~> 7.0.8"
101+
gem "route_translator", ">= 13.0.0"
102+
gem "translation"
100103

101104
# For File Uploads
102-
gem 'aws-sdk-s3', require: false
103-
gem 'azure-storage-blob', '~> 2.0', require: false
104-
gem 'google-cloud-storage', '~> 1.48', require: false
105+
gem "aws-sdk-s3", require: false
106+
gem "azure-storage-blob", "~> 2.0", require: false
107+
gem "google-cloud-storage", "~> 1.48", require: false
105108

106109
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
107-
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
110+
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
108111

109112
# Database backends
110-
gem 'mysql2'
111-
gem 'pg'
112-
gem 'sqlite3', force_ruby_platform: true
113+
gem "mysql2"
114+
gem "pg"
115+
gem "sqlite3", force_ruby_platform: true
113116

114117
group :production do
115-
gem 'rack-throttle', '0.7.0'
116-
gem 'rack-timeout'
118+
gem "rack-throttle", "0.7.0"
119+
gem "rack-timeout"
117120
end
118121

119-
gem 'version', git: 'https://github.com/pglombardo/version.git', branch: 'master'
120-
121-
gem 'derailed_benchmarks', group: :development
122-
gem 'stackprof', group: :development
122+
gem "version", git: "https://github.com/pglombardo/version.git", branch: "master"

Gemfile.lock

+24-8
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ GEM
218218
dry-initializer (~> 3.0)
219219
dry-schema (>= 1.12, < 2)
220220
zeitwerk (~> 2.6)
221+
erb_lint (0.5.0)
222+
activesupport
223+
better_html (>= 2.0.1)
224+
parser (>= 2.7.1.4)
225+
rainbow
226+
rubocop
227+
smart_properties
221228
erubi (1.12.0)
222229
execjs (2.9.1)
223230
faraday (1.10.3)
@@ -323,6 +330,7 @@ GEM
323330
kramdown (2.4.0)
324331
rexml
325332
language_server-protocol (3.17.0.3)
333+
lint_roller (1.1.0)
326334
listen (3.8.0)
327335
rb-fsevent (~> 0.10, >= 0.10.3)
328336
rb-inotify (~> 0.9, >= 0.9.10)
@@ -501,11 +509,6 @@ GEM
501509
rubocop-performance (1.20.2)
502510
rubocop (>= 1.48.1, < 2.0)
503511
rubocop-ast (>= 1.30.0, < 2.0)
504-
rubocop-rails (2.23.1)
505-
activesupport (>= 4.2.0)
506-
rack (>= 1.1)
507-
rubocop (>= 1.33.0, < 2.0)
508-
rubocop-ast (>= 1.30.0, < 2.0)
509512
ruby-debug-ide (0.7.3)
510513
rake (>= 0.8.1)
511514
ruby-progressbar (1.13.0)
@@ -547,6 +550,20 @@ GEM
547550
sqlite3 (1.7.2)
548551
mini_portile2 (~> 2.8.0)
549552
stackprof (0.2.26)
553+
standard (1.34.0)
554+
language_server-protocol (~> 3.17.0.2)
555+
lint_roller (~> 1.0)
556+
rubocop (~> 1.60)
557+
standard-custom (~> 1.0.0)
558+
standard-performance (~> 1.3)
559+
standard-custom (1.0.2)
560+
lint_roller (~> 1.0)
561+
rubocop (~> 1.50)
562+
standard-performance (1.3.1)
563+
lint_roller (~> 1.1)
564+
rubocop-performance (~> 1.20.2)
565+
standardrb (1.0.1)
566+
standard
550567
stimulus-rails (1.3.3)
551568
railties (>= 6.0.0)
552569
stringio (3.1.0)
@@ -609,6 +626,7 @@ DEPENDENCIES
609626
derailed_benchmarks
610627
devise (>= 4.9.0)
611628
devise-i18n
629+
erb_lint (~> 0.5.0)
612630
foreman
613631
google-cloud-storage (~> 1.48)
614632
high_voltage
@@ -636,15 +654,13 @@ DEPENDENCIES
636654
rails-i18n (~> 7.0.8)
637655
rollbar
638656
route_translator (>= 13.0.0)
639-
rubocop
640-
rubocop-performance
641-
rubocop-rails
642657
ruby-debug-ide
643658
sass-rails (~> 6.0, >= 6.0.0)
644659
selenium-webdriver
645660
simple_token_authentication
646661
sqlite3
647662
stackprof
663+
standardrb (~> 1.0)
648664
stimulus-rails
649665
terser (~> 1.2)
650666
translation

Rakefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
# Add your own tasks in files placed in lib/tasks ending in .rake,
44
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
55

6-
require File.expand_path('config/application', __dir__)
6+
require File.expand_path("config/application", __dir__)
77

88
PasswordPusher::Application.load_tasks
99

1010
# Add version gem rake tasks
11-
require 'rake/version_task'
11+
require "rake/version_task"
1212
Rake::VersionTask.new do |task|
1313
task.with_git_tag = true
14-
task.git_tag_prefix = 'v'
14+
task.git_tag_prefix = "v"
1515
end

app/controllers/application_controller.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class ApplicationController < ActionController::Base
88

99
def custom_set_locale_from_url
1010
locale_from_url = RouteTranslator.locale_from_params(params) ||
11-
RouteTranslator::Host.locale_from_host(request.host) ||
12-
I18n.default_locale
11+
RouteTranslator::Host.locale_from_host(request.host) ||
12+
I18n.default_locale
1313
if locale_from_url
14-
old_locale = I18n.locale
14+
old_locale = I18n.locale
1515
I18n.locale = locale_from_url
1616
end
1717

@@ -21,15 +21,15 @@ def custom_set_locale_from_url
2121
end
2222

2323
def not_found
24-
raise ActionController::RoutingError, _('Not Found')
24+
raise ActionController::RoutingError, _("Not Found")
2525
end
2626

2727
private
2828

2929
def render_error(status, _exception)
3030
respond_to do |format|
31-
format.html { render template: "errors/error_#{status}", layout: 'layouts/application', status: }
32-
format.all { render nothing: true, status: }
31+
format.html { render template: "errors/error_#{status}", layout: "layouts/application", status: }
32+
format.all { render nothing: true, status: }
3333
end
3434
end
3535
end

app/controllers/feedbacks_controller.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ def create
1212
# valid? will tell us if the humanity test was answered correctly
1313
if @feedback.spam? || !@feedback.valid?
1414
flash[:alert] =
15-
_('Our apologies but you failed the spam check. You could try contacting us on Github instead.')
15+
_("Our apologies but you failed the spam check. You could try contacting us on Github instead.")
1616
render :new, status: :unprocessable_entity
1717
else
1818
@feedback.request = request
1919
if @feedback.deliver
2020
redirect_to root_path,
21-
notice: _('Feedback sent! We will get back to you as soon as possible.')
21+
notice: _("Feedback sent! We will get back to you as soon as possible.")
2222
else
2323
flash[:alert] =
24-
_('Could not send feedback. Did you pass the Humanity Test? Valid email? Try again?')
24+
_("Could not send feedback. Did you pass the Humanity Test? Valid email? Try again?")
2525
render :new, status: :unprocessable_entity
2626
end
2727
end

0 commit comments

Comments
 (0)