Skip to content

Commit 2ab6fce

Browse files
authored
Merge branch 'master' into francisfuzz/styleguide-syntax-update
2 parents 4b7844a + 2eddce7 commit 2ab6fce

18 files changed

+1901
-255
lines changed

.rubocop.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
inherit_from: ./config/default.yml
1+
inherit_from:
2+
- ./config/default.yml
23

34
Naming/FileName:
45
Enabled: true
56
Exclude:
67
- "rubocop-github.gemspec"
8+
- "lib/rubocop-github.rb"
9+
- "lib/rubocop-github-rails.rb"

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# rubocop-github
2+
3+
## Unreleased
4+
5+
- Unset `DisabledByDefault: true` in `config/default.yml`. Prevents confusing behaviour where users of the gem didn't realise that RuboCop's default cops weren't being applied (including potentially custom cops in their projects). We've explicitly set `Enabled: false` for all the cops that were previously default disabled. This has the effect that consumers of this gem won't be surprised by new linting violations when they use this new version in their projects. (https://github.com/github/rubocop-github/pull/119)

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ GEM
3131
crass (~> 1.0.2)
3232
nokogiri (>= 1.5.9)
3333
minitest (5.16.1)
34+
nokogiri (1.13.6-arm64-darwin)
35+
racc (~> 1.4)
3436
nokogiri (1.13.6-x86_64-darwin)
3537
racc (~> 1.4)
3638
parallel (1.22.1)
@@ -71,6 +73,7 @@ GEM
7173
unicode-display_width (2.2.0)
7274

7375
PLATFORMS
76+
arm64-darwin-21
7477
x86_64-darwin-19
7578
x86_64-darwin-20
7679

README.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,37 @@ This repository provides recommended RuboCop configuration and additional Cops f
44

55
## Usage
66

7-
**Gemfile**
7+
Add `rubocop-github` to your Gemfile, along with its dependencies:
88

9-
``` ruby
10-
gem "rubocop-github"
11-
gem "rubocop-performance", require: false
12-
gem "rubocop-rails", require: false
13-
```
9+
```ruby
10+
gem "rubocop-github", require: false
11+
gem "rubocop-performance", require: false
12+
gem "rubocop-rails", require: false
13+
```
1414

15-
**.rubocop.yml**
15+
Inherit all of the stylistic rules and cops through an inheritance declaration in your `.rubocop.yml`:
1616

17-
``` yaml
18-
inherit_gem:
19-
rubocop-github:
20-
- config/default.yml
21-
- config/rails.yml
22-
```
17+
```yaml
18+
# .rubocop.yml
19+
inherit_from:
20+
rubocop-github:
21+
- config/default.yml # generic Ruby rules and cops
22+
- config/rails.yml # Rails-specific rules and cops
23+
```
24+
25+
Alternatively, only require the additional custom cops in your `.rubocop.yml` without inheriting/enabling the other stylistic rules:
26+
27+
```yaml
28+
# .rubocop.yml
29+
require:
30+
- rubocop-github # generic Ruby cops only
31+
- rubocop-github-rails # Rails-specific cops only
32+
```
2333

2434
💭 Looking for `config/accessibility.yml` and the `GitHub/Accessibility` configs? They have been moved to [a new gem](https://github.com/github/rubocop-rails-accessibility).
2535

36+
For more granular control over which of RuboCop's rules are enabled for your project, both from this gem and your own configs, consider using the `DisabledByDefault: true` option under `AllCops` in your project's `.rubocop.yml` file. This will disable all cops by default, and you can then explicitly enable the ones you want by setting `Enabled: true`. See [the RuboCop docs](https://docs.rubocop.org/rubocop/configuration.html#enabled) for more information.
37+
2638
### Legacy usage
2739

2840
If you are using a rubocop version < 1.0.0, you can use rubocop-github version
@@ -37,4 +49,4 @@ bundle exec rake test
3749

3850
## The Cops
3951

40-
All cops are located under [`lib/rubocop/cop/github`](lib/rubocop/cop/github) and [`lib/rubocop/cop/github/accessibility`](lib/rubocop/cop/github/accessibility), and contain examples/documentation.
52+
All cops are located under [`lib/rubocop/cop/github`](lib/rubocop/cop/github).

STYLEGUIDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,8 @@ hsh = {
418418
[Keyword arguments](http://magazine.rubyist.net/?Ruby200SpecialEn-kwarg) are recommended but not required when a method's arguments may otherwise be opaque or non-obvious when called. Additionally, prefer them over the old "Hash as pseudo-named args" style from pre-2.0 ruby.
419419
<a name="keyword-arguments"></a><sup>[[link](#keyword-arguments)]</sup>
420420
421-
``` ruby
422-
423421
So instead of this:
422+
424423
``` ruby
425424
def remove_member(user, skip_membership_check=false)
426425
# ...
@@ -430,7 +429,8 @@ end
430429
remove_member(user, true)
431430
```
432431
433-
Do this, which is much clearer.
432+
Do this, which is much clearer:
433+
434434
``` ruby
435435
def remove_member(user, skip_membership_check: false)
436436
# ...

0 commit comments

Comments
 (0)