Skip to content

Commit 2b03cac

Browse files
authored
Merge pull request #57 from koic/add_some_documents
Add some documents
2 parents 86a09ab + 095fd6e commit 2b03cac

File tree

4 files changed

+110
-3
lines changed

4 files changed

+110
-3
lines changed

README.md

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,73 @@
1-
[![CircleCI Status](https://circleci.com/gh/rubocop-hq/rubocop-rails.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop-rails)
2-
31
# RuboCop Rails
42

5-
A RuboCop extension focused on enforcing Rails best practices and coding conventions.
3+
[![CircleCI](https://circleci.com/gh/rubocop-hq/rubocop-rails.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop-rails)
4+
5+
A [RuboCop](https://github.com/rubocop-hq/rubocop) extension focused on enforcing Rails best practices and coding conventions.
6+
7+
## Installation
8+
9+
Just install the `rubocop-rails` gem
10+
11+
```sh
12+
gem install rubocop-rails
13+
```
14+
15+
or if you use bundler put this in your `Gemfile`
16+
17+
```ruby
18+
gem 'rubocop-rails'
19+
```
20+
21+
## Usage
22+
23+
You need to tell RuboCop to load the Rails extension. There are three
24+
ways to do this:
25+
26+
### RuboCop configuration file
27+
28+
Put this into your `.rubocop.yml`.
29+
30+
```yaml
31+
require: rubocop-rails
32+
```
33+
34+
Now you can run `rubocop` and it will automatically load the RuboCop Rails
35+
cops together with the standard cops.
36+
37+
### Command line
38+
39+
```sh
40+
rubocop --require rubocop-rails
41+
```
42+
43+
### Rake task
44+
45+
```ruby
46+
RuboCop::RakeTask.new do |task|
47+
task.requires << 'rubocop-rails'
48+
end
49+
```
50+
51+
## The Cops
52+
53+
All cops are located under
54+
[`lib/rubocop/cop/rails`](lib/rubocop/cop/rails), and contain
55+
examples/documentation.
56+
57+
In your `.rubocop.yml`, you may treat the Rails cops just like any other
58+
cop. For example:
59+
60+
```yaml
61+
Rails/FindBy:
62+
Exclude:
63+
- lib/example.rb
64+
```
65+
66+
## Contributing
67+
68+
Checkout the [contribution guidelines](CONTRIBUTING.md).
69+
70+
## License
71+
72+
`rubocop-rails` is MIT licensed. [See the accompanying file](LICENSE.txt) for
73+
the full text.

manual/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A [RuboCop](https://github.com/rubocop-hq/rubocop) extension focused on enforcing Rails best practices and coding conventions.

manual/installation.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Just install the `rubocop-rails` gem
2+
3+
```sh
4+
gem install rubocop-rails
5+
```
6+
7+
or if you use bundler put this in your `Gemfile`
8+
9+
```ruby
10+
gem 'rubocop-rails'
11+
```

manual/usage.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
You need to tell RuboCop to load the Rails extension. There are three
2+
ways to do this:
3+
4+
### RuboCop configuration file
5+
6+
Put this into your `.rubocop.yml`.
7+
8+
```yaml
9+
require: rubocop-rails
10+
```
11+
12+
Now you can run `rubocop` and it will automatically load the RuboCop Rails
13+
cops together with the standard cops.
14+
15+
### Command line
16+
17+
```sh
18+
rubocop --require rubocop-rails
19+
```
20+
21+
### Rake task
22+
23+
```ruby
24+
RuboCop::RakeTask.new do |task|
25+
task.requires << 'rubocop-rails'
26+
end
27+
```

0 commit comments

Comments
 (0)