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

Add Rubocop Linter #8

Merged
merged 3 commits into from
Apr 29, 2024
Merged
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
16 changes: 16 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# The behavior of RuboCop can be controlled via the .rubocop.yml
# configuration file. It makes it possible to enable/disable
# certain cops (checks) and to alter their behavior if they accept
# any parameters. The file can be placed either in your home
# directory or in some project directory.
#
# RuboCop will start looking for the configuration file in the directory
# where the inspected file is and continue its way up to the root directory.
#
# See https://docs.rubocop.org/rubocop/configuration
require:
- rubocop-rspec
inherit_gem:
rubocop-rails-omakase: rubocop.yml
AllCops:
NewCops: enable
35 changes: 16 additions & 19 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,23 @@ gem "bootsnap", require: false
# Use Sass to process CSS
# gem "sassc-rails"

gem "secure_headers", "~> 6.3"

gem "newrelic_rpm", "~> 8.4"

gem "sidekiq", "~> 6.4"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "brakeman", "~> 5.2"
gem "bundler-audit", "~> 0.9"
gem "debug", platforms: %i[mri mingw x64_mingw]
gem "dotenv-rails", "~> 2.7"
gem "i18n-tasks", "~> 1.0"
gem "rspec-rails", "~> 5.1"
gem "rubocop"
gem "rubocop-rspec"
gem "rubocop-rails-omakase"
gem "standard", "~> 1.7"
end

group :development do
Expand All @@ -62,26 +76,9 @@ group :development do

# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
gem "rails-erd", "~> 1.7"
end

gem "secure_headers", "~> 6.3"

group :development, :test do
gem "rspec-rails", "~> 5.1"
gem "dotenv-rails", "~> 2.7"
gem "brakeman", "~> 5.2"
gem "bundler-audit", "~> 0.9"
gem "standard", "~> 1.7"
end
gem "rails_template_18f", group: :development
gem "rails-erd", "~> 1.7", group: :development

group :development, :test do
gem "i18n-tasks", "~> 1.0"
end
gem "newrelic_rpm", "~> 8.4"
gem "sidekiq", "~> 6.4"

group :test do
gem "climate_control", "~> 1.0"
end
34 changes: 27 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ GEM
thor (~> 1.0)
choice (0.2.0)
climate_control (1.2.0)
colorize (0.8.1)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
crass (1.0.6)
Expand Down Expand Up @@ -200,11 +199,6 @@ GEM
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
rails_template_18f (0.8.0)
activesupport (~> 7.0.0)
colorize (~> 0.8)
railties (~> 7.0.0)
thor (~> 1.0)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
Expand Down Expand Up @@ -251,9 +245,33 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-minitest (0.35.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.24.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails-omakase (1.0.0)
rubocop
rubocop-minitest
rubocop-performance
rubocop-rails
rubocop-rspec (2.29.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.3)
rubocop (~> 1.40)
ruby-graphviz (1.2.5)
rexml
ruby-progressbar (1.13.0)
Expand Down Expand Up @@ -327,9 +345,11 @@ DEPENDENCIES
puma (~> 5.0)
rails (~> 7.0.8, >= 7.0.8.1)
rails-erd (~> 1.7)
rails_template_18f
redis (~> 4.0)
rspec-rails (~> 5.1)
rubocop
rubocop-rails-omakase
rubocop-rspec
secure_headers (~> 6.3)
sidekiq (~> 6.4)
sprockets-rails
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class ProvidersController < ApplicationController
USER_TOKEN_ENDPOINT = 'https://api-sandbox.argyle.com/v2/users';
USER_TOKEN_ENDPOINT = "https://api-sandbox.argyle.com/v2/users"

def index
res = Net::HTTP.post(URI.parse(USER_TOKEN_ENDPOINT), "", {"Authorization" => "Basic #{ENV['ARGYLE_API_TOKEN']}"})
res = Net::HTTP.post(URI.parse(USER_TOKEN_ENDPOINT), "", { "Authorization" => "Basic #{ENV['ARGYLE_API_TOKEN']}" })

@user_token = JSON.parse(res.body)["user_token"]
end
Expand All @@ -13,8 +13,8 @@ def search
def confirm
@employer = employer_params[:employer]
@payments = [
{ amount: 810, start: 'March 25', end: 'June 15', hours: 54, rate: 15 },
{ amount: 195, start: 'January 1', end: 'February 23', hours: 13, rate: 15 }
{ amount: 810, start: "March 25", end: "June 15", hours: 54, rate: 15 },
{ amount: 195, start: "January 1", end: "February 23", hours: 13, rate: 15 }
]
end

Expand Down
4 changes: 2 additions & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
module IvCbvPayroll
class Application < Rails::Application
config.active_job.queue_adapter = :sidekiq
config.i18n.available_locales = [:en, :es]
config.i18n.fallbacks = [:en]
config.i18n.available_locales = [ :en, :es ]
config.i18n.fallbacks = [ :en ]
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0

Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
config.log_level = :info

# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
config.log_tags = [ :request_id ]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store
Expand Down
4 changes: 2 additions & 2 deletions config/initializers/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
redis_url = CloudGovConfig.dig "aws-elasticache-redis", "credentials", "uri"
if redis_url.present?
Sidekiq.configure_server do |config|
config.redis = {url: redis_url, ssl: true}
config.redis = { url: redis_url, ssl: true }
end

Sidekiq.configure_client do |config|
config.redis = {url: redis_url, ssl: true}
config.redis = { url: redis_url, ssl: true }
end
end
end
2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@
resources :providers
# Defines the root path route ("/")
# root "articles#index"


end
end
1 change: 0 additions & 1 deletion db/migrate/20240423135932_create_applicants.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class CreateApplicants < ActiveRecord::Migration[7.0]
def change
create_table :applicants do |t|

t.timestamps
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/scanning.rake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace :bundler do
desc "Updates the ruby-advisory-db and runs audit"
task :audit do
%w[update check].each do |command|
Bundler::Audit::CLI.start [command]
Bundler::Audit::CLI.start [ command ]
end
end
rescue LoadError
Expand Down Expand Up @@ -60,4 +60,4 @@ def all_issues_ignored?(issues)
present_advisories_with_frequencies == ignored_advisories_with_frequencies
end

task default: ["standard", "brakeman", "bundler:audit", "yarn:audit"]
task default: [ "standard", "brakeman", "bundler:audit", "yarn:audit" ]
Loading