-
Notifications
You must be signed in to change notification settings - Fork 759
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Allen Kerr
committed
Mar 1, 2018
1 parent
8d8fb05
commit dfdc84b
Showing
69 changed files
with
5,986 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
language: ruby | |||
cache: | |||
bundler: true | |||
sudo: false | |||
rvm: | |||
- 2.1.8 | |||
- 2.2 | |||
- 2.3 | |||
install: | |||
- cd rubocop-airbnb | |||
- bundle install | |||
script: | |||
- bundle exec rspec | |||
- bundle exec rubocop --config .rubocop.yml | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
MIT License | |||
|
|||
Copyright (c) 2012 Airbnb | |||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |||
|
|||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,40 @@ | |||
# Ignore bundler config | |||
/.bundle | |||
bundle | |||
vendor/bundle/ | |||
vendor/rubocop/ | |||
|
|||
# Ignore the default SQLite database. | |||
/db/*.sqlite3 | |||
|
|||
# Ignore all logfiles and tempfiles. | |||
/log/*.log | |||
/tmp | |||
|
|||
# Ignore development bundled assets | |||
.sass-cache/ | |||
public/assets/ | |||
|
|||
/config/database.yml | |||
/config/configatron/secure.yml | |||
/config/initializers/aws_credentials.rb | |||
|
|||
.DS_Store | |||
.rvmrc | |||
.ruby-version | |||
.*.swp | |||
.\#* | |||
\#*# | |||
node_modules | |||
npm-debug.log | |||
|
|||
rubocop-airbnb*.gem | |||
|
|||
# IDEs | |||
.idea | |||
|
|||
# Temp files | |||
*.swo | |||
.byebug_history | |||
|
|||
Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
--color | |||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,12 @@ | |||
inherit_from: | |||
- .rubocop_airbnb.yml | |||
- ./config/default.yml | |||
|
|||
AllCops: | |||
CacheRootDirectory: tmp/rubocop | |||
Exclude: | |||
- 'vendor/**/*' | |||
- 'node_modules/**/*' | |||
|
|||
Rails: | |||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
# Default rules. These will be overridden by modified rules in | |||
# `.rubocop_todo.yml`. Eventually, both this and `.rubocop_todo.yml` should be | |||
# merged and moved "upstairs" into `.rubocop.yml`, but due to RuboCop's | |||
# inheritance model we'll be doing this for now. | |||
|
|||
# For the rubocop-airbnb gem specifically, we want to load the local configuration. | |||
require: | |||
- ./lib/rubocop-airbnb.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
# 1.0.0 | |||
* First public release of rubocop-airbnb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
source 'https://rubygems.org' | |||
|
|||
gemspec | |||
|
|||
group :test do | |||
gem 'pry' | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
MIT License | |||
|
|||
Copyright (c) 2012 Airbnb | |||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |||
|
|||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
#### Summary | |||
|
|||
<!--- required ---> | |||
|
|||
#### Test Plan: what steps did you take to test this? | |||
|
|||
<!--- required ---> | |||
|
|||
#### Reviewers | |||
|
|||
<!--- required ---> | |||
|
|||
#### JIRA Task | |||
|
|||
<!--- optional ---> | |||
|
|||
## Screenshots/GIF (if visual change) | |||
|
|||
<!--- optional ---> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,67 @@ | |||
# RuboCop Airbnb | |||
|
|||
Airbnb specific analysis for [RuboCop](https://github.com/bbatsov/rubocop). | |||
|
|||
It contains Airbnb's internally used configuration for | |||
[RuboCop](https://github.com/bbatsov/rubocop) and | |||
[RuboCop RSpec](https://github.com/backus/rubocop-rspec). It also includes custom | |||
|
|||
## Installation | |||
|
|||
Just put this in your `Gemfile` it depends on the appropriate version of rubocop and rubocop-rspec. | |||
|
|||
``` | |||
gem 'rubocop-airbnb' | |||
``` | |||
|
|||
## Usage | |||
|
|||
You need to tell RuboCop to load the Airbnb extension. There are three | |||
ways to do this: | |||
|
|||
### RuboCop configuration file | |||
First Create a new file `.rubocop_airbnb.yml` in the same directory as your `.rubocop.yml` | |||
this file should contain | |||
``` | |||
require: | |||
- rubocop-airbnb | |||
``` | |||
|
|||
Next add the following to `.rubocop.yml` | |||
or add before `.rubocop_todo.yml` in your existin `inherit_from` | |||
|
|||
``` | |||
inherit_from: | |||
- .rubocop_airbnb.yml | |||
- .rubocop_todo.yml | |||
``` | |||
|
|||
You need to inherit `.rubocop_airbnb.yml` from another file becuase Rubocop order of operations. | |||
It runs `inherit_from` before `require` commands. If the configuration is not in a separate file | |||
you could potentially experience a bunch of warnings from `.rubocop_todo.yml` for non-existant | |||
`Airbnb` rules. | |||
|
|||
Now you can run `rubocop` and it will automatically load the RuboCop Airbnb | |||
cops together with the standard cops. | |||
|
|||
### Command line | |||
|
|||
```bash | |||
rubocop --require rubocop-airbnb | |||
``` | |||
|
|||
## The Cops | |||
|
|||
All cops are located under | |||
[`lib/rubocop/cop/airbnb`](lib/rubocop/cop/airbnb), and contain | |||
examples/documentation. | |||
|
|||
In your `.rubocop.yml`, you may treat the Airbnb cops just like any other | |||
cop. For example: | |||
|
|||
```yaml | |||
Airbnb/PhraseBundleKeys: | |||
Exclude: | |||
- spec/my_poorly_named_spec_file.rb | |||
``` | |||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
Rails: | |||
Enabled: true | |||
|
|||
############## | |||
# Global rules | |||
|
|||
AllCops: | |||
Exclude: | |||
- '.chefrepo/**/*' | |||
- '.vagrant/**/*' | |||
- '.git/**/*' | |||
- 'node_modules/**/*' | |||
- 'tungsten/**/*' | |||
- 'tungsten-support/**/*' | |||
- 'vendor/**/*' | |||
- Vagrantfile | |||
- Guardfile | |||
RSpec: | |||
Patterns: | |||
- _spec.rb | |||
- "(?:^|/)spec/" | |||
RSpec/FactoryBot: | |||
Patterns: | |||
- spec/factories/**/*.rb | |||
- features/support/factories/**/*.rb | |||
|
|||
inherit_from: | |||
- './rubocop-airbnb.yml' | |||
- './rubocop-bundler.yml' | |||
- './rubocop-gemspec.yml' | |||
- './rubocop-layout.yml' | |||
- './rubocop-lint.yml' | |||
- './rubocop-metrics.yml' | |||
- './rubocop-naming.yml' | |||
- './rubocop-performance.yml' | |||
- './rubocop-rails.yml' | |||
- './rubocop-rspec.yml' | |||
- './rubocop-security.yml' | |||
- './rubocop-style.yml' |
Oops, something went wrong.