From 026fd1aaa2c4c67cdd7308b9aba137166d1e9bdd Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 18 Dec 2018 21:29:31 +0100 Subject: [PATCH] Use parentheses --- app/controllers/admin/gestionnaires_controller.rb | 2 +- app/lib/file_size_validator.rb | 2 +- app/services/clamav_service.rb | 2 +- app/services/pieces_justificatives_service.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/gestionnaires_controller.rb b/app/controllers/admin/gestionnaires_controller.rb index 51ebf2fac..c0b5c62b0 100644 --- a/app/controllers/admin/gestionnaires_controller.rb +++ b/app/controllers/admin/gestionnaires_controller.rb @@ -61,7 +61,7 @@ class Admin::GestionnairesController < AdminController end def assign_gestionnaire! - if current_administrateur.gestionnaires.include? @gestionnaire + if current_administrateur.gestionnaires.include?(@gestionnaire) flash.alert = 'Instructeur déjà ajouté' else @gestionnaire.administrateurs.push current_administrateur diff --git a/app/lib/file_size_validator.rb b/app/lib/file_size_validator.rb index 8537ce414..eb9f987f0 100644 --- a/app/lib/file_size_validator.rb +++ b/app/lib/file_size_validator.rb @@ -41,7 +41,7 @@ class FileSizeValidator < ActiveModel::EachValidator end def validate_each(record, attribute, value) - if !value.kind_of? CarrierWave::Uploader::Base + if !value.kind_of?(CarrierWave::Uploader::Base) raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") end diff --git a/app/services/clamav_service.rb b/app/services/clamav_service.rb index 02c559601..11c5591f0 100644 --- a/app/services/clamav_service.rb +++ b/app/services/clamav_service.rb @@ -4,7 +4,7 @@ class ClamavService return true end - FileUtils.chmod 0666, file_path + FileUtils.chmod(0666, file_path) client = ClamAV::Client.new response = client.execute(ClamAV::Commands::ScanCommand.new(file_path)) diff --git a/app/services/pieces_justificatives_service.rb b/app/services/pieces_justificatives_service.rb index 52a5d5249..521dd5873 100644 --- a/app/services/pieces_justificatives_service.rb +++ b/app/services/pieces_justificatives_service.rb @@ -17,7 +17,7 @@ class PiecesJustificativesService def self.upload_one!(dossier, user, params) content = params[:piece_justificative][:content] - if ClamavService.safe_file? content.path + if ClamavService.safe_file?(content.path) pj = PieceJustificative.new(content: content, dossier: dossier, type_de_piece_justificative: nil,