Skip to content

Commit

Permalink
Add extension cops, autocorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcgibbon committed Dec 23, 2023
1 parent bd59fb7 commit 4a1fda9
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
inherit_from:
- https://raw.githubusercontent.com/gmcgibbon/dotfiles/main/rubocop.yml

require:
- rubocop-rails
- rubocop-capybara

AllCops:
TargetRubyVersion: 3.3.0
Exclude:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ gem "blog", path: "blog"

# Code linting
gem "rubocop", require: false
gem "rubocop-capybara"
gem "rubocop-rails", require: false

gem "tailwindcss-rails"
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-rails (2.12.4)
activesupport (>= 4.2.0)
rack (>= 1.1)
Expand Down Expand Up @@ -318,6 +320,7 @@ DEPENDENCIES
rack-mini-profiler (~> 2.0)
rails!
rubocop
rubocop-capybara
rubocop-rails
selenium-webdriver (= 4.0.0.beta3)
spring
Expand Down
10 changes: 5 additions & 5 deletions app/components/application_page_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ class ApplicationPageComponent < ApplicationComponent

def favicon_meta_tags
[
tag("link", rel: "icon", href: "/favicon.ico", sizes: "any"),
tag("link", rel: "icon", href: "/icon.svg", type: "image/svg+xml"),
tag("link", rel: "apple-touch-icon", href: "/apple-touch-icon.png", type: "image/svg+xml"),
tag("link", rel: "manifest", href: "/manifest.webmanifest")
].join("\n").html_safe
tag.link(rel: "icon", href: "/favicon.ico", sizes: "any"),
tag.link(rel: "icon", href: "/icon.svg", type: "image/svg+xml"),
tag.link(rel: "apple-touch-icon", href: "/apple-touch-icon.png", type: "image/svg+xml"),
tag.link(rel: "manifest", href: "/manifest.webmanifest")
].join("\n").html_safe # rubocop:disable Rails/OutputSafety
end
end
2 changes: 1 addition & 1 deletion blog/lib/blog/document_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def render_erb(text, context:)
end

def render_md(text, context:) # rubocop:disable Lint/UnusedMethodArgument
markdown_parser.render(text).html_safe
markdown_parser.render(text).html_safe # rubocop:disable Rails/OutputSafety
end

def markdown_parser
Expand Down
2 changes: 1 addition & 1 deletion blog/test/models/article_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ArticleTest < ActiveSupport::TestCase
end

test "#render_in" do
today = Date.today.strftime("%A")
today = Time.zone.today.strftime("%A")

context = time_context(day: today)

Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp", "caching-dev.txt").exist?
if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true

Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)

self.file_fixture_path = "#{Rails.root}/test/fixtures/files"
self.file_fixture_path = Rails.root.join("test/fixtures/files").to_s

ApplicationRecord.base_path = Pathname.new(file_fixture_path)

Expand Down

0 comments on commit 4a1fda9

Please sign in to comment.