feat(cops): clean rubocop run
1. ignoring one file because it's an intentional vuln 2. made a few small semantic changes, but verified that they're equivalent.
This commit is contained in:
@@ -3,3 +3,7 @@ inherit_gem:
|
||||
- config/default.yml
|
||||
- config/rails.yml
|
||||
|
||||
|
||||
Rails/OutputSafety:
|
||||
Exclude:
|
||||
- 'app/controllers/password_resets_controller.rb'
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
class AdminController < ApplicationController
|
||||
before_action :administrative, if: :admin_param, except: [:get_user]
|
||||
skip_before_action :has_info
|
||||
layout false, only: [:get_all_users, :get_user]
|
||||
|
||||
def dashboard
|
||||
end
|
||||
@@ -22,14 +23,12 @@ class AdminController < ApplicationController
|
||||
|
||||
def get_all_users
|
||||
@users = User.all
|
||||
render layout: false
|
||||
end
|
||||
|
||||
def get_user
|
||||
@user = User.find_by_id(params[:admin_id].to_s)
|
||||
arr = ["true", "false"]
|
||||
@admin_select = @user.admin ? arr : arr.reverse
|
||||
render layout: false
|
||||
end
|
||||
|
||||
def update_user
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
class DashboardController < ApplicationController
|
||||
skip_before_action :has_info
|
||||
layout false, only: [:change_graph]
|
||||
|
||||
def home
|
||||
@user = current_user
|
||||
@@ -13,15 +14,12 @@ class DashboardController < ApplicationController
|
||||
|
||||
def change_graph
|
||||
self.try(params[:graph])
|
||||
end
|
||||
|
||||
def bar_graph
|
||||
render :bar_graph, layout: false
|
||||
if params[:graph] == "bar_graph"
|
||||
render "dashboard/bar_graph"
|
||||
else
|
||||
@user = current_user
|
||||
render "dashboard/pie_charts"
|
||||
end
|
||||
end
|
||||
|
||||
def pie_charts
|
||||
@user = current_user
|
||||
render :dashboard_stats, layout: false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ class PasswordResetsController < ApplicationController
|
||||
def confirm_token
|
||||
if !params[:token].nil? && is_valid?(params[:token])
|
||||
flash[:success] = "Password reset token confirmed! Please create a new password."
|
||||
render "reset_password"
|
||||
render "password_resets/reset_password"
|
||||
else
|
||||
flash[:error] = "Invalid password reset token. Please try again."
|
||||
redirect_to :login
|
||||
|
||||
@@ -33,7 +33,7 @@ class ScheduleController < ApplicationController
|
||||
end
|
||||
rescue
|
||||
end
|
||||
respond_to do |format|
|
||||
respond_to do |format|
|
||||
format.json { render json: jfs.to_json }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,7 +13,8 @@ class SessionsController < ApplicationController
|
||||
begin
|
||||
# Normalize the email address, why not
|
||||
user = User.authenticate(params[:email].to_s.downcase, params[:password])
|
||||
rescue Exception => e
|
||||
rescue RuntimeError => e
|
||||
# don't do ANYTHING
|
||||
end
|
||||
|
||||
if user
|
||||
@@ -25,7 +26,7 @@ class SessionsController < ApplicationController
|
||||
redirect_to path
|
||||
else
|
||||
flash[:error] = e.message
|
||||
render "new"
|
||||
render "sessions/new"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,8 +3,5 @@ class TutorialsController < ApplicationController
|
||||
skip_before_action :has_info
|
||||
skip_before_action :authenticated
|
||||
|
||||
def credentials
|
||||
render layout: false
|
||||
end
|
||||
|
||||
layout false, only: [:credentials]
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ class Message < ApplicationRecord
|
||||
if creator = User.where(user_id: self.creator_id).first
|
||||
creator.full_name
|
||||
else
|
||||
"<b>Name unavailable</b>".html_safe
|
||||
"Name unavailable"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+2
-3
@@ -74,8 +74,7 @@ class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def generate_token(column)
|
||||
begin
|
||||
self[column] = Encryption.encrypt_sensitive_value(self.user_id)
|
||||
end while User.exists?(column => self[column])
|
||||
self[column] = Encryption.encrypt_sensitive_value(self.user_id)
|
||||
generate_token(column) if User.exists?(column => self[column])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -71,15 +71,30 @@ module Capybara::Poltergeist
|
||||
end
|
||||
|
||||
class WarningSuppressor
|
||||
class << self
|
||||
def write(message)
|
||||
(message =~ /QFont::setPixelSize: Pixel size <= 0/ || message =~/CoreText performance note:/ || message =~/Method userSpaceScaleFactor in class NSView/) ? 0 : puts(message); 1
|
||||
IGNORE_PATTERNS = [
|
||||
/QFont::setPixelSize: Pixel size <= 0/,
|
||||
/CoreText performance note:/,
|
||||
/WARNING: Method userSpaceScaleFactor/
|
||||
]
|
||||
|
||||
def write(message)
|
||||
if ignore?(message)
|
||||
0
|
||||
else
|
||||
puts(message)
|
||||
1
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ignore?(message)
|
||||
IGNORE_PATTERNS.any? {|regexp| message =~ regexp }
|
||||
end
|
||||
end
|
||||
|
||||
Capybara.register_driver :poltergeist do |app|
|
||||
Capybara::Poltergeist::Driver.new(app, phantomjs_logger: WarningSuppressor, timeout: 60)
|
||||
Capybara::Poltergeist::Driver.new(app, phantomjs_logger: WarningSuppressor.new, timeout: 60)
|
||||
end
|
||||
|
||||
Capybara.javascript_driver = :poltergeist
|
||||
|
||||
Reference in New Issue
Block a user