Skip to content

Commit

Permalink
Activate new Rubocop cops
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyates committed Sep 30, 2023
1 parent 22022ae commit dbe950a
Show file tree
Hide file tree
Showing 34 changed files with 291 additions and 129 deletions.
174 changes: 164 additions & 10 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,43 @@ AllCops:
Enabled: true
TargetRubyVersion: 2.6

Capybara:
Enabled: false

FactoryBot:
Enabled: false

Gemspec/DeprecatedAttributeAssignment:
Enabled: true
Gemspec/DevelopmentDependencies:
Enabled: true
Gemspec/RequireMFA:
Enabled: true

Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Layout/DotPosition:
EnforcedStyle: trailing
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/LineContinuationLeadingSpace:
Enabled: true
Layout/LineContinuationSpacing:
Enabled: true
Layout/LineEndStringConcatenationIndentation:
Enabled: true
Layout/LineLength:
Enabled: true
Max: 100
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Enabled: true
Layout/SpaceAroundOperators:
Enabled: true
EnforcedStyleForExponentOperator: space
Layout/SpaceBeforeBrackets:
Enabled: true
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

Lint/AmbiguousAssignment:
Enabled: true
Expand All @@ -48,6 +62,8 @@ Lint/ConstantDefinitionInBlock: # TODO
- "spec/unit/imap/backup/account/connection_spec.rb"
- "spec/unit/imap/backup/account/folder_spec.rb"
- "spec/unit/imap/backup/setup/account_spec.rb"
Lint/ConstantOverwrittenInRescue:
Enabled: true
Lint/DeprecatedConstants:
Enabled: true
Lint/DeprecatedOpenSSLConstant:
Expand All @@ -56,6 +72,10 @@ Lint/DuplicateBranch:
Enabled: true
Lint/DuplicateElsifCondition:
Enabled: true
Lint/DuplicateMagicComment:
Enabled: true
Lint/DuplicateMatchPattern:
Enabled: true
Lint/DuplicateRegexpCharacterClassElement:
Enabled: true
Lint/DuplicateRescueException:
Expand All @@ -76,8 +96,12 @@ Lint/LambdaWithoutLiteralBlock:
Enabled: true
Lint/MissingSuper:
Enabled: true
Lint/MixedCaseRange:
Enabled: true
Lint/MixedRegexpCaptureTypes:
Enabled: true
Lint/NonAtomicFileOperation:
Enabled: true
Lint/NoReturnInBeginEndBlocks:
Enabled: true
Lint/NumberedParameterAssignment:
Expand All @@ -90,6 +114,12 @@ Lint/RaiseException:
Enabled: true
Lint/RedundantDirGlobSort:
Enabled: true
Lint/RedundantRegexpQuantifiers:
Enabled: true
Lint/RefinementImportMethods:
Enabled: true
Lint/RequireRangeParentheses:
Enabled: true
Lint/RequireRelativeSelfPath:
Enabled: true
Lint/SelfAssignment:
Expand All @@ -110,11 +140,13 @@ Lint/UnmodifiedReduceAccumulator:
Enabled: true
Lint/UnreachableLoop:
Enabled: true
Lint/UselessRescue:
Enabled: true
Lint/UselessRuby2Keywords:
Enabled: true

Metrics/BlockLength:
IgnoredMethods:
AllowedMethods:
- context
- describe
- feature
Expand All @@ -124,6 +156,8 @@ Metrics/BlockLength:
Metrics/ClassLength:
Enabled: true
CountAsOne: ["heredoc"]
Metrics/CollectionLiteralLength:
Enabled: true
Metrics/ModuleLength:
Enabled: true
Exclude:
Expand All @@ -132,6 +166,16 @@ Metrics/ModuleLength:
Naming/BlockForwarding:
Enabled: true

RSpec/BeEmpty:
Enabled: true
RSpec/BeEq:
Enabled: true
RSpec/BeNil:
Enabled: true
RSpec/ChangeByZero:
Enabled: true
RSpec/ContainExactly:
Enabled: true
RSpec/ContextWording:
Exclude:
- "spec/features/**/*"
Expand All @@ -140,20 +184,32 @@ RSpec/DescribeClass:
- spec/*
- spec/features/**/*
- spec/requests/**/*
RSpec/DuplicatedMetadata:
Enabled: true
RSpec/EmptyMetadata:
Enabled: true
RSpec/ExcessiveDocstringSpacing:
Enabled: true
RSpec/FactoryBot/SyntaxMethods:
RSpec/Eq:
Enabled: true
RSpec/FilePath:
Enabled: true
Exclude:
- spec/unit/email/provider/gmail_spec.rb
RSpec/IdenticalEqualityAssertion:
Enabled: true
RSpec/SubjectDeclaration:
RSpec/IndexedLet:
Enabled: true
RSpec/LeakyConstantDeclaration:
Enabled: false
RSpec/LetSetup:
Enabled: false
RSpec/MatchArray:
Enabled: true
RSpec/MessageSpies:
Enabled: false
RSpec/MetadataStyle:
Enabled: true
RSpec/MultipleExpectations:
Exclude:
- spec/**/*
Expand All @@ -163,10 +219,43 @@ RSpec/NamedSubject:
Enabled: false
RSpec/NestedGroups: # TODO
Enabled: false
RSpec/NoExpectationExample:
Enabled: true
RSpec/NotToNot:
Enabled: false
RSpec/PendingWithoutReason:
Enabled: true
RSpec/Rails/AvoidSetupHook:
Enabled: false
RSpec/Rails/HaveHttpStatus:
Enabled: false
RSpec/Rails/InferredSpecType:
Enabled: false
RSpec/Rails/MinitestAssertions:
Enabled: false
RSpec/Rails/NegationBeValid:
Enabled: false
RSpec/Rails/TravelAround:
Enabled: false
RSpec/ReceiveMessages:
Enabled: true
RSpec/RedundantAround:
Enabled: true
RSpec/SkipBlockInsideExample:
Enabled: true
RSpec/SortMetadata:
Enabled: true
RSpec/SpecFilePathFormat:
Enabled: true
Exclude:
- spec/unit/email/provider/gmail_spec.rb
RSpec/SpecFilePathSuffix:
Enabled: true
RSpec/SubjectDeclaration:
Enabled: true
RSpec/VerifiedDoubleReference:
Enabled: true

RSpec/ReturnFromStub:
Enabled: false

Expand All @@ -180,6 +269,8 @@ Style/ArgumentsForwarding:
Enabled: true
Style/ArrayCoercion:
Enabled: true
Style/ArrayIntersect:
Enabled: true
Style/BisectedAttrAccessor:
Enabled: true
Style/CaseLikeIf:
Expand All @@ -188,6 +279,14 @@ Style/ClassAndModuleChildren:
Enabled: false
Style/CollectionCompact:
Enabled: true
Style/ComparableClamp:
Enabled: true
Style/ConcatArrayLiterals:
Enabled: true
Style/DataInheritance:
Enabled: true
Style/DirEmpty:
Enabled: true
Style/Documentation:
Enabled: false
Style/DocumentDynamicEvalDefinition:
Expand All @@ -196,14 +295,24 @@ Style/DoubleNegation:
Enabled: false
Style/EmptyCaseCondition:
Enabled: false
Style/EmptyHeredoc:
Enabled: true
Style/EmptyMethod:
EnforcedStyle: expanded
Style/EndlessMethod:
Enabled: true
Style/EnvHome:
Enabled: true
Style/ExactRegexpMatch:
Enabled: true
Style/ExplicitBlockArgument:
Enabled: true
Style/ExponentialNotation:
Enabled: true
Style/FetchEnvVar:
Enabled: true
Style/FileEmpty:
Enabled: true
Style/FileRead:
Enabled: true
Style/FileWrite: # TODO
Expand Down Expand Up @@ -232,42 +341,82 @@ Style/InPatternThen:
Enabled: true
Style/Lambda:
EnforcedStyle: literal
Style/MagicCommentFormat:
Enabled: true
Style/MapCompactWithConditionalBlock:
Enabled: true
Style/MapToHash:
Enabled: true
Style/MapToSet:
Enabled: true
Style/MinMaxComparison:
Enabled: true
Style/MultilineInPatternThen:
Enabled: true
Style/NegatedIf:
Enabled: false
Style/NegatedIfElseCondition:
Enabled: true
Style/NestedFileDirname:
Enabled: true
Style/NilLambda: # TODO
Enabled: false
Style/NumberedParameters:
Enabled: true
Style/NumberedParametersLimit:
Enabled: true
Style/PercentLiteralDelimiters:
Enabled: false
Style/ObjectThen:
Enabled: true
Style/OpenStructUse: # TODO
Enabled: false
Style/OperatorMethodCall:
Enabled: true
Style/OptionalBooleanParameter:
Enabled: true
Style/PercentLiteralDelimiters:
Enabled: false
Style/QuotedSymbols:
Enabled: true
Style/RedundantArgument:
Enabled: true
Style/RedundantArrayConstructor:
Enabled: true
Style/RedundantAssignment:
Enabled: true
Style/RedundantConstantBase:
Enabled: true
Style/RedundantCurrentDirectoryInPath:
Enabled: true
Style/RedundantDoubleSplatHashBraces:
Enabled: true
Style/RedundantEach:
Enabled: true
Style/RedundantFetchBlock:
Enabled: true
Style/RedundantFileExtensionInRequire:
Enabled: true
Style/RedundantFilterChain:
Enabled: true
Style/RedundantHeredocDelimiterQuotes:
Enabled: true
Style/RedundantInitialize:
Enabled: true
Style/RedundantLineContinuation:
Enabled: true
Style/RedundantRegexpArgument:
Enabled: true
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpConstructor:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/RedundantSelfAssignmentBranch:
Enabled: true
Style/RedundantStringEscape:
Enabled: true
Style/ReturnNilInPredicateMethodDefinition:
Enabled: true
Style/SelectByRegexp:
Enabled: true
Style/SingleArgumentDig:
Expand All @@ -284,3 +433,8 @@ Style/SymbolArray:
Enabled: false
Style/SwapValues:
Enabled: true
Style/YAMLFileRead:
Enabled: true

Security/CompoundHash:
Enabled: true
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
source "https://rubygems.org"

gemspec

gem "aruba", ">= 0.0.0"
gem "pry-byebug"
gem "rspec", ">= 3.0.0"
gem "rubocop-rspec"
gem "simplecov"
gem "yard"
7 changes: 0 additions & 7 deletions imap-backup.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency "thor", "~> 1.1"
gem.add_runtime_dependency "thunderbird", ">= 0.0.0"

gem.add_development_dependency "aruba", ">= 0.0.0"
gem.add_development_dependency "pry-byebug"
gem.add_development_dependency "rspec", ">= 3.0.0"
gem.add_development_dependency "rubocop-rspec"
gem.add_development_dependency "simplecov"
gem.add_development_dependency "yard"

gem.metadata = {
"rubygems_mfa_required" => "true"
}
Expand Down
4 changes: 2 additions & 2 deletions lib/cli_coverage.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class CliCoverage
def self.conditionally_activate
return if !ENV["COVERAGE"]
return if !ENV.key?("COVERAGE")

require "simplecov"

# Collect coverage separately
SimpleCov.command_name "#{ENV['COVERAGE']} #{ARGV.join(' ')} coverage"
SimpleCov.command_name "#{ENV.fetch('COVERAGE')} #{ARGV.join(' ')} coverage"

# Silence output
SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
Expand Down
Loading

0 comments on commit dbe950a

Please sign in to comment.