Commit Graph

42 Commits

Author SHA1 Message Date
dependabot[bot] a870361528
Build(deps-dev): Bump rubocop-discourse from 3.4.0 to 3.4.1 (#24375)
* Build(deps-dev): Bump rubocop-discourse from 3.4.0 to 3.4.1

Bumps [rubocop-discourse](https://github.com/discourse/rubocop-discourse) from 3.4.0 to 3.4.1.
- [Commits](https://github.com/discourse/rubocop-discourse/compare/v3.4.0...v3.4.1)

---
updated-dependencies:
- dependency-name: rubocop-discourse
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove the setting

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2023-11-14 22:56:30 +01:00
Daniel Waterworth e845138bc1
FIX: Updating presence status in readonly mode should fail gracefully (#24333) 2023-11-10 14:27:43 -06:00
Loïc Guitaut f7c57fbc19 DEV: Enable `unless` cops
We discussed the use of `unless` internally and decided to enforce
available rules from rubocop to restrict its most problematic uses.
2023-02-21 10:30:48 +01:00
David Taylor 93e2dad656
DEV: Introduce syntax_tree code formatter (#19775)
This commit introduces the necessary gems and config, but adds all our ruby code directories to the `--ignore-files` list.

Future commits will apply syntax_tree to parts of the codebase, removing the ignore patterns as we go
2023-01-07 11:11:08 +00:00
Guo Xiang Tan 1b57276673
Revert "Bump rubocop-discourse to 2.3.0."
This reverts commit a3ed7c9279.
2020-07-24 13:18:49 +08:00
Guo Xiang Tan a3ed7c9279
Bump rubocop-discourse to 2.3.0. 2020-07-24 12:49:27 +08:00
Guo Xiang Tan 86b43c5329
DEV: Remove rubocop_todo which doesn't seem to work with plugins. 2020-06-17 15:47:44 +08:00
Guo Xiang Tan 28f6c59612
DEV: Load rubocop_todo after default config. 2020-06-17 15:31:26 +08:00
Guo Xiang Tan f096181653
Upgrade rubocop and generate rubocop todo. 2020-06-17 14:50:34 +08:00
Jarek Radosz 666823d4b7 Revert "Revert "DEV: Move rubocop config to rubocop-discourse (#9616)""
This reverts commit 2d31a14789.

Should be good now - all the plugins are using the updated rubocop config.
2020-05-06 18:41:15 +02:00
Jarek Radosz 2d31a14789 Revert "DEV: Move rubocop config to rubocop-discourse (#9616)"
This reverts commit e23f1a9071.

Reverting as this currently breaks our plugin linting job in GithHub Action and Jenkins. Will re-revert after all the plugins get the latest rubocop config and/or a (potential) rubocop issue is fixed.
2020-05-06 17:22:25 +02:00
Jarek Radosz e23f1a9071
DEV: Move rubocop config to rubocop-discourse (#9616) 2020-05-06 15:03:06 +02:00
Blake Erickson a93ef2926d
DEV: Add rswag to aid in api documention (#9546)
Adding in rswag will allow us to write spec files to document and test
our api.
2020-04-27 16:40:07 -06:00
Robin Ward 6f391b9387 Upgrade rubocop 2020-04-17 11:16:14 -04:00
Jarek Radosz 7ff889574d
DEV: Add rubocop-rspec (#9288)
This adds rubocop-rspec, and enables some cops that were either already passing or are passing now, after fixing them in this commit.

Some new cops are disabled for now, with annotation: "TODO" or "To be decided". Those either need to be discussed first, or require manual changes, or the number of found and fixed offenses is too large to bundle them up in a single PR.

Includes:

* DEV: Update rubocop's `TargetRubyVersion` to 2.6
* DEV: Enable RSpec/VoidExpect
* DEV: Enable RSpec/SharedContext
* DEV: Enable RSpec/EmptyExampleGroup (Removed an obsolete empty spec file)
* DEV: Enable RSpec/ItBehavesLike
* DEV: Remove RSpec/ScatteredLet (It's too strict, as it doesn't recognize fab! as a let-like)
* DEV: Remove RSpec/MultipleExpectations
2020-03-27 17:35:40 +01:00
Jarek Radosz d21d80198c
DEV: Update rubocop-discourse (#9270)
Includes:
* DEV: Use `eq_time` matcher
2020-03-26 16:32:41 +01:00
Robin Ward 812119f673 This rule was removed from Rubocop due to different behavior in Ruby 3.
See: https://github.com/rubocop-hq/rubocop/issues/7641
2020-02-19 13:44:20 -05:00
Martin Brennan ce03092e61 Fix DiscourseCops/NoURIEscapeEncode errors and re-enable 2019-12-12 14:54:26 +10:00
Martin Brennan 44e0c9e0b4 Temporarily disable DiscourseCops/NoURIEscapeEncode for plugins 2019-12-12 14:40:13 +10:00
Martin Brennan 9c1e0b8bd2 bump rubocop-discourse to 1.0.2 for NoURIEscapeEncode cop 2019-12-12 14:30:27 +10:00
Sam Saffron 0c52537f10 DEV: update rubocop to version 0.77
We like to stay as close as possible to latest with rubocop cause the cops
get better.

This update required some code changes, specifically the default is to avoid
explicit returns where implicit is done

Also this renames a few rules
2019-12-10 11:48:39 +11:00
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