Update rubocop roules

This commit is contained in:
Paul Chavard 2020-03-05 11:03:39 +01:00
parent 444d19e191
commit 3cd4597006
7 changed files with 55 additions and 42 deletions

View file

@ -1,6 +1,9 @@
require: require:
- rubocop/rspec/focused - rubocop/rspec/focused
- ./lib/cops/unscoped.rb - ./lib/cops/unscoped.rb
inherit_gem:
rubocop-rails_config:
- config/rails.yml
AllCops: AllCops:
Exclude: Exclude:
@ -30,13 +33,13 @@ Gemspec/RequiredRubyVersion:
Layout/AccessModifierIndentation: Layout/AccessModifierIndentation:
Enabled: true Enabled: true
Layout/AlignArray: Layout/ArrayAlignment:
Enabled: true Enabled: true
Layout/AlignHash: Layout/HashAlignment:
Enabled: false Enabled: false
Layout/AlignParameters: Layout/ParameterAlignment:
Enabled: true Enabled: true
EnforcedStyle: with_fixed_indentation EnforcedStyle: with_fixed_indentation
@ -89,6 +92,7 @@ Layout/EmptyLineAfterGuardClause:
# FIXME: private should not be a column name on TypeDeChamp # FIXME: private should not be a column name on TypeDeChamp
Layout/EmptyLinesAroundAccessModifier: Layout/EmptyLinesAroundAccessModifier:
Enabled: true Enabled: true
EnforcedStyle: around
Exclude: Exclude:
- "spec/factories/type_de_champ.rb" - "spec/factories/type_de_champ.rb"
@ -141,22 +145,23 @@ Layout/FirstMethodParameterLineBreak:
Layout/FirstParameterIndentation: Layout/FirstParameterIndentation:
Enabled: true Enabled: true
Layout/IndentArray: Layout/FirstArrayElementIndentation:
Enabled: true Enabled: true
EnforcedStyle: consistent EnforcedStyle: consistent
Layout/IndentAssignment: Layout/AssignmentIndentation:
Enabled: true Enabled: true
Layout/IndentHash: Layout/FirstHashElementIndentation:
Enabled: true Enabled: true
EnforcedStyle: consistent EnforcedStyle: consistent
Layout/IndentHeredoc: Layout/HeredocIndentation:
Enabled: true Enabled: true
Layout/IndentationConsistency: Layout/IndentationConsistency:
Enabled: true Enabled: true
EnforcedStyle: normal
Layout/IndentationWidth: Layout/IndentationWidth:
Enabled: true Enabled: true
@ -275,7 +280,7 @@ Layout/SpaceInsideStringInterpolation:
Layout/Tab: Layout/Tab:
Enabled: true Enabled: true
Layout/TrailingBlankLines: Layout/TrailingEmptyLines:
Enabled: true Enabled: true
Layout/TrailingWhitespace: Layout/TrailingWhitespace:
@ -314,7 +319,7 @@ Lint/DuplicateCaseCondition:
Lint/DuplicateMethods: Lint/DuplicateMethods:
Enabled: true Enabled: true
Lint/DuplicatedKey: Lint/DuplicateHashKey:
Enabled: true Enabled: true
Lint/EachWithObjectArgument: Lint/EachWithObjectArgument:
@ -347,7 +352,7 @@ Lint/FloatOutOfRange:
Lint/FormatParameterMismatch: Lint/FormatParameterMismatch:
Enabled: true Enabled: true
Lint/HandleExceptions: Lint/SuppressedException:
Enabled: false Enabled: false
Lint/ImplicitStringConcatenation: Lint/ImplicitStringConcatenation:
@ -374,7 +379,7 @@ Lint/Loop:
Lint/MissingCopEnableDirective: Lint/MissingCopEnableDirective:
Enabled: true Enabled: true
Lint/MultipleCompare: Lint/MultipleComparison:
Enabled: true Enabled: true
Lint/NestedMethodDefinition: Lint/NestedMethodDefinition:
@ -445,7 +450,7 @@ Lint/ShadowedException:
Lint/ShadowingOuterLocalVariable: Lint/ShadowingOuterLocalVariable:
Enabled: false Enabled: false
Lint/StringConversionInInterpolation: Lint/RedundantStringCoercion:
Enabled: true Enabled: true
Lint/Syntax: Lint/Syntax:
@ -457,16 +462,16 @@ Lint/UnderscorePrefixedVariableName:
Lint/UnifiedInteger: Lint/UnifiedInteger:
Enabled: true Enabled: true
Lint/UnneededCopDisableDirective: Lint/RedundantCopDisableDirective:
Enabled: true Enabled: true
Lint/UnneededCopEnableDirective: Lint/RedundantCopEnableDirective:
Enabled: true Enabled: true
Lint/UnneededRequireStatement: Lint/RedundantRequireStatement:
Enabled: true Enabled: true
Lint/UnneededSplatExpansion: Lint/RedundantSplatExpansion:
Enabled: false Enabled: false
Lint/UnreachableCode: Lint/UnreachableCode:
@ -519,7 +524,7 @@ Metrics/ClassLength:
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Enabled: false Enabled: false
Metrics/LineLength: Layout/LineLength:
Enabled: false Enabled: false
Metrics/MethodLength: Metrics/MethodLength:
@ -567,10 +572,10 @@ Naming/MethodName:
Naming/PredicateName: Naming/PredicateName:
Enabled: false Enabled: false
Naming/UncommunicativeBlockParamName: Naming/BlockParameterName:
Enabled: true Enabled: true
Naming/UncommunicativeMethodParamName: Naming/MethodParameterName:
Enabled: false Enabled: false
Naming/VariableName: Naming/VariableName:
@ -593,6 +598,8 @@ Performance/CompareWithBlock:
Performance/Count: Performance/Count:
Enabled: true Enabled: true
Exclude:
- "app/services/administrateur_usage_statistics_service.rb"
Performance/Detect: Performance/Detect:
Enabled: true Enabled: true
@ -609,9 +616,6 @@ Performance/FixedSize:
Performance/FlatMap: Performance/FlatMap:
Enabled: true Enabled: true
Performance/LstripRstrip:
Enabled: true
Performance/RangeInclude: Performance/RangeInclude:
Enabled: true Enabled: true
@ -624,7 +628,7 @@ Performance/RedundantMatch:
Performance/RedundantMerge: Performance/RedundantMerge:
Enabled: true Enabled: true
Performance/RedundantSortBy: Style/RedundantSortBy:
Enabled: true Enabled: true
Performance/RegexpMatch: Performance/RegexpMatch:
@ -633,7 +637,7 @@ Performance/RegexpMatch:
Performance/ReverseEach: Performance/ReverseEach:
Enabled: true Enabled: true
Performance/Sample: Style/Sample:
Enabled: true Enabled: true
Performance/Size: Performance/Size:
@ -669,6 +673,12 @@ Rails/ApplicationJob:
Rails/ApplicationRecord: Rails/ApplicationRecord:
Enabled: true Enabled: true
Rails/ApplicationController:
Enabled: false
Rails/RakeEnvironment:
Enabled: false
Rails/Blank: Rails/Blank:
Enabled: true Enabled: true
@ -707,7 +717,7 @@ Rails/Exit:
Enabled: true Enabled: true
Rails/FilePath: Rails/FilePath:
Enabled: true Enabled: false
Rails/FindBy: Rails/FindBy:
Enabled: true Enabled: true
@ -754,6 +764,9 @@ Rails/Present:
Rails/ReadWriteAttribute: Rails/ReadWriteAttribute:
Enabled: false Enabled: false
Rails/RedundantAllowNil:
Enabled: false
Rails/RedundantReceiverInWithOptions: Rails/RedundantReceiverInWithOptions:
Enabled: true Enabled: true
@ -766,9 +779,6 @@ Rails/RequestReferer:
Rails/ReversibleMigration: Rails/ReversibleMigration:
Enabled: false Enabled: false
Rails/SafeNavigation:
Enabled: true
Rails/SaveBang: Rails/SaveBang:
Enabled: false Enabled: false
@ -846,9 +856,6 @@ Style/BlockDelimiters:
Exclude: Exclude:
- "spec/**/*" - "spec/**/*"
Style/BracesAroundHashParameters:
Enabled: false
Style/CaseEquality: Style/CaseEquality:
Enabled: true Enabled: true
@ -955,9 +962,6 @@ Style/EvenOdd:
Style/ExpandPathArguments: Style/ExpandPathArguments:
Enabled: true Enabled: true
Style/FlipFlop:
Enabled: true
Style/For: Style/For:
Enabled: true Enabled: true
@ -965,7 +969,7 @@ Style/FormatString:
Enabled: true Enabled: true
Style/FormatStringToken: Style/FormatStringToken:
Enabled: true Enabled: false
EnforcedStyle: template EnforcedStyle: template
Style/FrozenStringLiteralComment: Style/FrozenStringLiteralComment:
@ -1267,13 +1271,13 @@ Style/TrivialAccessors:
Style/UnlessElse: Style/UnlessElse:
Enabled: true Enabled: true
Style/UnneededCapitalW: Style/RedundantCapitalW:
Enabled: true Enabled: true
Style/UnneededInterpolation: Style/RedundantInterpolation:
Enabled: true Enabled: true
Style/UnneededPercentQ: Style/RedundantPercentQ:
Enabled: true Enabled: true
Style/VariableInterpolation: Style/VariableInterpolation:

View file

@ -97,6 +97,7 @@ group :development do
gem 'haml-lint' gem 'haml-lint'
gem 'letter_opener_web' gem 'letter_opener_web'
gem 'rubocop', require: false gem 'rubocop', require: false
gem 'rubocop-rails_config'
gem 'rubocop-rspec-focused', require: false gem 'rubocop-rspec-focused', require: false
gem 'scss_lint', require: false gem 'scss_lint', require: false
gem 'web-console' gem 'web-console'

View file

@ -562,6 +562,16 @@ GEM
rexml rexml
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7) unicode-display_width (>= 1.4.0, < 1.7)
rubocop-performance (1.5.2)
rubocop (>= 0.71.0)
rubocop-rails (2.4.2)
rack (>= 1.1)
rubocop (>= 0.72.0)
rubocop-rails_config (0.10.0)
railties (>= 5.0)
rubocop (~> 0.80)
rubocop-performance (~> 1.3)
rubocop-rails (~> 2.0)
rubocop-rspec-focused (1.0.0) rubocop-rspec-focused (1.0.0)
rubocop (>= 0.51) rubocop (>= 0.51)
ruby-debug-ide (0.6.1) ruby-debug-ide (0.6.1)
@ -781,6 +791,7 @@ DEPENDENCIES
rspec-rails (~> 4.0.0.beta) rspec-rails (~> 4.0.0.beta)
rspec_junit_formatter rspec_junit_formatter
rubocop rubocop
rubocop-rails_config
rubocop-rspec-focused rubocop-rspec-focused
ruby-debug-ide ruby-debug-ide
sanitize-url sanitize-url

View file

@ -58,7 +58,6 @@ class StatsController < ApplicationController
.includes(:procedure, :user) .includes(:procedure, :user)
.in_batches .in_batches
.flat_map do |dossiers| .flat_map do |dossiers|
dossiers dossiers
.pluck( .pluck(
"dossiers.id", "dossiers.id",

View file

@ -692,7 +692,6 @@ class Dossier < ApplicationRecord
.includes(:procedure, :user) .includes(:procedure, :user)
.group_by(&:user) .group_by(&:user)
.each do |(user, dossiers)| .each do |(user, dossiers)|
dossier_hashes = dossiers.map(&:hash_for_deletion_mail) dossier_hashes = dossiers.map(&:hash_for_deletion_mail)
DossierMailer.notify_brouillon_deletion(user, dossier_hashes).deliver_later DossierMailer.notify_brouillon_deletion(user, dossier_hashes).deliver_later

View file

@ -148,7 +148,6 @@ class Instructeur < ApplicationRecord
def email_notification_data def email_notification_data
groupe_instructeur_with_email_notifications groupe_instructeur_with_email_notifications
.reduce([]) do |acc, groupe| .reduce([]) do |acc, groupe|
procedure = groupe.procedure procedure = groupe.procedure
h = { h = {

View file

@ -14,7 +14,7 @@ FactoryBot.define do
path { SecureRandom.uuid } path { SecureRandom.uuid }
transient do transient do
administrateur {} administrateur { }
instructeurs { [] } instructeurs { [] }
end end