Commit Graph

21 Commits

Author SHA1 Message Date
Joffrey JAFFEUX
0d3d2c43a0
DEV: s/\$redis/Discourse\.redis (#8431)
This commit also adds a rubocop rule to prevent global variables.
2019-12-03 10:05:53 +01:00
David Taylor
0350247130 DEV: Exclude plugin specs when running chdir cop 2019-11-18 16:00:18 +00:00
David Taylor
eaf6096890 DEV: Use rubocop-discourse gem to add custom chdir cop
Followup to b27e009655
2019-11-18 15:39:41 +00:00
Penar Musaraj
be15abcf7f DEV: Add RedundantReturn style check to Rubocop 2019-11-14 14:42:36 -05:00
David Taylor
b27e009655 DEV: Temporarily remove NoChdir cop
We inherit this rubocop config from plugins and other projects, so the `require` line does not work reliably.
2019-11-13 10:26:40 +00:00
David Taylor
9fea43e46a
DEV: Remove use of cd in the app (#8337)
`FileUtils.cd` and `Dir.chdir` cause the working directory to change for the entire process. We run sidekiq jobs, hijacked requests and deferred jobs in threads, which can make working directory changes have unintended side-effects.

- Add a rubocop rule to warn about usage of Dir.chdir and FileUtils.cd
- Added rubocop:disable for scripts used outside the app
- Refactored code using cd to use alternative methods
- Temporarily skipped the rubocop check for lib/backup_restore. This will require more complex refactoring, so I will create a separate PR for review
2019-11-13 09:57:39 +00:00
Penar Musaraj
4d1d8b40db DEV: Re-enable Rubocop checks for plugins
But exclude gems in plugins.
2019-07-30 09:09:00 -04:00
Penar Musaraj
73bce82c82 Exclude plugins from RuboCop checks
Since official plugins are now in the discourse_test image, rubocop catches issues in plugins.

This is a temporary measure.
2019-06-14 10:06:26 -04:00
Sam Saffron
30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Régis Hanol
3c9c95ac83 Update Rubocop to 0.60 2018-12-04 10:48:16 +01:00
David Taylor
9248ad1905 DEV: Enable Style/SingleLineMethods and Style/Semicolon in Rubocop (#6717) 2018-12-04 11:48:13 +08:00
Guo Xiang Tan
df2d02a7bc Revert "Enable Style/BlockDelimiters rule."
This reverts commit 3c22fb6b70.
2018-11-30 10:59:45 +08:00
Guo Xiang Tan
3c22fb6b70 Enable Style/BlockDelimiters rule. 2018-11-30 10:18:15 +08:00
Guo Xiang Tan
8dc1463ab3 Enable Lint/ShadowingOuterLocalVariable for Rubocop. 2018-09-04 10:16:42 +08:00
Sam
95968380bc correct rules 2018-03-13 18:00:22 +11:00
Gerhard Schlager
a6b0e627cd exclude public directory from RuboCop 2017-11-02 20:31:04 +01:00
Guo Xiang Tan
e0d37c1f74 Add debugger Rubocop lint. 2017-08-08 19:16:40 +09:00
Guo Xiang Tan
aab0b06cbe Rubocop should ignore schema.rb. 2017-08-08 14:29:44 +09:00
David Taylor
4b00fdbc5b Exclude bundle directory when running rubocop (#5016)
* Exclude bundle directory when running rubocop

* Include the default excludes as well
2017-08-01 12:47:09 -04:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Gerhard Schlager
781f364d86
Make RuboCop and RubyMine less annoying 2017-05-29 20:59:14 +02:00