Skip to content

Commit

Permalink
Fix rubocop violations
Browse files Browse the repository at this point in the history
  • Loading branch information
willcosgrove committed Jul 31, 2024
1 parent b25313e commit a0ad312
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 17 deletions.
6 changes: 3 additions & 3 deletions lib/generators/phlex/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def autoload_components
inject_into_class(
APPLICATION_CONFIGURATION_PATH,
"Application",
%( config.autoload_paths << "\#{root}/app/views/components"\n)
%( config.autoload_paths << "\#{root}/app/views/components"\n),
)
end

Expand All @@ -23,7 +23,7 @@ def autoload_layouts
inject_into_class(
APPLICATION_CONFIGURATION_PATH,
"Application",
%( config.autoload_paths << "\#{root}/app/views/layouts"\n)
%( config.autoload_paths << "\#{root}/app/views/layouts"\n),
)
end

Expand All @@ -33,7 +33,7 @@ def autoload_views
inject_into_class(
APPLICATION_CONFIGURATION_PATH,
"Application",
%( config.autoload_paths << "\#{root}/app/views"\n)
%( config.autoload_paths << "\#{root}/app/views"\n),
)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/phlex/rails/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ module Phlex::Rails::Helpers
StyleSheetPath: :StylesheetPath,
StyleSheetURL: :StylesheetURL,
URLToJavaScript: :URLToJavascript,
URLToStyleSheet: :URLToStylesheet
URLToStyleSheet: :URLToStylesheet,
}

def self.const_missing(name)
Expand Down
2 changes: 1 addition & 1 deletion lib/phlex/rails/helpers/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def tag(...)
when ActionView::Helpers::TagHelper::TagBuilder
Phlex::Rails::Buffered.new(
result,
view: self
view: self,
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/phlex/rails/helpers/turbo_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Phlex::Rails::Helpers::TurboStream
def turbo_stream(...)
Phlex::Rails::Buffered.new(
helpers.turbo_stream(...),
view: self
view: self,
)
end
end
2 changes: 1 addition & 1 deletion lib/phlex/rails/html/method_missing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ def method_missing(name, *args, **kwargs, &block)
module_name = Phlex::Rails::Helpers.constants.find { |mod| mod.to_s.underscore.gsub("domid", "dom_id") == const_name }
return super unless module_name

raise NoMethodError, "Try including `Phlex::Rails::Helpers::#{module_name}` in #{self.class.name}."
raise NoMethodError.new("Try including `Phlex::Rails::Helpers::#{module_name}` in #{self.class.name}.")
end
end
3 changes: 1 addition & 2 deletions lib/phlex/rails/layout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def virtual_path

def self.included(klass)
unless klass < Phlex::HTML
raise Phlex::ArgumentError,
"👋 #{name} should only be included into Phlex::HTML classes."
raise Phlex::ArgumentError.new("👋 #{name} should only be included into Phlex::HTML classes.")
end

klass.extend(Interface)
Expand Down
2 changes: 1 addition & 1 deletion lib/phlex/rails/streaming.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def stream_html(view)

debug_middleware = ActionDispatch::DebugExceptions.new(
proc { |_env| raise(e) },
response_format: :html
response_format: :html,
)

_debug_status, _debug_headers, debug_body = debug_middleware.call(request.env)
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Application < Rails::Application
config.autoload_paths << "#{root}/app/views"
config.autoload_paths << "#{root}/app/views/layouts"
config.autoload_paths << "#{root}/app/views/components"
config.load_defaults Rails::VERSION::STRING.to_f
config.load_defaults "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}"

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

config.cache_store = :memory_store
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}"
"Cache-Control" => "public, max-age=#{Integer(2.days)}",
}
else
config.action_controller.perform_caching = false
Expand Down
4 changes: 2 additions & 2 deletions test/dummy/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@

# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new($stdout)
.tap { |logger| logger.formatter = Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
.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]
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
"Cache-Control" => "public, max-age=#{Integer(1.hour)}",
}

# Show full error reports and disable caching.
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# 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

# Defines the root path route ("/")
root "posts#index"
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
if ActiveSupport::TestCase.respond_to?(:fixture_paths=)
ActiveSupport::TestCase.fixture_paths = [File.expand_path("fixtures", __dir__)]
ActionDispatch::IntegrationTest.fixture_paths = ActiveSupport::TestCase.fixture_paths
ActiveSupport::TestCase.file_fixture_path = File.expand_path("fixtures", __dir__) + "/files"
ActiveSupport::TestCase.file_fixture_path = "#{File.expand_path('fixtures', __dir__)}/files"
ActiveSupport::TestCase.fixtures :all
end

0 comments on commit a0ad312

Please sign in to comment.