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

View file

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

View file

@ -562,6 +562,16 @@ GEM
rexml
ruby-progressbar (~> 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 (>= 0.51)
ruby-debug-ide (0.6.1)
@ -781,6 +791,7 @@ DEPENDENCIES
rspec-rails (~> 4.0.0.beta)
rspec_junit_formatter
rubocop
rubocop-rails_config
rubocop-rspec-focused
ruby-debug-ide
sanitize-url

View file

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

View file

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

View file

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

View file

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