From 92903df6974a52a2ef756fe2ddb1dce8612ef73c Mon Sep 17 00:00:00 2001 From: Thomas Schneider <qsx@chaotikum.eu> Date: Mon, 10 Feb 2020 11:34:21 +0100 Subject: [PATCH] Fix RuboCop complaints --- Gemfile | 8 ++++---- app/controllers/groups_controller.rb | 2 ++ app/models/user.rb | 2 +- config/environments/production.rb | 4 ++-- db/schema.rb | 12 +++++++----- test/controllers/groups_controller_test.rb | 2 ++ test/controllers/users_controller_test.rb | 2 ++ test/models/group_test.rb | 2 ++ test/models/user_test.rb | 2 ++ 9 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 0a46bf1..45345da 100644 --- a/Gemfile +++ b/Gemfile @@ -23,14 +23,14 @@ gem 'jbuilder', '~> 2.7' # Use Active Storage variant # gem 'image_processing', '~> 1.2' -gem 'haml-rails', '~> 2.0' gem 'bootstrap', '~> 4.4', '>= 4.4.1' gem 'font-awesome-sass', '~> 5.12.0' +gem 'haml-rails', '~> 2.0' -gem 'activeldap', '~> 5.2', '>= 5.2.4', :require => 'active_ldap/railtie' -gem 'net-ldap', '~> 0.16.2' -gem 'jquery-rails', '~> 4.3', '>= 4.3.5' +gem 'activeldap', '~> 5.2', '>= 5.2.4', require: 'active_ldap/railtie' gem 'jquery-datatables', '~> 1.10', '>= 1.10.20' +gem 'jquery-rails', '~> 4.3', '>= 4.3.5' +gem 'net-ldap', '~> 0.16.2' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.2', require: false diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 2f973a6..8b08475 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + class GroupsController < ApplicationController end diff --git a/app/models/user.rb b/app/models/user.rb index d8293ba..c12a12f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -13,6 +13,6 @@ class User < ActiveLdap::Base primary_key: 'dn' def active? - return self.userAccountControl & 2 == 0 + (userAccountControl & 2).zero? end end diff --git a/config/environments/production.rb b/config/environments/production.rb index a59e081..67ffbce 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -117,9 +117,9 @@ Rails.application.configure do # DatabaseSelector middleware is designed as such you can define your own # strategy for connection switching and pass that into the middleware through # these configuration options. - # rubocop:disable Metrics/LineLength + # rubocop:disable Layout/LineLength # config.active_record.database_selector = { delay: 2.seconds } # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session - # rubocop:enable Metrics/LineLength + # rubocop:enable Layout/LineLength end diff --git a/db/schema.rb b/db/schema.rb index b10373b..277f423 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,6 +1,9 @@ +# frozen_string_literal: true + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. +# incrementally modify your database, and then regenerate this schema +# definition. # # This file is the source Rails uses to define your schema when running `rails # db:schema:load`. When creating a new database, `rails db:schema:load` tends to @@ -8,11 +11,10 @@ # migrations from scratch. Old migrations may fail to apply correctly if those # migrations use external dependencies or application code. # -# It's strongly recommended that you check this file into your version control system. +# It's strongly recommended that you check this file into your version control +# system. ActiveRecord::Schema.define(version: 0) do - # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" - + enable_extension 'plpgsql' end diff --git a/test/controllers/groups_controller_test.rb b/test/controllers/groups_controller_test.rb index 23aba76..5ab1617 100644 --- a/test/controllers/groups_controller_test.rb +++ b/test/controllers/groups_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class GroupsControllerTest < ActionDispatch::IntegrationTest diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 6c3da77..1028f89 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class UsersControllerTest < ActionDispatch::IntegrationTest diff --git a/test/models/group_test.rb b/test/models/group_test.rb index 778eb0c..ae91507 100644 --- a/test/models/group_test.rb +++ b/test/models/group_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class GroupTest < ActiveSupport::TestCase diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 82f61e0..5cc44ed 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class UserTest < ActiveSupport::TestCase -- GitLab