Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrades pt 4: Dependency updates & Old gem removal #863

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
89 changes: 83 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,70 @@
inherit_from: .rubocop_todo.yml

inherit_gem:
rubocop-github:
- config/default.yml
- config/rails.yml
- config/default_edge.yml
- config/rails_edge.yml

AllCops:
TargetRailsVersion: 4.2
TargetRubyVersion: 2.3
TargetRailsVersion: 5.0
TargetRubyVersion: 2.7
NewCops: disable
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'bin/**/*'
- 'vendor/**/*'
- 'features/**/*'

# Handle cops not enabled by default
# Should probably be checked on rubocop version upgrades
# Last checked 02/09/21
# Disables cops marked as unsafe in docs

Layout/SpaceAroundMethodCallOperator:
Enabled: true

Lint/RaiseException:
Enabled: true

Lint/StructNewOverride:
Enabled: true

Style/ExponentialNotation:
Enabled: true

Style/HashEachMethods:
Enabled: false

Style/HashTransformKeys:
Enabled: false

Style/HashTransformValues:
Enabled: false

Performance/AncestorsInclude:
Enabled: false

Performance/BigDecimalWithNumericArgument:
Enabled: true

Performance/RedundantSortBlock:
Enabled: true

Performance/RedundantStringChars:
Enabled: true

Performance/ReverseFirst:
Enabled: true

Performance/SortReverse:
Enabled: true

Performance/Squeeze:
Enabled: true

Performance/StringInclude:
Enabled: true

### Override rubcop-github ###

Expand All @@ -31,7 +85,7 @@ GitHub/RailsControllerRenderPathsExist:
Enabled: false

GitHub/RailsApplicationRecord:
# Doesn't apply to < Rails 5.0, and ignores TargetRailsVersion
# Rails/ApplicationRecord does the same thing
Enabled: false

Lint/Void:
Expand All @@ -43,7 +97,7 @@ Lint/Debugger:
Exclude:
- 'features/step_definitions/debug_steps.rb'

Style/BlockComments:
Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/**/*'

Expand All @@ -65,7 +119,30 @@ Layout/MultilineHashBraceLayout:
Layout/SpaceAroundOperators:
Enabled: true

Naming/PredicateName:
Exclude:
- 'spec/**/*'

Security/JSONLoad:
Enabled: true
Exclude:
- 'spec/**/*'

Rails/HttpStatus:
EnforcedStyle: 'numeric'

Style/Alias:
Enabled: false

Style/BlockComments:
Exclude:
- 'spec/**/*'

Style/ClassAndModuleChildren:
EnforcedStyle: 'compact'

Style/Documentation:
Enabled: false

Style/NumericLiterals:
MinDigits: 6
186 changes: 186 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 100`
# on 2021-02-11 14:07:46 -0800 using RuboCop version 0.82.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
# versions of RuboCop, may require this file to be generated again.

# Offense count: 3
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
# NamePrefix: is_, has_, have_
# ForbiddenPrefixes: is_, has_, have_
# AllowedMethods: is_a?
# MethodDefinitionMacros: define_method, define_singleton_method
Naming/PredicateName:
Exclude:
- 'spec/**/*'

# Offense count: 45
# Configuration parameters: EnforcedStyle.
# SupportedStyles: snake_case, camelCase
Naming/VariableName:
Exclude:
- 'app/controllers/action_page_controller.rb'
- 'app/controllers/admin/action_pages_controller.rb'
- 'app/controllers/admin/mailer_controller.rb'
- 'app/controllers/admin/petitions_controller.rb'
- 'app/controllers/congress_messages_controller.rb'
- 'app/controllers/tools_controller.rb'
- 'app/controllers/users_controller.rb'
- 'app/controllers/welcome_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/devise_helper.rb'
- 'app/mailers/user_mailer.rb'
- 'app/models/markdown_renderer.rb'
- 'app/views/action_page/index.atom.builder'
- 'app/views/action_page/index.json.jbuilder'
- 'spec/controllers/action_page_controller_spec.rb'
- 'spec/controllers/admin/institutions_controller_spec.rb'

# Offense count: 2
# Cop supports --auto-correct.
Rails/ApplicationController:
Exclude:
- 'app/controllers/exceptions_controller.rb'
- 'spec/controllers/concerns/request_origin_validation_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Rails/ApplicationMailer:
Exclude:
- 'app/mailers/user_mailer.rb'

# Offense count: 29
# Cop supports --auto-correct.
Rails/ApplicationRecord:
Exclude:
- 'app/models/action_institution.rb'
- 'app/models/action_page.rb'
- 'app/models/affiliation.rb'
- 'app/models/affiliation_type.rb'
- 'app/models/ahoy/event.rb'
- 'app/models/bounce.rb'
- 'app/models/call_campaign.rb'
- 'app/models/category.rb'
- 'app/models/complaint.rb'
- 'app/models/congress_member.rb'
- 'app/models/congress_message_campaign.rb'
- 'app/models/congress_scorecard.rb'
- 'app/models/email_campaign.rb'
- 'app/models/featured_action_page.rb'
- 'app/models/institution.rb'
- 'app/models/partner.rb'
- 'app/models/partnership.rb'
- 'app/models/petition.rb'
- 'app/models/signature.rb'
- 'app/models/source_file.rb'
- 'app/models/subscription.rb'
- 'app/models/topic.rb'
- 'app/models/topic_category.rb'
- 'app/models/topic_set.rb'
- 'app/models/tweet.rb'
- 'app/models/tweet_target.rb'
- 'app/models/user.rb'
- 'app/models/user_preference.rb'
- 'app/models/visit.rb'

# Offense count: 2
# Configuration parameters: EnforcedStyle.
# SupportedStyles: slashes, arguments
Rails/FilePath:
Exclude:
- 'lib/tasks/webshims_asset_compile.rake'

# Offense count: 25
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/action_page.rb'
- 'app/models/affiliation_type.rb'
- 'app/models/call_campaign.rb'
- 'app/models/congress_message_campaign.rb'
- 'app/models/email_campaign.rb'
- 'app/models/institution.rb'
- 'app/models/partner.rb'
- 'app/models/petition.rb'
- 'app/models/signature.rb'
- 'app/models/topic_category.rb'
- 'app/models/tweet.rb'
- 'app/models/user.rb'
- 'app/models/visit.rb'

# Offense count: 15
# Configuration parameters: Include.
# Include: app/helpers/**/*.rb
Rails/HelperInstanceVariable:
Exclude:
- 'app/helpers/action_page_helper.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/devise_helper.rb'
- 'app/helpers/petition_helper.rb'

# Offense count: 6
# Configuration parameters: Include.
# Include: app/controllers/**/*.rb
Rails/LexicallyScopedActionFilter:
Exclude:
- 'app/controllers/admin/action_pages_controller.rb'
- 'app/controllers/admin/partners_controller.rb'
- 'app/controllers/petition_controller.rb'
- 'app/controllers/sessions_controller.rb'
- 'app/controllers/tools_controller.rb'

# Offense count: 3
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/UniqueValidationWithoutIndex:
Exclude:
- 'app/models/congress_member.rb'
- 'app/models/institution.rb'
- 'app/models/partner.rb'

# Offense count: 1
Security/Open:
Exclude:
- 'lib/related_content.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'app/models/ahoy/event.rb'
- 'lib/monkey_patches/octet_stream_override.rb'

# Offense count: 17
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'app/controllers/action_page_controller.rb'
- 'app/controllers/admin/action_pages_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/controllers/concerns/action_page_display.rb'
- 'app/controllers/concerns/request_origin_validation.rb'
- 'app/controllers/congress_messages_controller.rb'
- 'app/controllers/partners_controller.rb'
- 'app/controllers/registrations_controller.rb'
- 'app/controllers/sessions_controller.rb'
- 'app/controllers/tools_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/models/ahoy/event.rb'
- 'lib/call_tool.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'app/controllers/tools_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/models/action_page.rb'
- 'app/models/petition.rb'
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.5
2.7.2
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ before_script:
- npm install
- cp config/database.yml.travis config/database.yml
- psql -c 'create database travis_ci_test;' -U postgres
- RAILS_ENV=test bundle exec rails webdrivers:chromedriver:update
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
script:
- bundle exec rubocop
- $(npm bin)/sass-lint -vq
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.5-stretch
FROM ruby:2.7-slim

RUN mkdir /opt/actioncenter
WORKDIR /opt/actioncenter
Expand Down Expand Up @@ -66,7 +66,6 @@ RUN bundle exec rake assets:precompile \
devise_secret_key=noop \
amazon_region=noop \
DATABASE_URL=postgres://noop
RUN bundle exec rake webshims:update_public

RUN mkdir /opt/actioncenter/log \
/var/www
Expand Down
Loading