aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman+no-recruiters@gmail.com>2018-08-19 14:44:17 -0700
committerGitHub <noreply@github.com>2018-08-19 14:44:17 -0700
commit2247077b0bed3423c8b1a9529d2cb89482f0019c (patch)
tree7a40fc7949ac714cb98dc5a002d4db5bbbdf7345 /guides
parent44007c07098a3c633180881cae9285da4622e63f (diff)
parentcdabcc2bd530af4184c2592619ea3fe0ddb2d9af (diff)
downloadrails-2247077b0bed3423c8b1a9529d2cb89482f0019c.tar.gz
rails-2247077b0bed3423c8b1a9529d2cb89482f0019c.tar.bz2
rails-2247077b0bed3423c8b1a9529d2cb89482f0019c.zip
Merge pull request #33621 from sikachu/sikachu-guide-rubocop
Update guide to mention code linters available
Diffstat (limited to 'guides')
-rw-r--r--guides/source/contributing_to_ruby_on_rails.md15
1 files changed, 13 insertions, 2 deletions
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 3147b00f3b..b5e40aa40f 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -239,7 +239,6 @@ Now get busy and add/edit code. You're on your branch now, so you can write what
* Include tests that fail without your code, and pass with it.
* Update the (surrounding) documentation, examples elsewhere, and the guides: whatever is affected by your contribution.
-
TIP: Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of Rails will generally not be accepted (read more about [our rationales behind this decision](https://github.com/rails/rails/pull/13771#issuecomment-32746700)).
#### Follow the Coding Conventions
@@ -254,12 +253,24 @@ Rails follows a simple set of coding style conventions:
* Prefer class << self over self.method for class methods.
* Use `my_method(my_arg)` not `my_method( my_arg )` or `my_method my_arg`.
* Use `a = b` and not `a=b`.
-* Use assert_not methods instead of refute.
+* Use assert\_not methods instead of refute.
* Prefer `method { do_stuff }` instead of `method{do_stuff}` for single-line blocks.
* Follow the conventions in the source you see used already.
The above are guidelines - please use your best judgment in using them.
+Additionally, we have [RuboCop](https://www.rubocop.org/) rules defined to codify some of our coding conventions. You can run RuboCop locally against the file that you have modified before submitting a pull request:
+
+```bash
+$ rubocop actionpack/lib/action_controller/metal/strong_parameters.rb
+Inspecting 1 file
+.
+
+1 file inspected, no offenses detected
+```
+
+For `rails-ujs` CoffeeScript and JavaScript files, you can run `npm run lint` in `actionview` folder.
+
### Benchmark Your Code
For changes that might have an impact on performance, please benchmark your