Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jackrosa183 committed Sep 5, 2024
1 parent b4df24d commit 13fad36
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 20 deletions.
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ gem "tailwindcss-rails"
gem "jbuilder"

gem "ostruct"

gem "standard", ">= 1.35.1"
# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"

Expand All @@ -30,7 +32,7 @@ gem "ostruct"
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ]
gem "tzinfo-data", platforms: %i[windows jruby]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
Expand All @@ -40,7 +42,7 @@ gem "bootsnap", require: false

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
gem "debug", platforms: %i[mri windows], require: "debug/prelude"

# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
gem "brakeman", require: false
Expand Down
19 changes: 17 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ GEM
activesupport (>= 5.0.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
logger (1.6.1)
loofah (2.22.0)
crass (~> 1.0.2)
Expand Down Expand Up @@ -210,14 +211,15 @@ GEM
reline (0.5.10)
io-console (~> 0.5)
rexml (3.3.7)
rubocop (1.66.1)
rubocop (1.65.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
Expand Down Expand Up @@ -254,6 +256,18 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
standard (1.40.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.65.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.4)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.4.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
stimulus-rails (1.3.4)
railties (>= 6.0.0)
stringio (3.1.1)
Expand Down Expand Up @@ -315,6 +329,7 @@ DEPENDENCIES
rubocop-rails-omakase
selenium-webdriver
sprockets-rails
standard (>= 1.35.1)
stimulus-rails
tailwindcss-rails
turbo-rails
Expand Down
4 changes: 2 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
config.action_controller.enable_fragment_cache_logging = true

config.cache_store = :memory_store
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
config.public_file_server.headers = {"Cache-Control" => "public, max-age=#{2.days.to_i}"}

Check failure on line 27 in config/environments/development.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside { missing.

Check failure on line 27 in config/environments/development.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
else
config.action_controller.perform_caching = false

Expand All @@ -41,7 +41,7 @@
# caching is enabled.
config.action_mailer.perform_caching = false

config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
config.action_mailer.default_url_options = {host: "localhost", port: 3000}

Check failure on line 44 in config/environments/development.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside { missing.

Check failure on line 44 in config/environments/development.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside } missing.

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
Expand Down
4 changes: 2 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@

# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new(STDOUT)
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
config.log_tags = [:request_id]

Check failure on line 63 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideArrayLiteralBrackets: Use space inside array brackets.

Check failure on line 63 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideArrayLiteralBrackets: Use space inside array brackets.

# "info" includes generic and useful information about system operation, but avoids logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
Expand Down
4 changes: 2 additions & 2 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
config.eager_load = ENV["CI"].present?

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
config.public_file_server.headers = {"Cache-Control" => "public, max-age=#{1.hour.to_i}"}

Check failure on line 21 in config/environments/test.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside { missing.

Check failure on line 21 in config/environments/test.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside } missing.

# Show full error reports and disable caching.
config.consider_all_requests_local = true
Expand All @@ -45,7 +45,7 @@

# Unlike controllers, the mailer instance doesn't have any context about the
# incoming request so you'll need to provide the :host parameter yourself.
config.action_mailer.default_url_options = { host: "www.example.com" }
config.action_mailer.default_url_options = {host: "www.example.com"}

Check failure on line 48 in config/environments/test.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside { missing.

Check failure on line 48 in config/environments/test.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideHashLiteralBraces: Space inside } missing.

# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
Expand Down
8 changes: 4 additions & 4 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Rails.application.routes.draw do
resources :rooms, only: [ :index, :show, :new, :create ] do
resources :rooms, only: [:index, :show, :new, :create] do
resources :messages, only: :create
end
root "rooms#index"
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get "up" => "rails/health#show", as: :rails_health_check
get "up" => "rails/health#show", :as => :rails_health_check

# Render dynamic PWA files from app/views/pwa/*
get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
get "service-worker" => "rails/pwa#service_worker", :as => :pwa_service_worker
get "manifest" => "rails/pwa#manifest", :as => :pwa_manifest
end
2 changes: 1 addition & 1 deletion test/application_system_test_case.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "test_helper"

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
end
3 changes: 2 additions & 1 deletion test/models/message_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ class MessageTest < ActiveSupport::TestCase
test "message must have content" do
room = Room.last
message = Message.create(room_id: room.id)
assert_not message.save()
assert_not message.save

message = Message.create(content: "Hello World", room_id: room.id)
assert message.save
end
end
3 changes: 0 additions & 3 deletions test/system/user_creates_a_message_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ class UserCreatesAMessageTest < ApplicationSystemTestCase
test "User creates a message" do
visit rooms_url
click_button("+")
assert current_path = new_room_path
fill_in("Name", with: "test room")
click_button("Create Room")
assert_selector "div", text: "test room"
click_link("test room")
room = Room.last
assert current_path = room_path(room.id)
fill_in("message[content]", with: "my test message")
click_button("Send")
assert_selector "div", text: "my test message"
Expand Down
1 change: 0 additions & 1 deletion test/system/user_creates_new_rooms_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class UserCreatesNewRoomsTest < ApplicationSystemTestCase
test "creating a new room" do
visit rooms_url
click_button("+")
assert current_path = new_room_path
fill_in("Name", with: "test room")
click_button("Create Room")
assert_selector "div", text: "test room"
Expand Down

0 comments on commit 13fad36

Please sign in to comment.