From 8f11b7355a19af9e6de56edaca286bc6a5240af3 Mon Sep 17 00:00:00 2001 From: Mathieu Jobin Date: Mon, 30 Oct 2023 14:52:41 +0900 Subject: [PATCH] fix rubocop --- .rubocop.hound.yml | 261 --------------------------------------------- .rubocop.yml | 27 ++--- .rubocop_todo.yml | 239 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 247 insertions(+), 280 deletions(-) delete mode 100644 .rubocop.hound.yml create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.hound.yml b/.rubocop.hound.yml deleted file mode 100644 index 0a94997..0000000 --- a/.rubocop.hound.yml +++ /dev/null @@ -1,261 +0,0 @@ -# this is the default from hound's github, do not modify -AllCops: - Exclude: - - db/schema.rb - -AccessorMethodName: - Enabled: false - -ActionFilter: - Enabled: false - -Alias: - Enabled: false - -ArrayJoin: - Enabled: false - -AsciiComments: - Enabled: false - -AsciiIdentifiers: - Enabled: false - -Attr: - Enabled: false - -BlockNesting: - Enabled: false - -CaseEquality: - Enabled: false - -CharacterLiteral: - Enabled: false - -ClassAndModuleChildren: - Enabled: false - -ClassLength: - Enabled: false - -ClassVars: - Enabled: false - -CollectionMethods: - PreferredMethods: - find: detect - reduce: inject - collect: map - find_all: select - -ColonMethodCall: - Enabled: false - -CommentAnnotation: - Enabled: false - -CyclomaticComplexity: - Enabled: false - -Delegate: - Enabled: false - -DeprecatedHashMethods: - Enabled: false - -Documentation: - Enabled: false - -DotPosition: - EnforcedStyle: trailing - -DoubleNegation: - Enabled: false - -EachWithObject: - Enabled: false - -EmptyLiteral: - Enabled: false - -Encoding: - Enabled: false - -EvenOdd: - Enabled: false - -FileName: - Enabled: false - -FlipFlop: - Enabled: false - -FormatString: - Enabled: false - -GlobalVars: - Enabled: false - -GuardClause: - Enabled: false - -IfUnlessModifier: - Enabled: false - -IfWithSemicolon: - Enabled: false - -InlineComment: - Enabled: false - -Lambda: - Enabled: false - -LambdaCall: - Enabled: false - -LineEndConcatenation: - Enabled: false - -LineLength: - Max: 120 - AllowURI: true - -MethodLength: - Enabled: false - -ModuleFunction: - Enabled: false - -NegatedIf: - Enabled: false - -NegatedWhile: - Enabled: false - -Next: - Enabled: false - -NilComparison: - Enabled: false - -Not: - Enabled: false - -NumericLiterals: - Enabled: false - -OneLineConditional: - Enabled: false - -OpMethod: - Enabled: false - -ParameterLists: - Enabled: false - -PercentLiteralDelimiters: - Enabled: false - -PerlBackrefs: - Enabled: false - -PredicateName: - NamePrefixBlacklist: - - is_ - -Proc: - Enabled: false - -RaiseArgs: - Enabled: false - -RegexpLiteral: - Enabled: false - -SelfAssignment: - Enabled: false - -SingleLineBlockParams: - Enabled: false - -SingleLineMethods: - Enabled: false - -SignalException: - Enabled: false - -SpecialGlobalVars: - Enabled: false - -StringLiterals: - EnforcedStyle: double_quotes - -VariableInterpolation: - Enabled: false - -TrailingComma: - Enabled: false - -TrivialAccessors: - Enabled: false - -VariableInterpolation: - Enabled: false - -WhenThen: - Enabled: false - -WhileUntilModifier: - Enabled: false - -WordArray: - Enabled: false - -# Lint - -AmbiguousOperator: - Enabled: false - -AmbiguousRegexpLiteral: - Enabled: false - -AssignmentInCondition: - Enabled: false - -ConditionPosition: - Enabled: false - -DeprecatedClassMethods: - Enabled: false - -ElseLayout: - Enabled: false - -HandleExceptions: - Enabled: false - -InvalidCharacterLiteral: - Enabled: false - -LiteralInCondition: - Enabled: false - -LiteralInInterpolation: - Enabled: false - -Loop: - Enabled: false - -ParenthesesAsGroupedExpression: - Enabled: false - -RequireParentheses: - Enabled: false - -UnderscorePrefixedVariableName: - Enabled: false - -Void: - Enabled: false diff --git a/.rubocop.yml b/.rubocop.yml index 222945a..8cc6a71 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,19 +1,16 @@ -inherit_from: - - .rubocop.hound.yml +inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 2.1 - Exclude: - - '*.gemspec' - - 'Gemfile' + NewCops: enable + TargetRubyVersion: 2.7 -Style/EmptyLinesAroundClassBody: +Layout/EmptyLinesAroundClassBody: Enabled: false -Style/EmptyLinesAroundModuleBody: +Layout/EmptyLinesAroundModuleBody: Enabled: false -Style/EmptyLinesAroundMethodBody: +Layout/EmptyLinesAroundMethodBody: Enabled: false Style/ClassCheck: @@ -23,7 +20,7 @@ Style/ClassCheck: Style/StringLiterals: Enabled: false -Style/FileName: +Naming/FileName: Enabled: false Style/RedundantException: @@ -35,19 +32,11 @@ Style/SignalException: Style/BlockDelimiters: Enabled: false -Style/CollectionMethods: - PreferredMethods: - detect: find - # Github's PR width is 120 characters -Metrics/LineLength: +Layout/LineLength: Max: 120 AllowURI: true -# Align with the style guide, we don't prefer anything -Style/CollectionMethods: - Enabled: false - Metrics/AbcSize: Description: A calculated magnitude based on number of assignments, branches, and conditions. diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..c86498b --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,239 @@ +# This configuration was generated by +# `rubocop --auto-gen-config --exclude-limit 250` +# on 2023-10-30 05:52:00 UTC using RuboCop version 1.7.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. +# Include: **/*.gemspec +Gemspec/OrderedDependencies: + Exclude: + - 'ph_model.gemspec' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: **/*.gemspec +Gemspec/RequiredRubyVersion: + Exclude: + - 'ph_model.gemspec' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'lib/ph_model/concerns/attribute_nested_validation.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'lib/ph_model/version.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 122 + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: require_no_space, require_space +Layout/SpaceInLambdaLiteral: + Exclude: + - 'lib/active_model/validations/collection_items_validator/array_attribute_reader.rb' + - 'spec/active_model/validations/collection_items_validator/array_attribute_getter_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. +Lint/UnusedBlockArgument: + Exclude: + - 'lib/ph_model.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. +Lint/UnusedMethodArgument: + Exclude: + - 'lib/ph_model/concerns/attribute_nested_validation.rb' + +# Offense count: 1 +# Configuration parameters: CheckForMethodsWithNoSideEffects. +Lint/Void: + Exclude: + - 'lib/ph_model.rb' + +# Offense count: 3 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# IgnoredMethods: refine +Metrics/BlockLength: + Max: 61 + +# Offense count: 1 +# Configuration parameters: IgnoredMethods. +Metrics/CyclomaticComplexity: + Max: 8 + +# Offense count: 2 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +Metrics/MethodLength: + Max: 23 + +# Offense count: 1 +# Configuration parameters: IgnoredMethods. +Metrics/PerceivedComplexity: + Max: 10 + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: nested, compact +Style/ClassAndModuleChildren: + Exclude: + - 'lib/active_model/validations/collection_items_validator/array_attribute_getter.rb' + - 'lib/active_model/validations/collection_items_validator/array_attribute_reader.rb' + - 'lib/active_model/validations/collection_items_validator/inner_validator_builder.rb' + +# Offense count: 3 +Style/Documentation: + Exclude: + - 'spec/**/*' + - 'test/**/*' + - 'lib/ph_model/concerns/attribute_nested_validation.rb' + - 'lib/ph_model/concerns/attribute_of_array_type_initialization.rb' + - 'lib/ph_model/concerns/attribute_required_validation.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/Encoding: + Exclude: + - 'ph_model.gemspec' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/ExpandPathArguments: + Exclude: + - 'ph_model.gemspec' + +# Offense count: 23 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'Gemfile' + - 'Rakefile' + - 'lib/active_model/validations/collection_items_validator.rb' + - 'lib/active_model/validations/collection_items_validator/array_attribute_getter.rb' + - 'lib/active_model/validations/collection_items_validator/array_attribute_reader.rb' + - 'lib/active_model/validations/collection_items_validator/inner_validator_builder.rb' + - 'lib/active_model/validations/type_validator.rb' + - 'lib/ph_model.rb' + - 'lib/ph_model/concerns.rb' + - 'lib/ph_model/concerns/attribute_nested_validation.rb' + - 'lib/ph_model/concerns/attribute_of_array_type_initialization.rb' + - 'lib/ph_model/concerns/attribute_required_validation.rb' + - 'lib/ph_model/concerns/attribute_type_validation.rb' + - 'lib/ph_model/concerns/initialize_callback.rb' + - 'lib/ph_model/concerns/validated_factory.rb' + - 'lib/ph_model/validation_failed.rb' + - 'ph_model.gemspec' + - 'spec/active_model/validations/collection_items_validator/array_attribute_getter_spec.rb' + - 'spec/active_model/validations/collection_items_validator/inner_validator_builder_spec.rb' + - 'spec/active_model/validations/collection_items_validator_spec.rb' + - 'spec/active_model/validations/type_validator_spec.rb' + - 'spec/model_spec.rb' + - 'spec/spec_helper.rb' + +# Offense count: 2 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'lib/active_model/validations/type_validator.rb' + - 'lib/ph_model/concerns/attribute_type_validation.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowIfModifier. +Style/IfInsideElse: + Exclude: + - 'lib/ph_model/concerns/attribute_type_validation.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Exclude: + - 'lib/ph_model/concerns/attribute_required_validation.rb' + - 'lib/ph_model/concerns/validated_factory.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/MultilineIfModifier: + Exclude: + - 'lib/ph_model.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/NegatedIfElseCondition: + Exclude: + - 'lib/ph_model/concerns/attribute_type_validation.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'Rakefile' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantFreeze: + Exclude: + - 'lib/ph_model/version.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/RedundantSelf: + Exclude: + - 'lib/ph_model.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods. +# AllowedMethods: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'lib/ph_model.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'lib/ph_model/concerns/attribute_of_array_type_initialization.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/StderrPuts: + Exclude: + - 'Rakefile' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 122