Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add standard-rails #1190

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
gem "standard"
gem "standard-rails", "~> 0.2.0"
gem "factory_bot_rails"
gem "spy"
gem "letter_opener"
Expand Down
49 changes: 36 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,19 @@ GEM
jmespath (1.6.1)
jsbundling-rails (1.2.1)
railties (>= 6.0.0)
json (2.6.3)
jwt (2.3.0)
kramdown (2.3.1)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
launchy (2.5.0)
addressable (~> 2.7)
lefthook (0.7.7)
letter_opener (1.8.1)
launchy (>= 2.2, < 3)
lint_roller (1.1.0)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand Down Expand Up @@ -334,8 +337,9 @@ GEM
pagy (5.10.1)
activesupport
parallel (1.22.1)
parser (3.1.1.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
pg (1.3.5)
pg_search (2.3.6)
activerecord (>= 5.2)
Expand Down Expand Up @@ -412,20 +416,26 @@ GEM
reverse_markdown (2.1.1)
nokogiri
rexml (3.2.6)
rubocop (1.27.0)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.16.0, < 2.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.17.0)
parser (>= 3.1.1.0)
rubocop-performance (1.13.3)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.20.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
ruby-progressbar (1.11.0)
ruby-vips (2.1.4)
ffi (~> 1.12)
Expand Down Expand Up @@ -475,9 +485,21 @@ GEM
faraday-http-cache (~> 2.2)
faraday_middleware (~> 1.0)
logging (~> 2.3)
standard (1.10.0)
rubocop (= 1.27.0)
rubocop-performance (= 1.13.3)
standard (1.32.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.57.2)
standard-custom (~> 1.0.0)
standard-performance (~> 1.2)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.2.1)
lint_roller (~> 1.1)
rubocop-performance (~> 1.19.1)
standard-rails (0.2.0)
lint_roller (~> 1.0)
rubocop-rails (~> 2.20.2)
statsd-ruby (1.5.0)
store_model (0.13.0)
activerecord (>= 5.2)
Expand All @@ -503,7 +525,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
unicode-display_width (2.1.0)
unicode-display_width (2.5.0)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.0)
Expand Down Expand Up @@ -574,6 +596,7 @@ DEPENDENCIES
spy
square.rb
standard
standard-rails (~> 0.2.0)
store_model
sucker_punch
translation
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class MembersController < BaseController
before_action :set_member, only: [:show, :edit, :update, :destroy]

def index
member_scope = params[:filter] == "closed" ? Member.closed : Member.open
member_scope = (params[:filter] == "closed") ? Member.closed : Member.open
@pagy, @members = pagy(
member_scope.order(index_order).includes(:active_membership, :last_membership, :checked_out_loans, :active_holds),
items: 100
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def after_sign_in_path_for(user)
return super_admin_libraries_path if user.super_admin?

referer = stored_location_for(user)
default_path = user.admin? || user.staff? ? admin_dashboard_path : account_home_path
default_path = (user.admin? || user.staff?) ? admin_dashboard_path : account_home_path
if referer.eql? root_path
default_path
else
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/admin_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def item_attachment_kind_options
end

def tab_link(label, path, badge: nil)
opts = badge.present? && badge != 0 ? {class: "badge", data: {badge: badge}} : {}
opts = (badge.present? && badge != 0) ? {class: "badge", data: {badge: badge}} : {}
tag.li(class: "tab-item #{"active" if current_page?(path)}") do
link_to label, path, **opts
end
Expand Down Expand Up @@ -67,7 +67,7 @@ def action_bar(message, icon: "", type: nil, &block)
end

def audit_description(audit, key, values)
value = audit.action == "create" ? values : values.last
value = (audit.action == "create") ? values : values.last

case key
when "status"
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/holds_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def render_remove_link(hold)

if hold.appointment.present?
message <<
" It will also be removed from your appointment."\
" It will also be removed from your appointment." \
" If it's the only item in your appointment, your appointment will be canceled."
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/members_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ def member_status(member)
end

def format_stats_counter(number)
number > 0 ? number : "-"
(number > 0) ? number : "-"
end
end
4 changes: 2 additions & 2 deletions app/helpers/shifts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def each_shift(events, &block)

def calendar_day_class(day)
return "prev-month" if day.previous_month?
return "next-month" if day.next_month?
"next-month" if day.next_month?
end

def calendar_day(day, &block)
Expand All @@ -30,7 +30,7 @@ def calendar_day(day, &block)
end

def calendar_date_item_class(day)
return "date-today" if day.today?
"date-today" if day.today?
end

def event_attendees(attendees)
Expand Down
2 changes: 1 addition & 1 deletion app/lib/google/calendar_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def accepted_attendees_count

def times
format = "%l:%M%P"
"#{start.strftime(format).strip} - #{finish.strftime(format).strip}".gsub(/:00/, "").strip
"#{start.strftime(format).strip} - #{finish.strftime(format).strip}".gsub(":00", "").strip
end

def date
Expand Down
2 changes: 1 addition & 1 deletion app/lib/spectre_form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def sequence_layout(method, options = {})
wrapper_options[:class] ||= "" << " form-group #{"has-error" if has_error}"
wrapper_options[:class].strip!

content_label = options[:label] == false ? "" : label(method, (h(label_text).html_safe + required_label(method, display_required)), {class: "form-label #{options[:label_class]}"})
content_label = (options[:label] == false) ? "" : label(method, (h(label_text).html_safe + required_label(method, display_required)), {class: "form-label #{options[:label_class]}"})

@template.content_tag :div, wrapper_options do
content_label.html_safe +
Expand Down
2 changes: 1 addition & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def date

def times
format = "%l:%M%P"
"#{start.strftime(format).strip} - #{finish.strftime(format).strip}".gsub(/:00/, "").strip
"#{start.strftime(format).strip} - #{finish.strftime(format).strip}".gsub(":00", "").strip
end

def attended_by?(email)
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20200925134546_establish_tenant_zero.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class EstablishTenantZero < ActiveRecord::Migration[6.0]
def up
execute "INSERT INTO libraries (#{LIBRARY.keys.join(", ")}, created_at, updated_at)"\
execute "INSERT INTO libraries (#{LIBRARY.keys.join(", ")}, created_at, updated_at)" \
" VALUES (#{LIBRARY.values.map(&connection.method(:quote)).join(", ")}, NOW(), NOW())"

TABLES.each do |table|
Expand Down
4 changes: 2 additions & 2 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driver = if ENV["DOCKER"]
ENV["HEADLESS"] == "true" ? :headless_chrome_in_container : :chrome_in_container
(ENV["HEADLESS"] == "true") ? :headless_chrome_in_container : :chrome_in_container
else
ENV["HEADLESS"] == "true" ? :headless_chrome : nil
(ENV["HEADLESS"] == "true") ? :headless_chrome : nil
end

if driver
Expand Down
Loading