Skip to content

Commit

Permalink
manual fix rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dilumn committed Jun 1, 2022
1 parent 97195ce commit 692421d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
19 changes: 18 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ AllCops:
Layout/LineLength:
Max: 120

Naming/VariableNumber:
EnforcedStyle: snake_case

Layout/SpaceAroundMethodCallOperator:
Enabled: true
Lint/RaiseException:
Expand All @@ -38,6 +41,20 @@ Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true
Metrics/BlockLength:
Enabled: false
Style/Documentation:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Rails/UniqueValidationWithoutIndex:
Enabled: false
Gemspec/DateAssignment: # new in 1.10
Enabled: true
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
Expand Down Expand Up @@ -225,7 +242,7 @@ Rails/I18nLazyLookup: # new in 2.14
Rails/I18nLocaleAssignment: # new in 2.11
Enabled: true
Rails/I18nLocaleTexts: # new in 2.14
Enabled: true
Enabled: false
Rails/Inquiry: # new in 2.7
Enabled: true
Rails/MailerName: # new in 2.7
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/change_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ def create

if change_request.save
flash[:success] =
"Thanks for submitting the request, we will review it & do nessasary changes. If the changes doesn't appear within few days, check change request page to see whether your request marked as not enough proof."
"Thanks for submitting the request, we will review it & do nessasary changes. \
If the changes doesn't appear within few days, check change request page to \
see whether your request marked as not enough proof."
redirect_to peggedplacetowork_root_path
else
flash[:error] = change_request.errors.full_messages.join(', ')
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/salaries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class SalariesController < ApplicationController
before_action :authenticate_user!, only: %i[vote_accurate vote_fake]

def index
@grouped_salaries = Salary.includes(:salary_votes).where(status: 'approved').group_by(&:designation).sort_by do |_key, value|
salaries = Salary.includes(:salary_votes).where(status: 'approved').group_by(&:designation)
@grouped_salaries = salaries.sort_by do |_key, value|
-value.size
end.to_h
end
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

module Users
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
# rubocop:disable Naming/VariableNumber
def google_oauth2
# rubocop:enable Naming/VariableNumber
user = User.from_google(**from_google_params)

if user.present?
Expand Down
2 changes: 1 addition & 1 deletion app/models/salary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Salary < ApplicationRecord
rejected: 'rejected'
}

has_many :salary_votes
has_many :salary_votes, dependent: true

def accurate_votes_count
salary_votes.count(&:accurate?)
Expand Down
2 changes: 2 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

class User < ApplicationRecord
# rubocop:disable Naming/VariableNumber
devise :omniauthable, omniauth_providers: [:google_oauth2]
# rubocop:enable Naming/VariableNumber

ADMIN_ROLES = %w[readonly_admin operation_admin super_admin].freeze

Expand Down
6 changes: 4 additions & 2 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` as its `secret_key`
# by default. You can change it below and use your own secret key.
# config.secret_key = 'c2de9a33f42eb9fd7ec06a4d2b51436ee6fbf0cdc7d5eda1c758c5c6e91841807d67085a7cbd25138bc4a8d4fae823f46c95017d03a4869caa531f6551f07783'
# config.secret_key = 'c2de9a33f42eb9fd7ec06a4d2b51436ee6fbf0cdc7d5eda1c758c5'

# ==> Controller configuration
# Configure the parent class to the devise controllers.
Expand Down Expand Up @@ -126,7 +126,7 @@
config.stretches = Rails.env.test? ? 1 : 12

# Set up a pepper to generate the hashed password.
# config.pepper = 'bb69262df4a1af3d6989f4bf978756dd03ef117a5ffa9bb141588ed45324358a4f6801be0b08872365844f73bc77a1fde90712386550918f19ea6714f4c902f0'
# config.pepper = 'bb69262df4a1af3d6989f4bf978756dd03ef117a5ffa9bb141588ed45324'

# Send a notification to the original email when the user's email is changed.
# config.send_email_changed_notification = false
Expand Down Expand Up @@ -273,7 +273,9 @@
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'

# rubocop:disable Naming/VariableNumber
config.omniauth :google_oauth2, ENV.fetch('GOOGLE_OAUTH_CLIENT_ID', nil), ENV.fetch('GOOGLE_OAUTH_CLIENT_SECRET', nil)
# rubocop:enable Naming/VariableNumber

# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
Expand Down

0 comments on commit 692421d

Please sign in to comment.