openfoodfoundation / openfoodnetwork

Connect suppliers, distributors and consumers to trade local produce.
https://www.openfoodnetwork.org
GNU Affero General Public License v3.0
1.12k stars 723 forks source link

Fix important RuboCop issues #6055

Open jhsu802701 opened 4 years ago

jhsu802701 commented 4 years ago

We use Rubocop to standardise our code, which can improve code quality and reduce confusion. When evaluating each rule, consider if it helps with those goals or not. Often the suggested autocorrection is fine, but some cops require more consideration and there may be a better solution, or it might be appropriate to disable them, rather than create unnecessary extra work. If unsure, please ping @openfoodfoundation/core-devs to request an opinion.

Issue created by @jhsu802701, description updated by @luisramos0 and the Open Food Network team. Thanks Jason for originally creating this issue!

This epic represents the effort to gradually fix all these warnings. Many issues should only be resolved when working on the affected code anyway. But others are good to solve on their own to improve the code quality and avoid confusion about code style.

:information_source: The .rubocop_todo.yml file is not always up to date. You can update it with:

bundle exec rubocop --regenerate

Strategy to fix issues

The normal process to fix a style issue is:

  1. Choose a cop to work on, next on the list (but :warning: double check there isn't already a PR addressing the cop: https://github.com/openfoodfoundation/openfoodnetwork/pulls)
  2. Remove it from .rubocop_todo.yml and run rubocop to see the error(s).
  3. Evaluate the rule, and consider applying the suggested fix if it makes sense
    • It may be helpful to commit some fixes separately, or chunked together
    • If it's not a simple fix, it may be worth simply adding a rubocop:disable comment in some cases (disable only offending line where possible)

When a cop or group of cops is complete, open a pull request.

But which issues should be fixed first?

Current strategy (Feb 2024)

As of Feb 2024, we have the following Rubocop offences:

Total 157: ... see full list - [Capybara/CurrentPathExpectation](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Capybara/CurrentPathExpectation) - [Capybara/NegationMatcher](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Capybara/NegationMatcher) - [Capybara/SpecificActions](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Capybara/SpecificActions) - [Capybara/SpecificFinders](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Capybara/SpecificFinders) - [Capybara/SpecificMatcher](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Capybara/SpecificMatcher) - [Capybara/VisibilityMatcher](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Capybara/VisibilityMatcher) - [FactoryBot/AssociationStyle](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/FactoryBot/AssociationStyle) - [FactoryBot/ConsistentParenthesesStyle](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/FactoryBot/ConsistentParenthesesStyle) - [FactoryBot/CreateList](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/FactoryBot/CreateList) - [FactoryBot/FactoryAssociationWithStrategy](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/FactoryBot/FactoryAssociationWithStrategy) - [FactoryBot/FactoryClassName](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/FactoryBot/FactoryClassName) - [FactoryBot/RedundantFactoryOption](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/FactoryBot/RedundantFactoryOption) - [FactoryBot/SyntaxMethods](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/FactoryBot/SyntaxMethods) - [Layout/LineLength](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/LineLength) - [Lint/ConstantDefinitionInBlock](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/ConstantDefinitionInBlock) - [Lint/DuplicateBranch](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/DuplicateBranch) - [Lint/DuplicateMethods](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/DuplicateMethods) - [Lint/DuplicateRequire](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/DuplicateRequire) - [Lint/EmptyBlock](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/EmptyBlock) - [Lint/EmptyClass](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/EmptyClass) - [Lint/EmptyFile](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/EmptyFile) - [Lint/FloatComparison](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/FloatComparison) - [Lint/IneffectiveAccessModifier](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/IneffectiveAccessModifier) - [Lint/NoReturnInBeginEndBlocks](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/NoReturnInBeginEndBlocks) - [Lint/RedundantDirGlobSort](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/RedundantDirGlobSort) - [Lint/RedundantSafeNavigation](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/RedundantSafeNavigation) - [Lint/SelfAssignment](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/SelfAssignment) - [Lint/UselessMethodDefinition](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/UselessMethodDefinition) - [Metrics/AbcSize](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/AbcSize) - [Metrics/BlockLength](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/BlockLength) - [Metrics/BlockNesting](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/BlockNesting) - [Metrics/ClassLength](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/ClassLength) - [Metrics/CyclomaticComplexity](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/CyclomaticComplexity) - [Metrics/MethodLength](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/MethodLength) - [Metrics/ModuleLength](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/ModuleLength) - [Metrics/ParameterLists](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/ParameterLists) - [Metrics/PerceivedComplexity](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/PerceivedComplexity) - [Naming/AccessorMethodName](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/AccessorMethodName) - [Naming/HeredocDelimiterNaming](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/HeredocDelimiterNaming) - [Naming/MemoizedInstanceVariableName](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/MemoizedInstanceVariableName) - [Naming/MethodParameterName](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/MethodParameterName) - [Naming/VariableNumber](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/VariableNumber) - [RSpec/AnyInstance](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/AnyInstance) - [RSpec/Be](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/Be) - [RSpec/BeEmpty](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/BeEmpty) - [RSpec/BeEq](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/BeEq) - [RSpec/BeEql](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/BeEql) - [RSpec/BeNil](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/BeNil) - [RSpec/BeforeAfterAll](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/BeforeAfterAll) - [RSpec/Capybara/FeatureMethods](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/Capybara/FeatureMethods) - [RSpec/ChangeByZero](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ChangeByZero) - [RSpec/ContextMethod](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ContextMethod) - [RSpec/ContextWording](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ContextWording) - [RSpec/DescribeClass](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/DescribeClass) - [RSpec/DescribedClass](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/DescribedClass) - [RSpec/EmptyExampleGroup](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/EmptyExampleGroup) - [RSpec/EmptyLineAfterExample](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/EmptyLineAfterExample) - [RSpec/EmptyLineAfterExampleGroup](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup) - [RSpec/EmptyLineAfterFinalLet](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet) - [RSpec/EmptyLineAfterHook](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/EmptyLineAfterHook) - [RSpec/EmptyLineAfterSubject](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/EmptyLineAfterSubject) - [RSpec/ExampleLength](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ExampleLength) - [RSpec/ExampleWording](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ExampleWording) - [RSpec/ExcessiveDocstringSpacing](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing) - [RSpec/ExpectInHook](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ExpectInHook) - [RSpec/FilePath](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/FilePath) - [RSpec/HookArgument](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/HookArgument) - [RSpec/ImplicitExpect](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ImplicitExpect) - [RSpec/ImplicitSubject](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ImplicitSubject) - [RSpec/IndexedLet](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/IndexedLet) - [RSpec/InstanceVariable](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/InstanceVariable) - [RSpec/ItBehavesLike](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ItBehavesLike) - [RSpec/IteratedExpectation](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/IteratedExpectation) - [RSpec/LeadingSubject](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/LeadingSubject) - [RSpec/LeakyConstantDeclaration](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/LeakyConstantDeclaration) - [RSpec/LetSetup](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/LetSetup) - [RSpec/MatchArray](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/MatchArray) - [RSpec/MessageChain](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/MessageChain) - [RSpec/MessageSpies](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/MessageSpies) - [RSpec/MultipleDescribes](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/MultipleDescribes) - [RSpec/MultipleExpectations](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/MultipleExpectations) - [RSpec/MultipleMemoizedHelpers](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/MultipleMemoizedHelpers) - [RSpec/NamedSubject](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/NamedSubject) - [RSpec/NestedGroups](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/NestedGroups) - [RSpec/NoExpectationExample](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/NoExpectationExample) - [RSpec/NotToNot](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/NotToNot) - [RSpec/PendingWithoutReason](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/PendingWithoutReason) - [RSpec/PredicateMatcher](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/PredicateMatcher) - [RSpec/Rails/HaveHttpStatus](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/Rails/HaveHttpStatus) - [RSpec/Rails/HttpStatus](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/Rails/HttpStatus) - [RSpec/Rails/InferredSpecType](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/Rails/InferredSpecType) - [RSpec/Rails/NegationBeValid](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/Rails/NegationBeValid) - [RSpec/ReceiveCounts](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ReceiveCounts) - [RSpec/ReceiveMessages](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ReceiveMessages) - [RSpec/RepeatedDescription](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/RepeatedDescription) - [RSpec/RepeatedExample](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/RepeatedExample) - [RSpec/RepeatedExampleGroupBody](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/RepeatedExampleGroupBody) - [RSpec/RepeatedExampleGroupDescription](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription) - [RSpec/ReturnFromStub](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ReturnFromStub) - [RSpec/ScatteredLet](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ScatteredLet) - [RSpec/ScatteredSetup](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/ScatteredSetup) - [RSpec/SortMetadata](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/SortMetadata) - [RSpec/StubbedMock](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/StubbedMock) - [RSpec/SubjectDeclaration](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/SubjectDeclaration) - [RSpec/SubjectStub](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/SubjectStub) - [RSpec/UnspecifiedException](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/UnspecifiedException) - [RSpec/VariableName](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/VariableName) - [RSpec/VerifiedDoubleReference](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/VerifiedDoubleReference) - [RSpec/VerifiedDoubles](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/VerifiedDoubles) - [Rails/FindEach](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/FindEach) - [Rails/HasManyOrHasOneDependent](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/HasManyOrHasOneDependent) - [Rails/HelperInstanceVariable](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/HelperInstanceVariable) - [Rails/I18nLocaleAssignment](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/I18nLocaleAssignment) - [Rails/I18nLocaleTexts](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/I18nLocaleTexts) - [Rails/InverseOf](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/InverseOf) - [Rails/LexicallyScopedActionFilter](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/LexicallyScopedActionFilter) - [Rails/NegateInclude](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/NegateInclude) - [Rails/Pluck](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/Pluck) - [Rails/PluckInWhere](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/PluckInWhere) - [Rails/RedundantActiveRecordAllMethod](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/RedundantActiveRecordAllMethod) - [Rails/RedundantPresenceValidationOnBelongsTo](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/RedundantPresenceValidationOnBelongsTo) - [Rails/RelativeDateConstant](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/RelativeDateConstant) - [Rails/ResponseParsedBody](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/ResponseParsedBody) - [Rails/RootPathnameMethods](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/RootPathnameMethods) - [Rails/SelectMap](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/SelectMap) - [Rails/SkipsModelValidations](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/SkipsModelValidations) - [Rails/SquishedSQLHeredocs](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/SquishedSQLHeredocs) - [Rails/TimeZone](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/TimeZone) - [Rails/TransactionExitStatement](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/TransactionExitStatement) - [Rails/UniqueValidationWithoutIndex](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/UniqueValidationWithoutIndex) - [Rails/UnknownEnv](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/UnknownEnv) - [Rails/UnusedRenderContent](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/UnusedRenderContent) - [Rails/WhereEquals](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/WhereEquals) - [Rails/WhereExists](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/WhereExists) - [Security/Open](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Security/Open) - [Style/ArrayIntersect](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/ArrayIntersect) - [Style/CaseEquality](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/CaseEquality) - [Style/ClassAndModuleChildren](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/ClassAndModuleChildren) - [Style/FrozenStringLiteralComment](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FrozenStringLiteralComment) - [Style/GlobalStdStream](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/GlobalStdStream) - [Style/HashConversion](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashConversion) - [Style/HashEachMethods](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashEachMethods) - [Style/HashLikeCase](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashLikeCase) - [Style/MapToHash](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/MapToHash) - [Style/MissingRespondToMissing](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/MissingRespondToMissing) - [Style/NestedModifier](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/NestedModifier) - [Style/OpenStructUse](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/OpenStructUse) - [Style/OptionalBooleanParameter](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/OptionalBooleanParameter) - [Style/PreferredHashMethods](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/PreferredHashMethods) - [Style/RedundantArgument](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/RedundantArgument) - [Style/RedundantAssignment](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/RedundantAssignment) - [Style/RedundantInitialize](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/RedundantInitialize) - [Style/RedundantInterpolation](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/RedundantInterpolation) - [Style/ReturnNilInPredicateMethodDefinition](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/ReturnNilInPredicateMethodDefinition) - [Style/Send](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/Send) - [Style/SlicingWithRange](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/SlicingWithRange) - [Style/StringConcatenation](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/StringConcatenation)

You can generate the list with this one-liner:

# Uncomment for optional formatting and clipboard copy
grep '^[A-Z]' .rubocop_todo.yml | tr -d : # | sed 's%\(.*\)%- [ ] [\1](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/\1)%' | pbcopy
jhsu802701 commented 4 years ago

Avoid changing files in the app/models/spree to avoid conflicts with pull requests.

luisramos0 commented 4 years ago

I just rewrote the description to make this task more clear. I am tagging good first issue as this is something new devs can use to practice working with the codebase, git and github issues and PRs :+1:

Let the countdown begin! 1251 to go...

luisramos0 commented 4 years ago

I am not sure why I thought there were 1251 issues to solve.

If I leave .rubocop_todo.yml with these two exceptions: image

I see 4371 rubocop issues in total. From these, these are the main ones:

luisramos0 commented 3 years ago

After the clean ups we are down to 3983 offenses.

luisramos0 commented 3 years ago

After PR #7926 we are down to 2598 offenses (excluding UselessAssignment in specs)

luisAzcuaga commented 3 years ago

I'm helping with this! :)

luisAzcuaga commented 3 years ago

Btw my numbers were 479 offenses detected, 251 offenses corrected :)

Hence only 228 offenses remain.

macanudo527 commented 1 year ago

For the errors that involve not inverting include? How should we resolve them, since Activesupport is not in the Gemfile? Should they just be ignored?

macanudo527 commented 1 year ago

I'm going to try to tackle all of the Layout/LineLength offenses. I think it'll be a good way to familiarize myself with the code.

dacook commented 1 year ago

We can actually fix a lot of violations with rubocop's safe correction feature, and have a script for that. I propose we do as many safe corrections first, then we can prioritise the remaining ones.

dacook commented 1 year ago

Hi @macanudo527 , we've updated this issue to provide a bit more structure on how we work through these. Would you be willing to take on the next step, which is https://github.com/openfoodfoundation/openfoodnetwork/issues/11253 ?

macanudo527 commented 1 year ago

Hi @macanudo527 , we've updated this issue to provide a bit more structure on how we work through these. Would you be willing to take on the next step, which is #11253 ?

OK, will do. What would you say is a good bundle size? Limit it to 25 files per PR? I know there is a whopper in there with 1700+ violations.

EDIT: I guess you put 20 in the example, so I'll go with that.

dacook commented 1 year ago

Still a good question, maybe run it for 20 (will take a while), then review the commits. If there's some big ones, maybe break them up into separate branches/PRs.