Skip to content

Commit

Permalink
rubocop -A
Browse files Browse the repository at this point in the history
  • Loading branch information
mrysav committed Oct 4, 2024
1 parent 52d2c39 commit d6ee939
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ AllCops:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'bin/{rails,rake}'
- 'bin/*'

Layout/LineLength:
Max: 120
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/restore_snapshot_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def perform(snapshot)
updated_at = n.updated_at
n.rich_content = v
n.save_without_history!
n.update_columns(updated_at: updated_at)
n.update_columns(updated_at:)
end

json_buffer.each do |k, v|
Expand Down Expand Up @@ -106,7 +106,7 @@ def handle_note(filename, io, notes_buffer)
blob = ActiveStorage::Blob.create_and_upload!(
io: StringIO.new(io.read),
filename: fname,
content_type: content_type
content_type:
)
sgid = blob.to_sgid(expires_in: nil, for: "attachable")
url = rails_blob_path(blob, disposition: :attachment, only_path: true)
Expand Down
2 changes: 1 addition & 1 deletion app/models/citation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def parse_attrs
parsed_links = linkify.match(text)

self.attrs = {
text: text,
text:,
links: parsed_links
}
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/search_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def set_key

def update_fts
delete_fts
SearchDocument::FtsSearchDocument.create!(key: key, content: content)
SearchDocument::FtsSearchDocument.create!(key:, content:)
end

def delete_fts
SearchDocument::FtsSearchDocument.delete_by(key: key)
SearchDocument::FtsSearchDocument.delete_by(key:)
end

# This does some funky manuevering to query the fts_search_documents
Expand Down
2 changes: 1 addition & 1 deletion app/services/events/events_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def events
title_link = fact.factable.friendly_url if fact.factable
title = fact.fact_type.capitalize unless fact.factable

events.push(Event.new(title: title, title_link: title_link, date: fact.date,
events.push(Event.new(title:, title_link:, date: fact.date,
date_string: format_date(fact.date),
location: fact.place, citations: fact.citations,
tagged_people: fact.resolved_people,
Expand Down
8 changes: 4 additions & 4 deletions lib/generator/accounts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ module Generator
# Defines a method that can be used in rake tasks to generate user accounts.
module Accounts
def self.create_account(name, email, password, admin: false)
if User.where(email: email).count.positive?
if User.where(email:).count.positive?
Rails.logger.info "Account #{email} already exists."
return
end

Rails.logger.info "Creating account #{email} with password #{password}"

User.create!(name: name, email: email,
password: password, password_confirmation: password,
admin: admin)
User.create!(name:, email:,
password:, password_confirmation: password,
admin:)
end
end
end
2 changes: 1 addition & 1 deletion lib/tasks/permissions.rake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace :admin do
end

def set_admin(email, is_admin)
user = User.find_by(email: email)
user = User.find_by(email:)
user.admin = is_admin
user.save!
puts "#{email} is admin: #{is_admin}"
Expand Down
4 changes: 2 additions & 2 deletions spec/jobs/restore_snapshot_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def digest_snapshot(snapshot)
digest_contents
end

ACTION_TEXT_ATTACHMENT = %r{<action-text-attachment(.+?)>.+</action-text-attachment>}m.freeze
ACTION_TEXT_ATTACHMENT = %r{<action-text-attachment(.+?)>.+</action-text-attachment>}m

def normalize_note_html(note_html)
attachments = []
Expand All @@ -125,7 +125,7 @@ def normalize_note_html(note_html)
normalized_text = note_html.gsub(ACTION_TEXT_ATTACHMENT, "")

{
attachments: attachments,
attachments:,
contents: normalized_text
}
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/note_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "rails_helper"

RSpec.describe Note do
let(:note) { described_class.new(id: 1, title: "Test note!", rich_content: "Hello world!", date_string: date_string) }
let(:note) { described_class.new(id: 1, title: "Test note!", rich_content: "Hello world!", date_string:) }

describe "#date" do
context "with no date_string" do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/photo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

RSpec.describe Photo do
let(:photo) do
described_class.new(id: 1, title: "Imageless photo", description: "*Here we go!*", date_string: date_string)
described_class.new(id: 1, title: "Imageless photo", description: "*Here we go!*", date_string:)
end

describe "#date" do
Expand Down

0 comments on commit d6ee939

Please sign in to comment.