Skip to content

Commit

Permalink
Use rubocop-basic
Browse files Browse the repository at this point in the history
  • Loading branch information
ksylvest committed Jan 18, 2025
1 parent 2379c11 commit 684098c
Show file tree
Hide file tree
Showing 77 changed files with 489 additions and 496 deletions.
16 changes: 3 additions & 13 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
inherit_gem:
rubocop-basic: rubocop.yml

require:
- rubocop-capybara
- rubocop-factory_bot
Expand All @@ -7,7 +10,6 @@ require:

AllCops:
TargetRubyVersion: 3.4.1
NewCops: enable
Exclude:
- Gemfile.lock
- db/schema.rb
Expand All @@ -18,12 +20,6 @@ AllCops:
- tmp/**/*
- vendor/**/*

Layout/AccessModifierIndentation:
EnforcedStyle: outdent

Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation

Layout/EmptyLinesAroundBlockBody:
Enabled: false

Expand Down Expand Up @@ -66,12 +62,6 @@ Style/ClassAndModuleChildren:
Style/EmptyCaseCondition:
Enabled: false

Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma

Style/ExpandPathArguments:
Enabled: false

Expand Down
4 changes: 2 additions & 2 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
brew 'rbenv'
brew 'vips'
brew "rbenv"
brew "vips"
85 changes: 43 additions & 42 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
source 'https://rubygems.org'
source "https://rubygems.org"

ruby '3.4.1'
ruby "3.4.1"

gem 'rails'
gem "rails"

gem 'pg'
gem 'puma'
gem "pg"
gem "puma"

gem 'bootsnap', require: false
gem 'thruster', require: false
gem "bootsnap", require: false
gem "thruster", require: false

gem 'bcrypt'
gem 'erroneous'
gem 'foreman'
gem 'hiredis'
gem 'http'
gem 'kaminari'
gem 'progress'
gem 'propshaft'
gem 'redcarpet'
gem 'redis'
gem 'rouge'
gem "bcrypt"
gem "erroneous"
gem "foreman"
gem "hiredis"
gem "http"
gem "kaminari"
gem "progress"
gem "propshaft"
gem "redcarpet"
gem "redis"
gem "rouge"

gem 'image_processing'
gem "image_processing"

gem 'aws-sdk-s3', require: false
gem 'cloudflare-ips'
gem "aws-sdk-s3", require: false
gem "cloudflare-ips"

gem 'cssbundling-rails'
gem 'jsbundling-rails'
gem 'sentry-rails'
gem 'stimulus-rails'
gem "cssbundling-rails"
gem "jsbundling-rails"
gem "sentry-rails"
gem "stimulus-rails"

gem 'debug', group: %i[development test]
gem "debug", group: %i[development test]

group :development do
gem 'brakeman'
gem 'listen'
gem 'rubocop'
gem 'rubocop-capybara'
gem 'rubocop-factory_bot'
gem 'rubocop-rails'
gem 'rubocop-rspec'
gem 'rubocop-rspec_rails'
gem 'web-console'
gem "brakeman"
gem "listen"
gem "rubocop"
gem "rubocop-basic"
gem "rubocop-capybara"
gem "rubocop-factory_bot"
gem "rubocop-rails"
gem "rubocop-rspec"
gem "rubocop-rspec_rails"
gem "web-console"
end

group :test do
gem 'capybara'
gem 'factory_bot_rails'
gem 'rspec_junit_formatter'
gem 'rspec-rails'
gem 'selenium-webdriver'
gem 'shoulda-matchers'
gem 'simplecov', require: false
gem "capybara"
gem "factory_bot_rails"
gem "rspec_junit_formatter"
gem "rspec-rails"
gem "selenium-webdriver"
gem "shoulda-matchers"
gem "simplecov", require: false
end
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ GEM
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-basic (0.2.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.26.1)
Expand Down Expand Up @@ -444,6 +445,7 @@ DEPENDENCIES
rspec-rails
rspec_junit_formatter
rubocop
rubocop-basic
rubocop-capybara
rubocop-factory_bot
rubocop-rails
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative 'config/application'
require_relative "config/application"

Rails.application.load_tasks
2 changes: 1 addition & 1 deletion app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class AdminController < ApplicationController
layout 'admin/application'
layout "admin/application"
end
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def authenticate!(role:)
return if authenticated? && user.role.eql?(role)

store
redirect_to new_admin_session_path, alert: 'You must be authenticated.'
redirect_to new_admin_session_path, alert: "You must be authenticated."
end

def store
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/auths_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class AuthsController < ApplicationController
# POST /auth
def create
user = GlobalID::Locator.locate_signed(params[:token], for: 'auth')
user = GlobalID::Locator.locate_signed(params[:token], for: "auth")
authenticate(user)
head :ok
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/concerns/robots.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module Robots
extend ActiveSupport::Concern

def robots(value = 'all')
response.headers['X-Robots-Tag'] = value
def robots(value = "all")
response.headers["X-Robots-Tag"] = value
end

def norobot
robots('noindex,nofollow')
robots("noindex,nofollow")
end
end
2 changes: 1 addition & 1 deletion app/controllers/sitemaps_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class SitemapsController < ApplicationController
layout 'sitemap'
layout "sitemap"

# GET /sitemap
def show
Expand Down
66 changes: 33 additions & 33 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ def active?(*mode)

def prose(&)
tag.div(class: [
'prose',
'prose-slate',
'prose-a:text-indigo-600',
'prose-pre:bg-slate-50',
'prose-pre:text-slate-800',
'prose-pre:text-base',
'prose-pre:p-4',
'max-w-none',
'min-w-none',
].join(' '), &)
"prose",
"prose-slate",
"prose-a:text-indigo-600",
"prose-pre:bg-slate-50",
"prose-pre:text-slate-800",
"prose-pre:text-base",
"prose-pre:p-4",
"max-w-none",
"min-w-none",
].join(" "), &)
end

def markdown(text)
Expand All @@ -25,7 +25,7 @@ def markdown(text)
end

def viewport
'width=device-width,initial-scale=1.0'
"width=device-width,initial-scale=1.0"
end

def filters(filters = {})
Expand All @@ -40,41 +40,41 @@ def filters(filters = {})

def ld
{
'@context': 'http://schema.org',
'@type': 'WebSite',
'url': root_url,
'potentialAction': {
'@type': 'SearchAction',
'target': "#{search_url}?query={query}",
'query-input': 'required name=query',
"@context": "http://schema.org",
"@type": "WebSite",
"url": root_url,
"potentialAction": {
"@type": "SearchAction",
"target": "#{search_url}?query={query}",
"query-input": "required name=query",
},
}
end

# @return [Array<Array(String, String)>]
def header_nav
[
['Home', root_path],
['About', about_path],
['Contact', contact_path],
['Projects', projects_path],
['Portfolio', portfolio_path],
['Search', search_path],
["Home", root_path],
["About", about_path],
["Contact", contact_path],
["Projects", projects_path],
["Portfolio", portfolio_path],
["Search", search_path],
]
end

# @return [Array<Array(String, String)>]
def footer_nav
[
['GitHub', github_url],
['Twitter', twitter_url],
['Facebook', facebook_url],
['Linkedin', linkedin_url],
['Dribbble', dribbble_url],
['Stack', stackoverflow_url],
['Vimeo', vimeo_url],
['Status', status_url],
['Feed', feed_url(:atom)],
["GitHub", github_url],
["Twitter", twitter_url],
["Facebook", facebook_url],
["Linkedin", linkedin_url],
["Dribbble", dribbble_url],
["Stack", stackoverflow_url],
["Vimeo", vimeo_url],
["Status", status_url],
["Feed", feed_url(:atom)],
]
end

Expand Down
2 changes: 1 addition & 1 deletion app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class ApplicationMailer < ActionMailer::Base
layout 'mailer'
layout "mailer"
end
4 changes: 2 additions & 2 deletions app/models/concerns/approvable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module Approvable
extend ActiveSupport::Concern

module Status
ACTIVE = 'active'.freeze
PENDING = 'pending'.freeze
ACTIVE = "active".freeze
PENDING = "pending".freeze
end

STATUSES = [
Expand Down
12 changes: 6 additions & 6 deletions app/models/concerns/redcarpet/render/advanced.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'rouge'
require 'rouge/plugins/redcarpet'
require "rouge"
require "rouge/plugins/redcarpet"

class Redcarpet::Render::Advanced < Redcarpet::Render::HTML
include Rouge::Plugins::Redcarpet
Expand All @@ -17,10 +17,10 @@ def internalize(link)
file = Attachment.find(attributes[:id]).file

case attributes[:variant]
when 'original' then file
when 'small' then file.variant(resize: '480x480')
when 'large' then file.variant(resize: '960x960')
when 'square' then file.variant(thumbnail: '120x120')
when "original" then file
when "small" then file.variant(resize: "480x480")
when "large" then file.variant(resize: "960x960")
when "square" then file.variant(thumbnail: "120x120")
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/searchable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Searchable
class Tokenizer
include Singleton

LANGUAGE = 'english'.freeze
LANGUAGE = "english".freeze
SEPARATOR = /\W+/

def generate(query, fields, sanitizer)
Expand All @@ -23,7 +23,7 @@ def searchables(fields, conjunction = " || ' ' || ")
tsvector(fields.map { |field| "coalesce(#{field}, '')" }.join(conjunction))
end

def tokens(query, sanitizer, conjunction = ' && ')
def tokens(query, sanitizer, conjunction = " && ")
query.split(SEPARATOR).map { |term| tsquery(term, sanitizer) }.join(conjunction)
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/taggable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ module Taggable
end

def keywords
tags.join(',')
tags.join(",")
end

def taggables
tags.join(' ')
tags.join(" ")
end

def taggables=(value)
Expand Down
2 changes: 1 addition & 1 deletion app/models/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Page < ApplicationRecord

before_validation :defaults!

scope :ordered, -> { order('id DESC') }
scope :ordered, -> { order("id DESC") }
scope :optimized, -> { includes(:user) }

scope :canonical, -> { where(canonical_url: nil) }
Expand Down
Loading

0 comments on commit 684098c

Please sign in to comment.