Commit Graph

100 Commits

Author SHA1 Message Date
Cody Cutrer fdf5a03c4d rubocop: inherit config from rubocop-inst
and remove now-duplicated config

also fix a few offenses that snuck in due to code review race conditions

as part of this, Rubocop was loading the lockfile, so our "clever" rubocop
binstub had to be adjusted to use a lockfile. this allows us to commit the
lockfile, which I then also updated the sync_lockfiles script to handle
this one as well

flag = none
test plan: N/A

Change-Id: I20ee2672c5219a40e90bc1138f8900a8d2ce08ee
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/317373
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-05-02 17:24:47 +00:00
Cody Cutrer 502aa068da rubocop: Layout/Multiline*LineBreaks
[skip-stages=Flakey]

Change-Id: I24912809267088bc19a4082c49bc5f78ca7b76bb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/317302
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-05-01 19:31:42 +00:00
Cody Cutrer e935048dc4 add rubocop-graphql
nothing is enforced yet, and some obviously noisy cops have been silenced

Change-Id: I12bddd724af042e30d6a8b0f5465c73036cbfa8c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/316045
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
2023-04-17 15:37:46 +00:00
Cody Cutrer fc0ce801b6 linters: exclude vendor
in case you have some override gems installed, don't worry about them

Change-Id: I9f084621322eb834fc1774804bad6e433861625b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/316059
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-04-17 15:32:43 +00:00
Cody Cutrer 7144f0c66a bump rubocop-rails
I was able to replace one of our custom cops with a built in one
(just had to make it ignore older migrations).

Then I had to manually fix a couple of (important!) offenses

Change-Id: I000310bb6b065034384ba3a33ef5e37e22b9be5a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315855
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-04-14 14:07:34 +00:00
Cody Cutrer fe434c28d9 bump rubocop-rspec
and manually fix a couple offenses

Change-Id: I8acefa460523b330cf62395c357ca5f0ae4e3dd7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315828
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
2023-04-12 21:21:40 +00:00
Cody Cutrer 4d96f5ed1e rubocop: update to 1.49
includes some minor hash layout fixes that were incompatible with prior rubocop

[skip-stages=Flakey]

Change-Id: I75e903292daa70c84b03600b97fac49ca1155004
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315786
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-04-12 19:27:56 +00:00
Cody Cutrer cbf9114d27 fix duplicate rubocop cop configurations
Change-Id: I64bf130a824279febd363d9a6ffa6ee62bcb24c1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/314725
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-03-30 18:18:35 +00:00
Cody Cutrer 09d77cbbc2 fix zh-Hant dynamic translations
Change-Id: Ibd2ce51b8b000f3f73c3e08c0a62ddd32c849066
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/314612
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-03-29 21:49:59 +00:00
Aaron Ogata 7883fce765 replace default_scope override with rubocop linter
refs AC-1

Overriding default_scope here causes statement caching to never be used, so replace it with a rubocop linter.

Change-Id: Ifbe84a87ab19fc2f6032ed982fcbe8019e765dd1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/305925
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2022-11-22 19:42:05 +00:00
Jeremy Stanley 7c58a814ed rubocop: disable Style/HashLikeCase
because this isn't even pointless pedantry. it's just pointless

Change-Id: I7b8cd656a4adb8da3b5e30a59593297f91d9aa9a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286846
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-03-15 16:59:27 +00:00
Aaron Ogata 77c5d89cea rubocop: disable Style/CaseLikeIf
seems overly pedantic

Change-Id: Ibe3ccd76978650842dd09fd1232df5673e292d58
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287118
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-03-15 15:22:19 +00:00
Jeremy Stanley 2050e5a165 rubocop: reconfigure Style/SoleNestedConditional
to allow the modifier form, e.g. this is okay

  if condition_a || condition_b
    do_something unless condition_c && condition_d
  end

and is in fact preferable to

  if (condition_a || condition_b) && !(condition_c && condition_d)
    do_something
  end

which is what rubocop would turn it into otherwise

Change-Id: I1b917e3ea5149379f22e70294d263b713b3b9b35
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282475
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-10 23:36:08 +00:00
Jeremy Stanley c682e9946b disable Performance/CaseCmp
because it gives bad advice. `str.casecmp("foo").zero?` is not only
less clear than `str.downcase == "foo"`, but it is not Unicode-aware

(ironically, `str.casecmp?("foo")`, with the question mark, _is_
Unicode-aware)

Change-Id: I1abd17f4a09b205073998c5cf9e89cb4bd85ad6b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282294
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-06 22:44:23 +00:00
Jeremy Stanley af8d0fe079 lint use of add_foreign_key
test plan:
 - create a migration (locally) and add it to a commit
   (no need to actually commit, push, or even run the migration)
   that adds a foreign key to an existing table, e.g.

   add_foreign_key :users, :eportfolios

 - run script/rlint, and it should complain that you should
   use a non-transactional migration and add `delay_validation: true`
   to the arguments
 - do those things, run script/rlint again, and it should not
   complain
 - add a foreign key to a table created in the same migration,
   e.g.

   create_table :foo do |t|
   end
   add_foreign_key :foo, :bar

 - run script/rlint again, and it shouldn't complain

flag=none
closes DE-940

Change-Id: I3f235cbf1ff4011e20d74bdaa8953b857c7e330a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280514
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-12-13 20:04:44 +00:00
Jeremy Stanley 73f2bc8be6 allow Migration cops to set their own severity
since planned cops may provide different severity levels
depending on circumstances

refs DE-942

flag = none

Change-Id: I7501c13ea350241c47debceb7440cc8ce3d43925
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280532
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-12-08 20:10:41 +00:00
Cody Cutrer a2a70c0b81 rubocop: disable Lint/RedundantCopDisableDirective temporarily
it's removing disable directives that need to be there

Change-Id: Iecff7d5559742af834946a6d9223fd24634baa90
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279693
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-29 16:33:46 +00:00
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer e73cf9ddf4 RuboCop: Style/HashSyntax
[skip-stages=Flakey]

auto-corrected

Change-Id: I9371a61046aee6b148f89dd434114a8ba2b1188c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279533
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:02:35 +00:00
Cody Cutrer eaca556b81 RuboCop: Style/NumericLiterals
[skip-stages=Flakey]

auto-corrected

Change-Id: I88363d87d5a70be941aa81b4ffe5306ce7506b98
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279207
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:31:34 +00:00
Cody Cutrer 8491e88508 RuboCop: RSpec/ItBehavesLike
[skip-stages=Flakey]

auto-corrected

Change-Id: I56e3012374105679ccbb9947a043542330424b4e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279506
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:31:06 +00:00
Cody Cutrer 8c37fa9ac3 RuboCop: RSpec/LetBeforeExamples, RSpec/LeadingSubject
[skip-stages=Flakey]

auto-corrected

Change-Id: Ia794667280669652b7da12f8e351f25bed25e32b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279460
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:30:52 +00:00
Cody Cutrer 1f40a6f50f RuboCop: RSpec/Rails/HttpStatus
[skip-stages=Flakey]

auto-corrected

Change-Id: Ia1b3aabd3a12c3fe1fba7ccaf53e730791192626
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279436
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:30:38 +00:00
Cody Cutrer b955e57956 RuboCop: RSpec/ImplicitSubject
[skip-stages=Flakey]

auto-corrected

Change-Id: I07c2cf064ab446b8ac020af3ad9e57c0d4d9372b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279434
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:30:23 +00:00
Cody Cutrer 13949b825b RuboCop: RSpec/RepeatedExample, RSpec/RepeatedExampleGroupBody
[skip-stages=Flakey]

manual. obvious duplicates were removed. others I looked for context on what
the original copy/paste error was.

Change-Id: I6d009c480eacf9233ed0c8253ce715bc2f74e8bf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279432
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:30:10 +00:00
Cody Cutrer 8ee4c4777a RuboCop: RSpec/RepeatedExampleGroupDescription
[skip-stages=Flakey]

manual, mostly by fixing copy/paste name problems,
combining groups that didn't need separating, or creating
new groups to contain contiguous top level groups that can't
be combined due to having different setup

Change-Id: I5b21664eabd8c3a62e22c09a28ba8bf519371aa5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279428
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:29:56 +00:00
Cody Cutrer f419d77cde rubocop: add missing non-error cops
Change-Id: I7691d98cb0f1a2d0452990c8e93968e950406c51
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279427
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:29:39 +00:00
Cody Cutrer ee33b6b896 RuboCop: RSpec/RepeatedIncludeExample
manual

Change-Id: Ibc02e7d29fb346b9245a73fde2114191f4ed1fcb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279422
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:32:01 +00:00
Cody Cutrer c1bfffa8df RuboCop: RSpec/VoidExpect
manual

Change-Id: Ia1e83f9e901a27aaa02135a82cfe0ad5a3e3bf7e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279421
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:31:50 +00:00
Cody Cutrer e910bf28f7 RuboCop: Style/YodaCondition
auto-corrected

Change-Id: Ic9788248ec1ea08928cea603ab1c800f2f3064e2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279419
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:31:39 +00:00
Cody Cutrer 379d5d7611 rubocop: default to error severity
means we can remove a whole bunch of specific cop configurations that
now inherit the proper settings. cops that still have violations need
to be explicitly named to make them not error. this means that the
list of remaining cops is explicitly in our config now. also combined
the don't-auto-correct lists with the not-yet-fixed lists, so that
it's only a "permanent" section and a "todo" section

the final computed configuration is unchanged by this commit, with one
exception - Bundler/OrderedGems was moved to the Gemfile.d/.rubocop.yml
override, and some of the internal gems violated that so their
gemfiles have been autocorrected

Change-Id: I100884a96dbe9eb9d4bfc0692663c271daa9de16
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279413
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:31:26 +00:00
Cody Cutrer e0600a99a4 rubocop: remove .rubocop.common.yml
we're far enough along that the generated disablings are no longer useful

Change-Id: Iec341384f7a5f6eeb42bad4ae1ea12f433d270a4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279397
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:31:12 +00:00
Cody Cutrer b68d11de70 rubocop: go back to a single .rubocop.yml
it was just too confusing on which one an editor is using, double comments
in jenkins, etc.

this is accomplished by several things:
 * required cops are just marked as severe, instead of using a separate
   config for them, and failing if anything shows up from that config
 * get rid of all the logic to only include certain directories for
   certain cops. turns out it's not _that_ ominous to correct errors
   across the entire repository before marking a cop as required.
 * but still auto-generate config to turn _off_ autocorrect for
   non-severe cops. this is important because auto-correct must run
   for entire files, and we don't want it auto-correcting optional
   things that you didn't touch.
 * update gergich to get more details from the parsed comments.
   this plus the prior point means we _don't_ have to have heavy mode when
   in autocorrecting, but we still display out-of-context lines that were
   autocorrected

this also makes it so we can use per-dir .rubocop.yml files again, so
take some of the exceptions out of the root and put them in their own
directory

Change-Id: Ie936d1a9920b68910acd250ba817c7b4a670b958
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274394
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-27 17:21:02 +00:00
Cody Cutrer 9d7a41f5ea RuboCop: tweak common config
document why each cop is disabled, disable a few more globally, and document
the intentions for each currently disabled cops in the optional config

Change-Id: I7abaabd76142a61e1922f55da0c8abb6a665ec05
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274265
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-24 02:15:54 +00:00
Cody Cutrer 475cec61e5 RuboCop: RSpec/ExampleWording gems
[skip-stages=Flakey]

Change-Id: I7bd5d93d0ec4a95971f7ce8fbff8e76b5bfea5a2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274249
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-24 02:14:45 +00:00
Cody Cutrer e9d63396ff rubocop: split configuration
* remove spurious .rubocop.yml override files
 * split the configuration into an enforced and optional
 * run both configurations in jenkins (may result in some duplicate
   comments at different levels)
 * auto-correct the enforced configuration in the pre-commit hook
 * fix comments for Gemfile.d and the root dir; enforced configuration
   is only applied to that directory for now

Change-Id: I8da21073d74e19138b1b580d66c7aae6465348d4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/273898
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-21 16:02:22 +00:00
Kyle Rosenbaum 5340b96ad0 bump rubocop TargetRubyVersion to match current version in use
Change-Id: I053a97987999230eb9c735383896782721de67ca
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/272934
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
2021-09-03 21:40:27 +00:00
Cody Cutrer 2ef11140c2 remove ModelBehavior cop
it's disabled anyway, and because the cop requires active_record itself,
it adds 0.5s to the boot time of rubocop

Change-Id: Ie22944afef9df45fe08ea0e13857a4703d1c53f8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271959
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-08-25 21:21:54 +00:00
Cody Cutrer 595219274c update rubocop
and rubocop-rails was split out to a dedicated gem

Change-Id: I12b45540a400aab0d57db303457103516ab92df7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271931
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-08-24 18:14:03 +00:00
Cody Cutrer 9d0cee678f require latest IRB
for multi-line paste fix. which allows us to relax the DotPosition
rubocop rule

Change-Id: I33df7de1907c2397bba8c9581d1f65b7c90c4b93
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262191
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2021-04-05 16:03:14 +00:00
Cody Cutrer 88243a9219 just disable rubocop metrics
they make our rubocop SnR waaaay too bad right now that we ignore everything

Change-Id: Ie0145be67ee5aec54692f4c463f2bd2c2ab41518
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260505
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-03-11 23:18:54 +00:00
Ethan Vizitei 6d2b297bc0 let canvas use outrigger for migration tagging
refs FOO-1644

when other engines need migrations, we have to
be able to move "tagged" migrations down to them.
Letting outrigger manage the dependency
is nice since we extracted it from canvas anyway.

TEST PLAN:
  1) nothing about migrations changes

Change-Id: I93d2683cc05584ed9bf871b61e06ba39b70a3f5d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260370
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-10 20:31:31 +00:00
Cody Cutrer 591c21f38b enforce frozen_string_literal comment
Change-Id: I5c0b7625bb22e4e285040201cddb8ab330f494bc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251306
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-28 22:08:52 +00:00
Kyle Rosenbaum 025556caf3 bump rubocop version to 0.68.0 to support ruby 2.6
this changes upgrades to the earliest version of rubocop
supporting ruby 2.6 while also choosing a version that fixes
a breaking 0.60.0 change to revert psych version change.

namespace changes were made on multiple cops to support
the new rubocop version requirements as well as the change to
move performance cops out of the rubocop gem in to
rubocop-performance.

the Layout/IndentFirstParameter cop is currently broken but a
rubocop version upgrade will fix that. the FreezeConstants cop
also required a fix to handle nil types.

refs DE-289

test plan:
- ensure rubocop runs completely

Change-Id: I0ca68f426e287b5a973b96a4ae0e975f1cbc0240
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248786
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Reviewed-by: Ryan Norton <rnorton@instructure.com>
2020-09-29 16:09:54 +00:00
Ethan Vizitei c8a78ae2ef let rubocop use current ruby
Change-Id: Iebba16cca11d7289b1a241d262694907de7210c5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247932
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-09-17 17:50:11 +00:00
gaojun ea7e9e6644 Remove duplicated config in .rubocop.yml
closes #1565

test plan: rubocop still works

Change-Id: I77752b64224e176e5a4aff6d470cd85354b05474
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/225005
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-01-30 22:41:56 +00:00
Derek Bender 1636eff98b spec: remove ExpectChange and TimesMap
some hot takes:
 - 4.times.map is more readible to Array.new(4).map and has no perf gain
   in small cases which is the overwhelming use case for specs. This
   also has no perf impact for app code since it's excluded for specs only.
 - change { AnonymousOrModerationEvent.count } is more readible than
   change(AnonymousOrModerationEvent, :count) because the former is the
   exact code you would see in your app code. This is an RSpec only cop
   so it has no impact on app code.

Change-Id: I6f70b6a9f69a3375cf6f8db27eadd810f25361ca
Reviewed-on: https://gerrit.instructure.com/162540
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Product-Review: Derek Bender <djbender@instructure.com>
QA-Review: Derek Bender <djbender@instructure.com>
2018-08-31 14:53:41 +00:00
Derek Bender 976116302e remove curly brace block warning in specs
Change-Id: I8f7978adacf41792b3ca3c1e5ea3b09c29b5403e
Reviewed-on: https://gerrit.instructure.com/159896
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Product-Review: Derek Bender <djbender@instructure.com>
QA-Review: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
2018-08-09 22:07:06 +00:00
Cody Cutrer a349102c9b rubocop: I don't care how you phrase this
use whichever feels natural

Change-Id: If69da65173c7d2a55ff50b9201a7884e8ed5ad96
Reviewed-on: https://gerrit.instructure.com/159475
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-08-02 19:30:30 +00:00
Tucker McKnight 892b0c40f9 spec: Ignore block length rule in Pact tests
We're already ignoring it in RSpec and Selenium tests. And Pact
tests inherently have a lot of lines.

Change-Id: Ia976224a03426864beb04d885011e982d4c2a60d
Reviewed-on: https://gerrit.instructure.com/156583
Reviewed-by: Michael Hargiss <mhargiss@instructure.com>
Tested-by: Jenkins
Product-Review: Tucker McKnight <tmcknight@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
2018-07-09 20:50:41 +00:00