From f6122b103c4f0493c132e98de8b0b833b3c2956e Mon Sep 17 00:00:00 2001 From: Tristan Date: Mon, 17 Aug 2020 11:22:49 +0200 Subject: [PATCH] Issue voting (#75) * add new cops Co-authored-by: Tristan van Grieken Co-authored-by: Shannon Fuit --- .rubocop-performance.yml | 33 ++++++++++++++++ .rubocop-rails.yml | 51 ++++++++++++++++++++++++ .rubocop-rspec.yml | 15 +++++++ .rubocop.yml | 3 -- CHANGELOG.md | 44 +++++++++++++++++++++ default.yml | 80 ++++++++++++++++++++++++++++++++++++-- lib/rubocopital/version.rb | 2 +- rubocopital.gemspec | 8 ++-- 8 files changed, 224 insertions(+), 12 deletions(-) diff --git a/.rubocop-performance.yml b/.rubocop-performance.yml index 7640be7..ad54fbe 100644 --- a/.rubocop-performance.yml +++ b/.rubocop-performance.yml @@ -1,7 +1,40 @@ require: rubocop-performance +Performance/AncestorsInclude: + Enabled: true + +Performance/StringInclude: + Enabled: true + Performance/ChainArrayAllocation: Enabled: true Performance/OpenStruct: Enabled: true + +Performance/Squeeze: + Enabled: true + +Performance/SortReverse: + Enabled: true + +Performance/ReverseFirst: + Enabled: true + +Performance/RedundantStringChars: + Enabled: true + +Performance/RedundantSortBlock: + Enabled: true + +Performance/IoReadlines: + Enabled: true + +Performance/DeleteSuffix: + Enabled: true + +Performance/BindCall: + Enabled: true + +Performance/BigDecimalWithNumericArgument: + Enabled: true diff --git a/.rubocop-rails.yml b/.rubocop-rails.yml index 5f90361..20125f9 100644 --- a/.rubocop-rails.yml +++ b/.rubocop-rails.yml @@ -51,6 +51,57 @@ Rails/SafeNavigationWithBlank: Rails/SkipsModelValidations: Enabled: false +Rails/UniqueValidationWithoutIndex: + Enabled: true + +Rails/RenderPlainText: + Enabled: true + +Rails/RenderInline: + Enabled: true + +Rails/RedundantForeignKey: + Enabled: true + +Rails/PluckInWhere: + Enabled: true + +Rails/Pluck: + Enabled: true + +Rails/Pick: + Enabled: true + +Rails/NegateInclude: + Enabled: true + +Rails/MailerName: + Enabled: true + +Rails/FindById: + Enabled: true + +Rails/ContentTag: + Enabled: true + +Rails/MatchRoute: + Enabled: true + +Rails/ShortI18n: + Enabled: true + +Rails/PluckId: + Enabled: false + +Rails/ActiveRecordCallbacksOrder: + Enabled: true + +Rails/Inquiry: + Enabled: true + +Rails/WhereExists: + Enabled: true + Rails/UnknownEnv: Environments: - development diff --git a/.rubocop-rspec.yml b/.rubocop-rspec.yml index 40813bb..70d03d5 100644 --- a/.rubocop-rspec.yml +++ b/.rubocop-rspec.yml @@ -249,3 +249,18 @@ RSpec/VoidExpect: RSpec/Yield: Enabled: true + +RSpec/RepeatedExampleGroupDescription: + Enabled: true + +RSpec/VariableName: + Enabled: true + +RSpec/VariableDefinition: + Enabled: true + +RSpec/RepeatedExampleGroupBody: + Enabled: true + +RSpec/EmptyHook: + Enabled: true diff --git a/.rubocop.yml b/.rubocop.yml index 682aa00..b6a9345 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,3 @@ require: - rubocop-rspec inherit_from: default.yml - -Style/Documentation: - Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md index f511141..2090e86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,50 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [0.7.0] - 10 August 2020 + +- Added Rails/ActiveRecordCallbacksOrder +- Added Rails/Inquiry +- Added Rails/WhereExists + +- Added Lint/RaiseException +- Added Lint/MixedRegexpCaptureTypes +- Added Lint/DeprecatedOpenSSLConstant +- Added Lint/DuplicateElsifCondition +- Added Lint/MixedRegexpCaptureTypes + +- Added Performance/AncestorsInclude +- Added Performance/StringInclude +- Added Performance/Squeeze +- Added Performance/SortReverse +- Added Performance/ReverseFirst +- Added Performance/RedundantStringChars +- Added Performance/RedundantSortBlock +- Added Performance/IoReadlines +- Added Performance/ReverseFirst +- Added Performance/DeleteSuffix +- Added Performance/BindCall +- Added Performance/BigDecimalWithNumericArgument +- Added Performance/DeleteSuffix + +- Added RSpec/RepeatedExampleGroupDescription +- Added RSpec/VariableName +- Added RSpec/VariableDefinition +- Added RSpec/RepeatedExampleGroupBody +- Added RSpec/EmptyHook +- Added RSpec/RepeatedExampleGroupBody + +- Added Style/SlicingWithRange +- Added Style/RedundantRegexpEscape +- Added Style/RedundantRegexpCharacterClass +- Added Style/RedundantFetchBlock +- Added Style/RedundantAssignment +- Added Style/HashTransformValues +- Added Style/HashEachMethods +- Added Style/ExponentialNotation +- Added Style/BisectedAttrAccessor +- Added Style/AccessorGrouping + ## [0.6.1] - 11 March 2020 - Bumped rake dependency to a higher version to mitigate CVE-2020-8130 diff --git a/default.yml b/default.yml index 2981203..f353121 100644 --- a/default.yml +++ b/default.yml @@ -1,7 +1,7 @@ inherit_from: .rubocop-performance.yml AllCops: - TargetRubyVersion: 2.3 + TargetRubyVersion: 2.6 Exclude: - db/migrate/* - db/seeds/* @@ -90,6 +90,12 @@ Style/EachWithObject: Style/UnpackFirst: Enabled: false +Layout/EmptyLinesAroundAttributeAccessor: + Enabled: true + +Layout/SpaceAroundMethodCallOperator: + Enabled: true + Layout/EndAlignment: EnforcedStyleAlignWith: variable @@ -100,6 +106,9 @@ Layout/FirstParameterIndentation: Enabled: true EnforcedStyle: consistent +Layout/LineLength: + Max: 120 + Layout/MultilineMethodCallIndentation: EnforcedStyle: indented @@ -112,9 +121,6 @@ Style/TrivialAccessors: Metrics/AbcSize: Enabled: false -Metrics/LineLength: - Max: 120 - Metrics/BlockLength: CountComments: false # count full line comments? Max: 50 @@ -165,6 +171,54 @@ Style/NegatedUnless: Style/StringLiterals: Enabled: false +Style/ArrayCoercion: + Enabled: true + +Style/CaseLikeIf: + Enabled: true + +Style/HashAsLastArrayItem: + Enabled: true + +Style/HashLikeCase: + Enabled: true + +Style/HashTransformKeys: + Enabled: true + +Style/HashTransformValues: + Enabled: true + +Style/RedundantAssignment: + Enabled: true + +Style/RedundantFetchBlock: + Enabled: true + +Style/RedundantFileExtensionInRequire: + Enabled: true + +Style/RedundantRegexpCharacterClass: + Enabled: true + +Style/RedundantRegexpEscape: + Enabled: true + +Style/SlicingWithRange: + Enabled: true + +Style/HashEachMethods: + Enabled: true + +Style/ExponentialNotation: + Enabled: true + +Style/BisectedAttrAccessor: + Enabled: true + +Style/AccessorGrouping: + Enabled: true + Style/StringLiteralsInInterpolation: Enabled: false @@ -185,3 +239,21 @@ Lint/ToJSON: Gemspec/RubyVersionGlobalsUsage: Enabled: true + +Lint/NonDeterministicRequireOrder: + Enabled: false + +Lint/RaiseException: + Enabled: true + +Lint/MixedRegexpCaptureTypes: + Enabled: true + +Lint/DeprecatedOpenSSLConstant: + Enabled: true + +Lint/StructNewOverride: + Enabled: true + +Lint/DuplicateElsifCondition: + Enabled: true diff --git a/lib/rubocopital/version.rb b/lib/rubocopital/version.rb index f0546d0..7db8a37 100644 --- a/lib/rubocopital/version.rb +++ b/lib/rubocopital/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Rubocopital - VERSION = "0.6.1" + VERSION = "0.7.0" end diff --git a/rubocopital.gemspec b/rubocopital.gemspec index ef16631..009d988 100644 --- a/rubocopital.gemspec +++ b/rubocopital.gemspec @@ -32,10 +32,10 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_runtime_dependency "rubocop", "~> 0.77.0" - spec.add_runtime_dependency "rubocop-performance", "~> 1.5.1" - spec.add_runtime_dependency "rubocop-rails", "2.4.0" - spec.add_runtime_dependency "rubocop-rspec", "1.37.0" + spec.add_runtime_dependency "rubocop", "~> 0.88.0" + spec.add_runtime_dependency "rubocop-performance", "~> 1.7.1" + spec.add_runtime_dependency "rubocop-rails", "2.7.0" + spec.add_runtime_dependency "rubocop-rspec", "1.42.0" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", ">= 12.3.3"