From 6643caf925de2fcc19de977e19f99b13ef885b05 Mon Sep 17 00:00:00 2001 From: Pascal Simon Date: Fri, 23 Mar 2018 10:12:47 +0100 Subject: [PATCH] update rubocop config, fix rubocop issues --- .rubocop-must.yml | 35 +++++++++++++++++++ Gemfile | 12 +++---- Rakefile | 4 +-- app/channels/application_cable/channel.rb | 2 -- app/channels/application_cable/connection.rb | 2 -- app/controllers/activities_controller.rb | 4 +-- .../advanced_trainings_controller.rb | 4 +-- app/controllers/application_controller.rb | 2 -- app/controllers/authentication_controller.rb | 2 -- app/controllers/crud_controller.rb | 4 +-- app/controllers/dry_crud/searchable.rb | 2 -- app/controllers/educations_controller.rb | 4 +-- .../expertise_categories_controller.rb | 6 ++-- ...expertise_topic_skill_values_controller.rb | 8 ++--- .../expertise_topics_controller.rb | 6 ++-- app/controllers/list_controller.rb | 2 -- app/controllers/people_controller.rb | 20 +++++------ .../person_relations_controller.rb | 2 -- .../person_variations_controller.rb | 6 ++-- app/controllers/projects_controller.rb | 6 ++-- app/controllers/static_assets_controller.rb | 2 -- app/jobs/application_job.rb | 2 -- app/mailers/application_mailer.rb | 2 -- app/models/activity.rb | 4 +-- app/models/advanced_training.rb | 4 +-- app/models/application_record.rb | 2 -- app/models/education.rb | 4 +-- app/models/expertise_category.rb | 10 +++--- app/models/expertise_topic.rb | 12 +++---- app/models/expertise_topic_skill_value.rb | 16 ++++----- app/models/person.rb | 2 -- app/models/project.rb | 2 -- app/serializer/activity_serializer.rb | 2 -- .../advanced_training_serializer.rb | 2 -- app/serializer/application_serializer.rb | 2 -- app/serializer/attribute_deserializer.rb | 4 +-- app/serializer/education_serializer.rb | 2 -- app/serializer/error_serializer.rb | 2 -- .../expertise_category_serializer.rb | 2 -- app/serializer/expertise_topic_serializer.rb | 2 -- .../expertise_topic_skill_value_serializer.rb | 4 +-- app/serializer/people_serializer.rb | 2 -- app/serializer/person_serializer.rb | 2 -- .../person_updated_at_serializer.rb | 2 -- app/serializer/project_serializer.rb | 2 -- app/serializer/status_serializer.rb | 2 -- .../person_variations_serializer.rb | 2 -- app/uploaders/picture_uploader.rb | 4 +-- config.ru | 2 -- lib/ldap_tools.rb | 2 -- lib/tasks/analyze.rake | 4 +-- lib/tasks/ci.rake | 2 -- 52 files changed, 92 insertions(+), 151 deletions(-) create mode 100644 .rubocop-must.yml diff --git a/.rubocop-must.yml b/.rubocop-must.yml new file mode 100644 index 000000000..10c75fa1f --- /dev/null +++ b/.rubocop-must.yml @@ -0,0 +1,35 @@ +# Rubocop configuration that MUST hold for every build. + +AllCops: + DisplayCopNames: true + DisabledByDefault: true + Exclude: + - Rakefile + - db/**/* + - config/**/* + - bin/**/* + - spec/**/* + - vendor/**/* + - tmp/**/* + - frontend/**/* + +Metrics/AbcSize: + Max: 17 + +Metrics/ClassLength: + Max: 200 + +Metrics/CyclomaticComplexity: + Max: 6 + +Metrics/LineLength: + Max: 100 + +Metrics/MethodLength: + Max: 10 + +Metrics/ModuleLength: + Max: 200 + +Metrics/ParameterLists: + Max: 4 diff --git a/Gemfile b/Gemfile index 0810261f9..f812bb698 100644 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,19 @@ -# encoding: utf-8 - source 'https://rubygems.org' gem 'rails', '5.1.4' gem 'active_model_serializers', '~> 0.10.6' gem 'activerecord-postgresql-adapter' +gem 'airbrake', '~> 5.0' gem 'annotate' gem 'carrierwave' +gem 'database_cleaner' +gem 'deep_cloneable', '~> 2.2.2' gem 'faker' -gem 'odf-report' gem 'mini_magick' gem 'mysql2' gem 'net-ldap', '~> 0.14.0' +gem 'odf-report' gem 'pg', '0.19.0.pre20160409114042' gem 'pg_search' gem 'puma', '~> 3.0' @@ -20,9 +21,6 @@ gem 'rack' gem 'rails-i18n', '~> 5.0.4' gem 'seed-fu', '~> 2.3.7' gem 'sqlite3' -gem 'deep_cloneable', '~> 2.2.2' -gem 'airbrake', '~> 5.0' -gem 'database_cleaner' group :metrics do gem 'brakeman' @@ -51,4 +49,4 @@ group :test do gem 'simplecov', '~> 0.12.0' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] diff --git a/Rakefile b/Rakefile index 481cb1d2a..501f2b4df 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. @@ -10,7 +8,7 @@ require 'rake/testtask' Rails.application.load_tasks Rake::TestTask.new(:test) do |t| - t.libs << %w(lib test) + t.libs << %w[lib test] t.test_files = Dir['test/**/*_test.rb'].reject do |path| path.include?('features') end diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 591ac9c96..d67269728 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 39d2d3e13..0ff5442f4 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index bca7b7307..1f4fb1f9c 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class ActivitiesController < PersonRelationsController - self.permitted_attrs = [:description, :role, :technology, :year_from, :year_to, :person_id] + self.permitted_attrs = %i[description role technology year_from year_to person_id] end diff --git a/app/controllers/advanced_trainings_controller.rb b/app/controllers/advanced_trainings_controller.rb index d9b361db9..f3114cc09 100644 --- a/app/controllers/advanced_trainings_controller.rb +++ b/app/controllers/advanced_trainings_controller.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class AdvancedTrainingsController < PersonRelationsController - self.permitted_attrs = [:description, :year_from, :year_to, :person_id] + self.permitted_attrs = %i[description year_from year_to person_id] end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7ac34f4a0..dd238ab72 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class ApplicationController < ActionController::API before_action :authorize diff --git a/app/controllers/authentication_controller.rb b/app/controllers/authentication_controller.rb index 0a3a91a01..4501a841b 100644 --- a/app/controllers/authentication_controller.rb +++ b/app/controllers/authentication_controller.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - require 'ldap_tools' class AuthenticationController < ApplicationController diff --git a/app/controllers/crud_controller.rb b/app/controllers/crud_controller.rb index 8dd9e41ac..b0ae66726 100644 --- a/app/controllers/crud_controller.rb +++ b/app/controllers/crud_controller.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - # A generic controller to display, create, update and destroy entries of a certain model class. class CrudController < ListController class_attribute :permitted_attrs, :nested_models @@ -80,7 +78,7 @@ def model_params attrs = map_relationships(attrs) AttributeDeserializer.new(attrs, nested_models: nested_models).run end - + def map_relationships(attrs) relationships = params[:data][:relationships] diff --git a/app/controllers/dry_crud/searchable.rb b/app/controllers/dry_crud/searchable.rb index 39e9cf574..f4d4b8936 100644 --- a/app/controllers/dry_crud/searchable.rb +++ b/app/controllers/dry_crud/searchable.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - # The search functionality for the index table. # Define an array of searchable string columns in your subclassing # controllers using the class attribute +search_columns+. diff --git a/app/controllers/educations_controller.rb b/app/controllers/educations_controller.rb index bdafe20d8..eb6ab3264 100644 --- a/app/controllers/educations_controller.rb +++ b/app/controllers/educations_controller.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class EducationsController < PersonRelationsController - self.permitted_attrs = [:location, :title, :year_from, :year_to, :person_id] + self.permitted_attrs = %i[location title year_from year_to person_id] end diff --git a/app/controllers/expertise_categories_controller.rb b/app/controllers/expertise_categories_controller.rb index a5b99f615..bb259aa7d 100644 --- a/app/controllers/expertise_categories_controller.rb +++ b/app/controllers/expertise_categories_controller.rb @@ -1,9 +1,7 @@ -# encoding: utf-8 - class ExpertiseCategoriesController < CrudController - self.permitted_attrs = [:name, :discipline] + self.permitted_attrs = %i[name discipline] - self.nested_models = [:expertise_topic] + self.nested_models = %i[expertise_topic] def fetch_entries raise unless params[:discipline] diff --git a/app/controllers/expertise_topic_skill_values_controller.rb b/app/controllers/expertise_topic_skill_values_controller.rb index fbcb79140..d7de1b05e 100644 --- a/app/controllers/expertise_topic_skill_values_controller.rb +++ b/app/controllers/expertise_topic_skill_values_controller.rb @@ -1,10 +1,8 @@ -# encoding: utf-8 - class ExpertiseTopicSkillValuesController < CrudController - self.permitted_attrs = [:years_of_experience, :number_of_projects, :last_use, - :skill_level, :comment, :expertise_topic_id, :person_id] + self.permitted_attrs = %i[years_of_experience number_of_projects last_use + skill_level comment expertise_topic_id person_id] - def create(options= {}) + def create(options = {}) person_id = params[:data][:relationships][:person][:data][:id] if person_id raise 'not yet implemented' if Person.find(person_id).origin_person_id diff --git a/app/controllers/expertise_topics_controller.rb b/app/controllers/expertise_topics_controller.rb index 6cf2af15f..c9a0b536b 100644 --- a/app/controllers/expertise_topics_controller.rb +++ b/app/controllers/expertise_topics_controller.rb @@ -1,9 +1,7 @@ -# encoding: utf-8 - class ExpertiseTopicsController < CrudController - self.permitted_attrs = [:name, :user_topic, :expertise_category_id] + self.permitted_attrs = %i[name user_topic expertise_category_id] - self.nested_models = [:expertise_topic_skill_values] + self.nested_models = %i[expertise_topic_skill_values] def fetch_entries raise unless params[:category_id] diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb index 8de24dce7..878cc3877 100644 --- a/app/controllers/list_controller.rb +++ b/app/controllers/list_controller.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - # A generic controller to display entries of a certain model class. class ListController < ApplicationController delegate :model_class, :model_identifier, :model_serializer, :list_serializer, diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 01aac3019..a1884f3f5 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -1,14 +1,12 @@ -# encoding: utf-8 - class PeopleController < CrudController - self.permitted_attrs = [:birthdate, :picture, :language, :location, - :martial_status, :updated_by, :name, :origin, :role, :title, - :competences, :status_id, :variation_name, :company] + self.permitted_attrs = %i[birthdate picture language location + martial_status updated_by name origin role title + competences status_id variation_name company] - self.nested_models = [:advanced_trainings, :activities, :projects, - :educations] + self.nested_models = %i[advanced_trainings activities projects + educations] - skip_before_action :authorize, only: [:picture] + skip_before_action :authorize, only: :picture def index people = fetch_entries @@ -22,7 +20,7 @@ def show end def update_picture - person.update_attributes(picture: params[:picture]) + person.update(picture: params[:picture]) render json: { data: { picture_path: person_picture_path(params[:person_id]) } } end @@ -102,7 +100,7 @@ def content_disposition_filename_ascii(filename) 'filename="' + percent_escape( I18n.transliterate(filename), - /[^ A-Za-z0-9!#$+.^_`|~-]/ + /[^ A-Za-z0-9!#{$+}.^_`|~-]/ ) + '"' end @@ -110,7 +108,7 @@ def content_disposition_filename_utf8(filename) "filename*=UTF-8''" + percent_escape( filename, - /[^A-Za-z0-9!#$&+.^_`|~-]/ + /[^A-Za-z0-9!#{$&}+.^_`|~-]/ ) end diff --git a/app/controllers/person_relations_controller.rb b/app/controllers/person_relations_controller.rb index 19e5a0fc0..cad04d647 100644 --- a/app/controllers/person_relations_controller.rb +++ b/app/controllers/person_relations_controller.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class PersonRelationsController < CrudController def person_id params['data']['relationships']['person']['data']['id'] diff --git a/app/controllers/person_variations_controller.rb b/app/controllers/person_variations_controller.rb index d7ba577b8..dcf4e8992 100644 --- a/app/controllers/person_variations_controller.rb +++ b/app/controllers/person_variations_controller.rb @@ -1,7 +1,5 @@ -# encoding: utf-8 - class PersonVariationsController < CrudController - self.permitted_attrs = PeopleController.permitted_attrs + [:variation_name, :person_id] + self.permitted_attrs = PeopleController.permitted_attrs + %i[variation_name person_id] self.nested_models = PeopleController.nested_models @@ -17,7 +15,7 @@ def create else render json: variation.errors.details, status: :unprocessable_entity end - rescue => e + rescue StandardError => e render json: e.message, status: :unprocessable_entity end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 65d6c7815..5ed2d6618 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,6 +1,4 @@ -# encoding: utf-8 - class ProjectsController < PersonRelationsController - self.permitted_attrs = [:description, :title, :role, :technology, - :year_to, :year_from, :person_id] + self.permitted_attrs = %i[description title role technology + year_to year_from person_id] end diff --git a/app/controllers/static_assets_controller.rb b/app/controllers/static_assets_controller.rb index eca7b575f..286682bcb 100644 --- a/app/controllers/static_assets_controller.rb +++ b/app/controllers/static_assets_controller.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class StaticAssetsController < ActionController::Base protect_from_forgery with: :null_session diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index a2b0fe4f5..a009ace51 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,4 +1,2 @@ -# encoding: utf-8 - class ApplicationJob < ActiveJob::Base end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 3bd64d25b..286b2239d 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' diff --git a/app/models/activity.rb b/app/models/activity.rb index dc8c3622c..a502bb6e8 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - # == Schema Information # # Table name: activities @@ -19,7 +17,7 @@ class Activity < ApplicationRecord belongs_to :person, touch: true validates :year_from, :person_id, :role, presence: true - validates :year_from, :year_to, length: {is: 4}, allow_blank: true + validates :year_from, :year_to, length: { is: 4 }, allow_blank: true validates :description, length: { maximum: 5000 } validates :role, length: { maximum: 500 } validate :year_from_before_year_to diff --git a/app/models/advanced_training.rb b/app/models/advanced_training.rb index 30c61d729..8fa948b11 100644 --- a/app/models/advanced_training.rb +++ b/app/models/advanced_training.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - # == Schema Information # # Table name: advanced_trainings @@ -18,7 +16,7 @@ class AdvancedTraining < ApplicationRecord belongs_to :person, touch: true validates :year_from, :person_id, :description, presence: true - validates :year_from, :year_to, length: {is: 4}, allow_blank: true + validates :year_from, :year_to, length: { is: 4 }, allow_blank: true validates :description, length: { maximum: 5000 } validate :year_from_before_year_to diff --git a/app/models/application_record.rb b/app/models/application_record.rb index db7cd1763..6cb87e804 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class ApplicationRecord < ActiveRecord::Base self.abstract_class = true diff --git a/app/models/education.rb b/app/models/education.rb index 6356b3953..8700e0c0b 100644 --- a/app/models/education.rb +++ b/app/models/education.rb @@ -1,4 +1,4 @@ -# encoding: utf-8 + # == Schema Information # # Table name: educations @@ -17,7 +17,7 @@ class Education < ApplicationRecord belongs_to :person, touch: true validates :year_from, :person_id, :title, :location, presence: true - validates :year_from, :year_to, length: {is: 4}, allow_blank: true + validates :year_from, :year_to, length: { is: 4 }, allow_blank: true validates :location, :title, length: { maximum: 500 } validate :year_from_before_year_to diff --git a/app/models/expertise_category.rb b/app/models/expertise_category.rb index 1202bb214..73ab7038c 100644 --- a/app/models/expertise_category.rb +++ b/app/models/expertise_category.rb @@ -1,4 +1,4 @@ -# encoding: utf-8 + # # == Schema Information # @@ -15,12 +15,12 @@ class ExpertiseCategory < ApplicationRecord enum discipline: [:development, :system_engineering] validates :discipline, presence: true - validates :name, presence: true, - uniqueness: { scope: :discipline }, + validates :name, presence: true, + uniqueness: { scope: :discipline }, length: { maximum: 100 } - scope :list, -> (discipline = nil) do - where(discipline: discipline ) + scope :list, ->(discipline = nil) do + where(discipline: discipline) end end diff --git a/app/models/expertise_topic.rb b/app/models/expertise_topic.rb index fc8c32448..46002e627 100644 --- a/app/models/expertise_topic.rb +++ b/app/models/expertise_topic.rb @@ -1,4 +1,4 @@ -# encoding: utf-8 + # # == Schema Information # @@ -14,14 +14,14 @@ class ExpertiseTopic < ApplicationRecord belongs_to :expertise_category has_many :expertise_topic_skill_values, dependent: :destroy - validates :name, presence: true, - length: { maximum: 100 }, + validates :name, presence: true, + length: { maximum: 100 }, uniqueness: { scope: :expertise_category } - scope :list, -> (category_id= nil) do + scope :list, ->(category_id = nil) do includes(:expertise_category, :expertise_topic_skill_values). - where(expertise_categories: { id: category_id } ). - where(user_topic: false) + where(expertise_categories: { id: category_id }). + where(user_topic: false) end end diff --git a/app/models/expertise_topic_skill_value.rb b/app/models/expertise_topic_skill_value.rb index f24409458..4b5d69cff 100644 --- a/app/models/expertise_topic_skill_value.rb +++ b/app/models/expertise_topic_skill_value.rb @@ -1,4 +1,4 @@ -# encoding: utf-8 + # # == Schema Information # @@ -19,7 +19,7 @@ class ExpertiseTopicSkillValue < ApplicationRecord belongs_to :expertise_category belongs_to :person, touch: true - enum skill_level: [:trainee, :junior, :professional, :senior, :expert] + enum skill_level: %i[trainee junior professional senior expert] validates :skill_level, presence: true validates :last_use, length: { is: 4 }, allow_nil: true @@ -27,13 +27,13 @@ class ExpertiseTopicSkillValue < ApplicationRecord validates :number_of_projects, inclusion: { in: 0..255 }, allow_nil: true validates :years_of_experience, inclusion: { in: 0..80 }, allow_nil: true validates :expertise_topic_id, - uniqueness: { scope: :person , - message: '- Etwas ist schief gelaufen. Bitte Seite neu laden' } + uniqueness: { scope: :person, + message: '- Etwas ist schief gelaufen. Bitte Seite neu laden' } - scope :list, -> (person_id = nil, category_id= nil) do + scope :list, ->(person_id = nil, category_id = nil) do includes(:expertise_topic). - includes(expertise_topic: :expertise_category). - where(person_id: person_id). - where(expertise_categories: { id: category_id } ) + includes(expertise_topic: :expertise_category). + where(person_id: person_id). + where(expertise_categories: { id: category_id }) end end diff --git a/app/models/person.rb b/app/models/person.rb index 198373bb9..c36d74992 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - # == Schema Information # # Table name: people diff --git a/app/models/project.rb b/app/models/project.rb index c25a7dc50..09c015f25 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - # == Schema Information # # Table name: projects diff --git a/app/serializer/activity_serializer.rb b/app/serializer/activity_serializer.rb index fd637e9b4..168ef032c 100644 --- a/app/serializer/activity_serializer.rb +++ b/app/serializer/activity_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class ActivitySerializer < ApplicationSerializer attributes :id, :description, :updated_by, :role, :year_from, :year_to diff --git a/app/serializer/advanced_training_serializer.rb b/app/serializer/advanced_training_serializer.rb index 335b2b69b..5dde77eef 100644 --- a/app/serializer/advanced_training_serializer.rb +++ b/app/serializer/advanced_training_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class AdvancedTrainingSerializer < ApplicationSerializer attributes :id, :description, :updated_by, :year_from, :year_to diff --git a/app/serializer/application_serializer.rb b/app/serializer/application_serializer.rb index 40f74c357..cfeb424a5 100644 --- a/app/serializer/application_serializer.rb +++ b/app/serializer/application_serializer.rb @@ -1,4 +1,2 @@ -# encoding: utf-8 - class ApplicationSerializer < ActiveModel::Serializer end diff --git a/app/serializer/attribute_deserializer.rb b/app/serializer/attribute_deserializer.rb index 9517df8e8..cb2e4b055 100644 --- a/app/serializer/attribute_deserializer.rb +++ b/app/serializer/attribute_deserializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class AttributeDeserializer def initialize(params, options = {}) @params = params @@ -30,7 +28,7 @@ def process_nested_models(attrs, nested_models) def process_models_hash(attrs, model) model.each do |key, value| model_attrs = attrs.delete(key.to_s) - next unless model_attrs.present? + next if model_attrs.blank? attrs["#{key}_attributes"] = model_attrs if model_attrs.is_a?(Array) model_attrs.each { |ma| process_nested_models(ma, Array.wrap(value)) } diff --git a/app/serializer/education_serializer.rb b/app/serializer/education_serializer.rb index c76ecb127..35c9137f5 100644 --- a/app/serializer/education_serializer.rb +++ b/app/serializer/education_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class EducationSerializer < ApplicationSerializer attributes :id, :location, :title, :updated_by, :year_from, :year_to diff --git a/app/serializer/error_serializer.rb b/app/serializer/error_serializer.rb index fd7810722..71668640b 100644 --- a/app/serializer/error_serializer.rb +++ b/app/serializer/error_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - module ErrorSerializer def self.serialize(errors) return if errors.nil? diff --git a/app/serializer/expertise_category_serializer.rb b/app/serializer/expertise_category_serializer.rb index cf8d5f50f..3c990719a 100644 --- a/app/serializer/expertise_category_serializer.rb +++ b/app/serializer/expertise_category_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class ExpertiseCategorySerializer < ActiveModel::Serializer attributes :id, :name, :discipline diff --git a/app/serializer/expertise_topic_serializer.rb b/app/serializer/expertise_topic_serializer.rb index bd3f1d347..5dcdbb41b 100644 --- a/app/serializer/expertise_topic_serializer.rb +++ b/app/serializer/expertise_topic_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class ExpertiseTopicSerializer < ActiveModel::Serializer attributes :id, :name, :user_topic diff --git a/app/serializer/expertise_topic_skill_value_serializer.rb b/app/serializer/expertise_topic_skill_value_serializer.rb index be5f2ef3a..7baa068dd 100644 --- a/app/serializer/expertise_topic_skill_value_serializer.rb +++ b/app/serializer/expertise_topic_skill_value_serializer.rb @@ -1,8 +1,6 @@ -# encoding: utf-8 - class ExpertiseTopicSkillValueSerializer < ActiveModel::Serializer attributes :id, :years_of_experience, :number_of_projects, :last_use, :skill_level, :comment - + has_one :expertise_topic has_one :person end diff --git a/app/serializer/people_serializer.rb b/app/serializer/people_serializer.rb index 7813eea0b..41815e8e7 100644 --- a/app/serializer/people_serializer.rb +++ b/app/serializer/people_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class PeopleSerializer < ApplicationSerializer attributes :id, :name, :status_id end diff --git a/app/serializer/person_serializer.rb b/app/serializer/person_serializer.rb index 17d746691..8dba021da 100644 --- a/app/serializer/person_serializer.rb +++ b/app/serializer/person_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class PersonSerializer < ApplicationSerializer type :people diff --git a/app/serializer/person_updated_at_serializer.rb b/app/serializer/person_updated_at_serializer.rb index a7d80d7b8..f50143820 100644 --- a/app/serializer/person_updated_at_serializer.rb +++ b/app/serializer/person_updated_at_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class PersonUpdatedAtSerializer < ApplicationSerializer type :people diff --git a/app/serializer/project_serializer.rb b/app/serializer/project_serializer.rb index d7139ace4..e93f941f2 100644 --- a/app/serializer/project_serializer.rb +++ b/app/serializer/project_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class ProjectSerializer < ApplicationSerializer attributes :id, :updated_by, :title, :description, :role, :technology, :year_from, :year_to diff --git a/app/serializer/status_serializer.rb b/app/serializer/status_serializer.rb index 4c57cc30d..30fed705d 100644 --- a/app/serializer/status_serializer.rb +++ b/app/serializer/status_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class StatusSerializer < ApplicationSerializer attributes :id, :status end diff --git a/app/serializers/person_variations_serializer.rb b/app/serializers/person_variations_serializer.rb index 797fcbfc9..c8a1b107e 100644 --- a/app/serializers/person_variations_serializer.rb +++ b/app/serializers/person_variations_serializer.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class PersonVariationsSerializer < ActiveModel::Serializer attributes :id, :variation_name end diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb index 4c06f68f4..d991d7db4 100644 --- a/app/uploaders/picture_uploader.rb +++ b/app/uploaders/picture_uploader.rb @@ -1,8 +1,6 @@ -# encoding: utf-8 - class PictureUploader < CarrierWave::Uploader::Base - EXTENSION_WHITE_LIST = %w(jpg jpeg gif png svg bmp).freeze + EXTENSION_WHITE_LIST = %w[jpg jpeg gif png svg bmp].freeze include CarrierWave::MiniMagick diff --git a/config.ru b/config.ru index 881413add..f7ba0b527 100644 --- a/config.ru +++ b/config.ru @@ -1,5 +1,3 @@ -# encoding: utf-8 - # This file is used by Rack-based servers to start the application. require_relative 'config/environment' diff --git a/lib/ldap_tools.rb b/lib/ldap_tools.rb index e7a46f8c4..c3dc73219 100644 --- a/lib/ldap_tools.rb +++ b/lib/ldap_tools.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - require 'net/ldap' class LdapTools diff --git a/lib/tasks/analyze.rake b/lib/tasks/analyze.rake index 2fc81d7b5..09578e382 100644 --- a/lib/tasks/analyze.rake +++ b/lib/tasks/analyze.rake @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) 2012-2016, Jungwacht Blauring Schweiz. This file is part of # hitobito and licensed under the Affero General Public License version 3 # or later. See the COPYING file at the top-level directory or at @@ -19,7 +17,7 @@ end desc 'Run rubocop-must.yml and fail if there are issues' task :rubocop do begin - sh 'rubocop --config rubocop-must.yml' + sh 'rubocop --config .rubocop-must.yml' rescue abort('RuboCop failed!') end diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake index 52f1663bc..d97e09d5a 100644 --- a/lib/tasks/ci.rake +++ b/lib/tasks/ci.rake @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) 2008-2016, Puzzle ITC GmbH. This file is part of # Cryptopus and licensed under the Affero General Public License version 3 or later. # See the COPYING file at the top-level directory or at