-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce new RuboCop cops for all Ruby files (#566)
* Let RuboCop autocorrect all Ruby files (safe) Only safe autocorrections used. Command: bundle exec rubocop --autocorrect --disable-uncorrectable version: 1.57.2 (using Parser 3.2.2.4, rubocop-ast 1.30.0, running on ruby 3.1.4) [x86_64-linux] See the docs: https://docs.rubocop.org/rubocop/usage/auto_correct.html 704 files inspected, 8138 offenses detected, 7399 offenses corrected, 720 more offenses can be corrected with `rubocop -A`. Note there occurred one error for the file "db/seeds.rb", which will be fixed manually in subsequent commits. * Revert "Let RuboCop autocorrect all Ruby files (safe)" This reverts commit b067b2f. * Force use of explicit hash literal value (HashSyntax) * Only correct string literals to double quotes (safe) 704 files inspected, 3912 offenses detected, 3912 offenses corrected * Allow use of method ".touch" * Autocorrect all other specified cops (safe) 704 files inspected, 3171 offenses detected, 2432 offenses corrected, 720 more offenses can be corrected with `rubocop -A` Command: bundle exec rubocop --autocorrect --disable-uncorrectable * Fix Layout/IndentationConsistency (manual) * Fix (or disable) Layout/LineLength * Fix all Style/ cops * Fix Lint/ cops (3 still left open) * Rename `get_votes_count` to `votes_count` * Fix other Naming/ cops (1 still left open) * Disable `Rails/HelperInstanceVariable` in `quizzes_helper.rb` This is since we only use the instance variable to provide a *default* value for some params, so the helper methods can still be reused. * Fix all Rails/InverseOf cops * Disable Rails/ cops in existing db migrations The respective comments were added manually, not automatically. * Fix Rails/SkipsModelValidations (1 left open) Replaced `update_all` by `update` and `Time.now` by `Time.current` * Disable Rails/OutputSafety for one line * Fix Rails/I18n related cops * Add custom env variable to rubocop This is to avoid Rails/UnknownEnv error * Disable Performance/CollectionLiteralInLoop in some tests * Merge two duplicates groups in Gemfile together * Automatically autocorrect cops (unsafe) Command used: bundle exec rubocop --autocorrect-all --disable-uncorrectable 704 files inspected, 911 offenses detected, 909 offenses corrected 2 errors occurred: An error occurred while Style/StringConcatenation cop was inspecting mampf/app/models/medium.rb:871:30. An error occurred while Layout/LineLength cop was inspecting mampf/db/seeds.rb. I manually fixed the error in medium.rb. I checked the seeds.rb and dit not find any error there. * Fix missing `Time.zone.now` * Add Style/MethodCallWithArgsParentheses and autofix (safe) Command used: bundle exec rubocop --autocorrect --disable-uncorrectable 704 files inspected, 371 offenses detected, 350 offenses corrected, 13 more offenses can be corrected with `rubocop -A` * Fix Layout/ cops * Fix or disable Style/ cops * Delete weird random character * Fix Security/ cops * Fix Performance/ cops * Fix wrong namespace for a cop * Manually ignore more db/ cop violations * Delete empty test files * Fix line to long * Temporarily disable Rails/LexicallyScopedActionFilter * Fix <= logical bug (registration threshold) * remove duplicated restricted? method * change private methods to non-private methods * remove duplicate method * fix typo * change inverse_of relation * fix existing inverse_of associations * rename duplicate announcements method * undo premature change * add namespace to constant * remove unnecessary logging * remove non existing action from before filter * Rewrite new registrations query with timeframe * Allow touch_all method and replace problematic update calls See this comment: #566 (comment) * Disable Rails/HasManyOrHasOneDependent rule This is because we think it's cleaner not to have to write "dependent: nil". Also removed the respective rubocop:todo comments * Fix unwanted "," character * Get rid of weird "foo" check * remove unused restricted? methods * Replace problematic touch_all by touch * Fix wrong manual Style/ correction of 5081aaa * Fix Rails/OutputSafety * Remove duplicate dates before save see #566 (comment) --------- Co-authored-by: fosterfarrell9 <[email protected]>
- Loading branch information
1 parent
bbfde1d
commit 239faac
Showing
493 changed files
with
5,572 additions
and
5,697 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require_relative 'config/application' | ||
require_relative "config/application" | ||
|
||
Rails.application.load_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class MainAbility | ||
include CanCan::Ability | ||
|
||
def initialize(user) | ||
def initialize(_user) | ||
can :start, :main | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.