Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
117 changes: 1 addition & 116 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2026-03-01 05:17:50 UTC using RuboCop version 1.85.0.
# on 2026-03-01 05:32:16 UTC using RuboCop version 1.85.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -13,14 +13,6 @@ Bundler/OrderedGems:
Exclude:
- 'Gemfile'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: have_no, not_to
Capybara/NegationMatcher:
Exclude:
- 'spec/features/admin/reverting_crops_spec.rb'

# Offense count: 19
Capybara/NegationMatcherAfterVisit:
Exclude:
Expand All @@ -33,22 +25,6 @@ Capybara/NegationMatcherAfterVisit:
- 'spec/features/members/profile_spec.rb'
- 'spec/features/plantings/planting_a_crop_spec.rb'

# Offense count: 34
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: DefaultSelector.
Capybara/RSpec/HaveSelector:
Exclude:
- 'spec/features/conversations/index_spec.rb'
- 'spec/features/footer_spec.rb'
- 'spec/features/gardens/adding_gardens_spec.rb'
- 'spec/features/harvests/harvesting_a_crop_spec.rb'
- 'spec/features/members/list_spec.rb'
- 'spec/features/plantings/planting_a_crop_spec.rb'
- 'spec/features/seeds/adding_seeds_spec.rb'
- 'spec/features/shared_examples/crop_suggest.rb'
- 'spec/support/feature_helpers.rb'
- 'spec/views/posts/show.html.haml_spec.rb'

# Offense count: 14
Capybara/SpecificMatcher:
Exclude:
Expand Down Expand Up @@ -101,48 +77,13 @@ FactoryBot/SyntaxMethods:

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
Layout/EmptyLinesAroundClassBody:
Exclude:
- 'db/migrate/20251130035700_create_versions.rb'

# Offense count: 312
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
# SupportedColonStyles: key, separator, table
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Layout/HashAlignment:
Exclude:
- 'app/helpers/application_helper.rb'
- 'app/helpers/crops_helper.rb'
- 'app/models/concerns/search_harvests.rb'
- 'app/models/concerns/search_plantings.rb'
- 'app/models/crop.rb'
- 'config/sitemap.rb'
- 'lib/tasks/import.rake'
- 'spec/requests/api/v1/activities_request_spec.rb'
- 'spec/requests/api/v1/members_request_spec.rb'

# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
Layout/HeredocIndentation:
Exclude:
- 'db/migrate/20190712003735_add_like_counter_caches.rb'
- 'db/migrate/20191226024813_crop_harvest_counter_cache.rb'
- 'db/migrate/20191226024957_crop_photo_counter_cache.rb'
- 'db/migrate/20191226025124_plant_part_harvest_counter_cache.rb'
- 'db/migrate/20191226025225_post_comment_counter_cache.rb'
- 'db/migrate/20250824085224_add_photos_comment_count.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
# SupportedStylesAlignWith: start_of_line, relative_to_receiver
Layout/IndentationWidth:
Exclude:
- 'spec/requests/api/v1/activities_request_spec.rb'

# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
Expand All @@ -157,20 +98,6 @@ Layout/LineLength:
- 'db/seeds.rb'
- 'spec/requests/api/v1/activities_request_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'Gemfile'
- 'app/helpers/crops_helper.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperatorPrecedence:
Exclude:
- 'app/controllers/activities_controller.rb'

# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: RequireParenthesesForMethodChains.
Expand Down Expand Up @@ -337,12 +264,6 @@ RSpec/ContextMethod:
RSpec/ContextWording:
Enabled: false

# Offense count: 1
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Exclude:
- 'spec/tasks/import_spec.rb'

# Offense count: 36
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
Expand Down Expand Up @@ -370,13 +291,6 @@ RSpec/EmptyExampleGroup:
- 'spec/views/photos/edit.html.haml_spec.rb'
- 'spec/views/posts/_single.html.haml_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowConsecutiveOneLiners.
RSpec/EmptyLineAfterExample:
Exclude:
- 'spec/models/ability_spec.rb'

# Offense count: 146
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Expand All @@ -403,20 +317,6 @@ RSpec/ExpectInHook:
- 'spec/features/plantings/planting_a_crop_spec.rb'
- 'spec/features/shared_examples/append_date.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, each, example
RSpec/HookArgument:
Exclude:
- 'spec/requests/api/v1/plantings_request_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
RSpec/HooksBeforeExamples:
Exclude:
- 'spec/features/crops/creating_a_crop_spec.rb'

# Offense count: 53
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/IncludeExamples:
Expand Down Expand Up @@ -462,12 +362,6 @@ RSpec/InstanceVariable:
RSpec/LetSetup:
Enabled: false

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
RSpec/MatchArray:
Exclude:
- 'spec/models/post_spec.rb'

# Offense count: 2
RSpec/MessageChain:
Exclude:
Expand Down Expand Up @@ -753,15 +647,6 @@ Rails/RootPathnameMethods:
- 'lib/tasks/import.rake'
- 'spec/rails_helper.rb'

# Offense count: 4
# Configuration parameters: ForbiddenMethods, AllowedMethods.
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all
Rails/SkipsModelValidations:
Exclude:
- 'db/migrate/20240101010102_populate_crop_fields_from_openfarm_data.rb'
- 'db/migrate/20240810160538_set_default_language_for_existing_alternate_names.rb'
- 'db/migrate/20251128200506_add_description_to_crops.rb'

# Offense count: 21
Rails/ThreeStateBooleanColumn:
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ gem "msgpack"
# Pinned due to RAILS_ENV=production bundle exec rake assets:precompile failing with ArgumentError: wrong number of arguments (given 1, expected 0) (ArgumentError)
# /tmp/build_8301a541/vendor/bundle/ruby/3.3.0/gems/connection_pool-3.0.2/lib/connection_pool.rb:48:in `initialize'
# /tmp/build_8301a541/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.3/lib/active_support/cache/mem_cache_store.rb:63:in `new'
gem "connection_pool", "< 3"
gem "connection_pool", "< 3"

group :production do
gem 'bonsai-elasticsearch-rails' # Integration with Bonsa-Elasticsearch on heroku
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def create

repeat_times.times do |i|
new_activity = @activity.dup
new_activity.due_date = @activity.due_date + (i + 1) * repeat_weeks.weeks
new_activity.due_date = @activity.due_date + ((i + 1) * repeat_weeks.weeks)
new_activity.save
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def github_releases
doc = Nokogiri::XML(response.body)
doc.xpath('//xmlns:entry').first(2).map do |entry|
{
title: entry.xpath('xmlns:title').text,
title: entry.xpath('xmlns:title').text,
content: entry.xpath('xmlns:content').text,
link: entry.xpath('xmlns:link/@href').text,
link: entry.xpath('xmlns:link/@href').text,
updated: entry.xpath('xmlns:updated').text
}
end
Expand Down
10 changes: 5 additions & 5 deletions app/helpers/crops_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ def crop_jsonld_data(crop, full_attributes: true)

crop.posts.each do |post|
subject_of_entities << {
'@type': "SocialMediaPosting",
url: post_url(post),
author: {
'@type': "SocialMediaPosting",
url: post_url(post),
author: {
'@type': 'Person',
name: post.author.login_name
name: post.author.login_name
},
'datePublished': post.created_at
'datePublished': post.created_at
}
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/search_harvests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def self.homepage_records(limit)
# Disabled for now so that more relevant harvests are
# surfaced; even if we're falling back to crop photos.
# photos_count: { gt: 0 },
owner_id: { not: owners }
owner_id: { not: owners }
}
one_record = search('*',
limit: 1,
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/search_plantings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def self.homepage_records(limit)
# Disabled for now so that more relevant plantings are
# surfaced; even if we're falling back to crop photos.
# photos_count: { gt: 0 },
owner_id: { not: owners }
owner_id: { not: owners }
}
one_record = search('*',
limit: 1,
Expand Down
4 changes: 2 additions & 2 deletions config/sitemap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

SitemapGenerator::Sitemap.adapter = SitemapGenerator::AwsSdkAdapter.new(
ENV['S3_SITEMAP_BUCKET'],
access_key_id: ENV['S3_ACCESS_KEY'],
access_key_id: ENV['S3_ACCESS_KEY'],
secret_access_key: ENV['S3_SECRET_KEY'],
region: ENV.fetch('S3_AWS_REGION', 'us-east-1')
region: ENV.fetch('S3_AWS_REGION', 'us-east-1')
)

SitemapGenerator::Sitemap.create do
Expand Down
32 changes: 16 additions & 16 deletions db/migrate/20190712003735_add_like_counter_caches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ def change
end

def data
execute <<-SQL.squish
UPDATE photos
SET likes_count = (
SELECT count(1)
FROM likes
WHERE likes.likeable_id = photos.id
AND likeable_type = 'Photo'
)
execute <<~SQL.squish
UPDATE photos
SET likes_count = (
SELECT count(1)
FROM likes
WHERE likes.likeable_id = photos.id
AND likeable_type = 'Photo'
)
SQL
execute <<-SQL.squish
UPDATE posts
SET likes_count = (
SELECT count(1)
FROM likes
WHERE likes.likeable_id = posts.id
AND likeable_type = 'Post'
)
execute <<~SQL.squish
UPDATE posts
SET likes_count = (
SELECT count(1)
FROM likes
WHERE likes.likeable_id = posts.id
AND likeable_type = 'Post'
)
SQL
end
end
14 changes: 7 additions & 7 deletions db/migrate/20191226024813_crop_harvest_counter_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ def change
end

def set_counter_value
execute <<-SQL.squish
UPDATE crops
SET harvests_count = (
SELECT count(1)
FROM harvests
WHERE harvests.crop_id = crops.id
)
execute <<~SQL.squish
UPDATE crops
SET harvests_count = (
SELECT count(1)
FROM harvests
WHERE harvests.crop_id = crops.id
)
SQL
end
end
14 changes: 7 additions & 7 deletions db/migrate/20191226024957_crop_photo_counter_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ def change
end

def set_counter_value
execute <<-SQL.squish
UPDATE crops
SET photo_associations_count = (
SELECT count(1)
FROM photo_associations
WHERE photo_associations.crop_id = crops.id
)
execute <<~SQL.squish
UPDATE crops
SET photo_associations_count = (
SELECT count(1)
FROM photo_associations
WHERE photo_associations.crop_id = crops.id
)
SQL
end
end
14 changes: 7 additions & 7 deletions db/migrate/20191226025124_plant_part_harvest_counter_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ def change
end

def set_counter_value
execute <<-SQL.squish
UPDATE plant_parts
SET harvests_count = (
SELECT count(1)
FROM harvests
WHERE harvests.plant_part_id = plant_parts.id
)
execute <<~SQL.squish
UPDATE plant_parts
SET harvests_count = (
SELECT count(1)
FROM harvests
WHERE harvests.plant_part_id = plant_parts.id
)
SQL
end
end
2 changes: 1 addition & 1 deletion db/migrate/20191226025225_post_comment_counter_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def change
end

def set_counter_value
execute <<-SQL.squish
execute <<~SQL.squish
UPDATE posts
SET comments_count = (
SELECT count(1)
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20250824085224_add_photos_comment_count.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def change
end

def set_counter_value
execute <<-SQL.squish
execute <<~SQL.squish
UPDATE photos
SET comments_count = (
SELECT count(1)
Expand Down
Loading
Loading