smokeclouds-rubocop 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +49 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +10 -0
- data/README.md +43 -0
- data/config/bundler.yml +1 -0
- data/config/faker.yml +1 -0
- data/config/layout.yml +36 -0
- data/config/lint.yml +48 -0
- data/config/metrics.yml +25 -0
- data/config/naming.yml +17 -0
- data/config/others.yml +22 -0
- data/config/performance.yml +33 -0
- data/config/rails.yml +63 -0
- data/config/rspec.yml +16 -0
- data/config/security.yml +1 -0
- data/config/style.yml +102 -0
- data/config/thread-safety.yml +1 -0
- data/lib/smokeclouds/rubocop.rb +10 -0
- data/lib/smokeclouds/rubocop/version.rb +7 -0
- data/smokeclouds-rubocop.gemspec +44 -0
- metadata +166 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1f11604e8e52be0a1014fc8c8a2704e9f796a96471d400973e5a16976f22989f
|
4
|
+
data.tar.gz: a1601c73a5edc7244999e57dbd4b9c7f06afe3168c59e0dbdbb516e35188085c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4dd0b4d4cbf1c1fdaf72c002adf957adee250e5e6be6ba0ae6e708fc9f450907a3b34fee4f6267aa20b06d4656e3751edce51dbe1633ff7040b0bf72d73a0fca
|
7
|
+
data.tar.gz: 5ade58901d9b79a5ba6ed10e34e5b217eb8d81b69bfb54b9c52c903cf4ecb2a0822bbb2694b7698db911dee85ab0ebc49abcc6028a39b7f6493924b19dfbdef9
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-faker
|
3
|
+
- rubocop-performance
|
4
|
+
- rubocop-rails
|
5
|
+
- rubocop-rspec
|
6
|
+
- rubocop-thread_safety
|
7
|
+
|
8
|
+
inherit_from:
|
9
|
+
- ./config/layout.yml
|
10
|
+
- ./config/lint.yml
|
11
|
+
- ./config/metrics.yml
|
12
|
+
- ./config/naming.yml
|
13
|
+
- ./config/style.yml
|
14
|
+
- ./config/bundler.yml
|
15
|
+
- ./config/faker.yml
|
16
|
+
- ./config/performance.yml
|
17
|
+
- ./config/rails.yml
|
18
|
+
- ./config/rspec.yml
|
19
|
+
- ./config/security.yml
|
20
|
+
- ./config/thread-safety.yml
|
21
|
+
|
22
|
+
inherit_mode:
|
23
|
+
merge:
|
24
|
+
- Exclude
|
25
|
+
|
26
|
+
AllCops:
|
27
|
+
CacheRootDirectory: tmp/rubocop
|
28
|
+
NewCops: enable
|
29
|
+
SuggestExtensions: false
|
30
|
+
|
31
|
+
DisplayCopNames:
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
ExtraDetails:
|
35
|
+
Enabled: true
|
36
|
+
|
37
|
+
DisplayStyleGuide:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
Exclude:
|
41
|
+
- 'bin/**'
|
42
|
+
- 'config.ru'
|
43
|
+
- 'tmp/**/*'
|
44
|
+
- 'db/schema.rb'
|
45
|
+
- 'vendor/**/*'
|
46
|
+
- 'node_modules/**/*'
|
47
|
+
- 'scraps/**/*'
|
48
|
+
- 'app/javascript/**/*'
|
49
|
+
- 'app/packs/**/*'
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at james@imaj.es. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Smokeclouds::Rubocop
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/smokeclouds/rubocop`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'smokeclouds-rubocop'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install smokeclouds-rubocop
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/imajes/smokeclouds-rubocop. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/imajes/smokeclouds-rubocop/blob/master/CODE_OF_CONDUCT.md).
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Smokeclouds::Rubocop project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/imajes/smokeclouds-rubocop/blob/master/CODE_OF_CONDUCT.md).
|
data/config/bundler.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Cops regarding rubocop-bundler can be found here
|
data/config/faker.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Cops regarding rubocop-faker can be found here
|
data/config/layout.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Layout Cop configurations
|
2
|
+
|
3
|
+
Layout/HashAlignment:
|
4
|
+
Enabled: true
|
5
|
+
EnforcedColonStyle: table
|
6
|
+
EnforcedHashRocketStyle: table
|
7
|
+
|
8
|
+
Layout/ExtraSpacing:
|
9
|
+
Enabled: true
|
10
|
+
AllowForAlignment: true
|
11
|
+
|
12
|
+
# Line length is an ongoing debate. Working towards 80 / 100 seems like a good
|
13
|
+
# idea overall but there is no priority on this.
|
14
|
+
Layout/LineLength:
|
15
|
+
Max: 182
|
16
|
+
|
17
|
+
# ensures method call operators (e.g. foo.bar or foo&.bar) are properly connected w/o space
|
18
|
+
# https://docs.rubocop.org/en/latest/cops_layout/#layoutspacearoundmethodcalloperator
|
19
|
+
Layout/SpaceAroundMethodCallOperator:
|
20
|
+
Enabled: true
|
21
|
+
|
22
|
+
# spacing options
|
23
|
+
Layout/EmptyLinesAroundModuleBody:
|
24
|
+
Enabled: true
|
25
|
+
EnforcedStyle: empty_lines_except_namespace
|
26
|
+
|
27
|
+
Layout/EmptyLinesAroundClassBody:
|
28
|
+
Enabled: true
|
29
|
+
EnforcedStyle: empty_lines_except_namespace
|
30
|
+
|
31
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
# https://docs.rubocop.org/rubocop/cops_layout.html#layoutparameteralignment
|
35
|
+
Layout/ParameterAlignment:
|
36
|
+
EnforcedStyle: with_fixed_indentation # with_first_parameter (default)
|
data/config/lint.yml
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# cop configuration for Lints should be here
|
2
|
+
|
3
|
+
# ensures we're not raising plain Exceptions.
|
4
|
+
# https://docs.rubocop.org/en/latest/cops_lint/#lintraiseexception
|
5
|
+
Lint/RaiseException:
|
6
|
+
Enabled: true
|
7
|
+
|
8
|
+
# ensures we don't abuse the struct interface
|
9
|
+
# https://docs.rubocop.org/en/latest/cops_lint/#lintstructnewoverride
|
10
|
+
Lint/StructNewOverride:
|
11
|
+
Enabled: true
|
12
|
+
|
13
|
+
# 0.84++ changes
|
14
|
+
|
15
|
+
Lint/DeprecatedOpenSSLConstant:
|
16
|
+
Enabled: true
|
17
|
+
Lint/DuplicateElsifCondition:
|
18
|
+
Enabled: true
|
19
|
+
Lint/MixedRegexpCaptureTypes:
|
20
|
+
Enabled: true
|
21
|
+
|
22
|
+
# 0.89++ ... needs checking
|
23
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
Lint/DuplicateRescueException:
|
27
|
+
Enabled: true
|
28
|
+
|
29
|
+
Lint/EmptyConditionalBody:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
Lint/FloatComparison:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
Lint/MissingSuper:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
Lint/OutOfRangeRegexpRef:
|
39
|
+
Enabled: true
|
40
|
+
|
41
|
+
Lint/SelfAssignment:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
Lint/TopLevelReturnWithArgument:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
Lint/UnreachableLoop:
|
48
|
+
Enabled: true
|
data/config/metrics.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# cop configuration for Metrics should be found here
|
2
|
+
#
|
3
|
+
# Assignment Branch Complexity increasing slightly from the default of 15
|
4
|
+
Metrics/AbcSize:
|
5
|
+
Max: 18
|
6
|
+
|
7
|
+
# Ideally this would be 5 or 6
|
8
|
+
Metrics/MethodLength:
|
9
|
+
Max: 15
|
10
|
+
|
11
|
+
# No need to run this on rake tasks
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Exclude:
|
14
|
+
- config/environments/*.rb
|
15
|
+
- config/routes.rb
|
16
|
+
- lib/tasks/*.rake
|
17
|
+
- spec/**/*.rb
|
18
|
+
|
19
|
+
# Configuration parameters: CountComments.
|
20
|
+
Metrics/ClassLength:
|
21
|
+
Max: 116
|
22
|
+
|
23
|
+
# don't count kwargs in paramlist
|
24
|
+
Metrics/ParameterLists:
|
25
|
+
CountKeywordArgs: false
|
data/config/naming.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# cop configuration for Naming should be here
|
2
|
+
#
|
3
|
+
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
4
|
+
# EnforcedStyleForLeadingUnderscores: disallowed, required, optional
|
5
|
+
Naming/MemoizedInstanceVariableName:
|
6
|
+
Enabled: true
|
7
|
+
EnforcedStyleForLeadingUnderscores: optional
|
8
|
+
|
9
|
+
Naming/RescuedExceptionsVariableName:
|
10
|
+
Enabled: true
|
11
|
+
PreferredName: e
|
12
|
+
|
13
|
+
# how to name variables that have a number.
|
14
|
+
# https://docs.rubocop.org/rubocop/cops_naming.html#namingvariablenumber
|
15
|
+
Naming/VariableNumber:
|
16
|
+
Enabled: true
|
17
|
+
EnforcedStyle: snake_case
|
data/config/others.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#==================================================
|
2
|
+
|
3
|
+
# this is enabled because it's actually a best practice improvement
|
4
|
+
# Style/FrozenStringLiteralComment:
|
5
|
+
# Enabled: false
|
6
|
+
|
7
|
+
# not sure why the body length matters. this is a good style tip
|
8
|
+
# Style/Next:
|
9
|
+
# MinBodyLength: 5
|
10
|
+
|
11
|
+
# curious as to why
|
12
|
+
#Style/NumericLiterals:
|
13
|
+
# Enabled: false
|
14
|
+
#
|
15
|
+
# this should be enabled
|
16
|
+
# Style/PercentLiteralDelimiters:
|
17
|
+
# Enabled: false
|
18
|
+
|
19
|
+
# curious why - app/services/service.rb?
|
20
|
+
# Style/SignalException:
|
21
|
+
# EnforcedStyle: semantic
|
22
|
+
#
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Cop configuration for rubocop-performance can be found here
|
2
|
+
|
3
|
+
# https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performanceancestorsinclude
|
4
|
+
Performance/AncestorsInclude:
|
5
|
+
Enabled: true
|
6
|
+
|
7
|
+
# https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performancebigdecimalwithnumericargument
|
8
|
+
Performance/BigDecimalWithNumericArgument:
|
9
|
+
Enabled: true
|
10
|
+
|
11
|
+
# https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performanceredundantsortblock
|
12
|
+
Performance/RedundantSortBlock:
|
13
|
+
Enabled: true
|
14
|
+
|
15
|
+
# https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performanceredundantstringchars
|
16
|
+
Performance/RedundantStringChars:
|
17
|
+
Enabled: true
|
18
|
+
|
19
|
+
# https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performancereversefirst
|
20
|
+
Performance/ReverseFirst:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
# https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performancesortreverse
|
24
|
+
Performance/SortReverse:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
# https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performancesqueeze
|
28
|
+
Performance/Squeeze:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
# https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performancestringinclude
|
32
|
+
Performance/StringInclude:
|
33
|
+
Enabled: true
|
data/config/rails.yml
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Cop configuration for rubocop-rails here
|
2
|
+
#
|
3
|
+
Rails:
|
4
|
+
Enabled: true
|
5
|
+
|
6
|
+
# This cop only reports false positives: all cases reported are done on purpose.
|
7
|
+
# There's no value in keeping this enabled.
|
8
|
+
Rails/ApplicationController:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
# it's no longer necessary to split paths. it's much simpler to have one
|
12
|
+
# quoted string. see https://github.com/rubocop-hq/rubocop#5823 for more.
|
13
|
+
Rails/FilePath:
|
14
|
+
Enabled: true
|
15
|
+
EnforcedStyle: 'slashes'
|
16
|
+
|
17
|
+
# list callbacks in run order - https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsactiverecordcallbacksorder
|
18
|
+
Rails/ActiveRecordCallbacksOrder:
|
19
|
+
Enabled: true
|
20
|
+
|
21
|
+
# require the use of find instead of others https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsfindbyid
|
22
|
+
Rails/FindById:
|
23
|
+
Enabled: true
|
24
|
+
|
25
|
+
# prevents use of inquiry method: https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsinquiry
|
26
|
+
Rails/Inquiry:
|
27
|
+
Enabled: true
|
28
|
+
|
29
|
+
# ensure mailers are postfixed with Mailer https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsmailername
|
30
|
+
Rails/MailerName:
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
# don't use match in routes where it's not useful https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsmatchroute
|
34
|
+
Rails/MatchRoute:
|
35
|
+
Enabled: true
|
36
|
+
|
37
|
+
# use exclude not !include - https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsnegateinclude
|
38
|
+
Rails/NegateInclude:
|
39
|
+
Enabled: true
|
40
|
+
|
41
|
+
# ensure we use pluck over map - https://docs.rubocop.org/rubocop-rails/cops_rails.html#railspluck
|
42
|
+
Rails/Pluck:
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
# use select instead of pluck, which is better for where clauses - https://docs.rubocop.org/rubocop-rails/cops_rails.html#railspluckinwhere
|
46
|
+
Rails/PluckInWhere:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
# this cop checks to see if you're using render inline. we use it because pagy, so disable. https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsrenderinline
|
50
|
+
Rails/RenderInline:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
# ensure use of render plain when it makes sense https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsrenderplaintext
|
54
|
+
Rails/RenderPlainText:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
# consistently use the same format for i18n calls https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsshorti18n
|
58
|
+
Rails/ShortI18n:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
# use .exists? where possible https://docs.rubocop.org/rubocop-rails/cops_rails.html#railswhereexists
|
62
|
+
Rails/WhereExists:
|
63
|
+
Enabled: true
|
data/config/rspec.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Cop configuration for rubocop-security here
|
2
|
+
|
3
|
+
# this dictates the use of capy aliases to typical rspec methods
|
4
|
+
# https://rubocop.readthedocs.io/projects/rspec/en/read-the-docs/cops_capybara/#capybarafeaturemethods
|
5
|
+
RSpec/Capybara/FeatureMethods:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
# This sets the default behavior of ToNot
|
9
|
+
RSpec/NotToNot:
|
10
|
+
Enabled: true
|
11
|
+
EnforcedStyle: "to_not"
|
12
|
+
|
13
|
+
# align left braces for lets etc
|
14
|
+
RSpec/AlignLeftLetBrace:
|
15
|
+
Enabled: true
|
16
|
+
|
data/config/security.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Cops regarding rubocop-security can be found here
|
data/config/style.yml
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
# Always using single quotes in the right place seems like a neat idea
|
2
|
+
# but it is fairly restrictive without much benefit. This may change with
|
3
|
+
# memory management in ruby 3, but for now we can be more relaxed.
|
4
|
+
Style/StringLiterals:
|
5
|
+
Enabled: true
|
6
|
+
|
7
|
+
# Prefer class Name < Parent over the more verbose class Parent; class Name
|
8
|
+
Style/ClassAndModuleChildren:
|
9
|
+
EnforcedStyle: nested
|
10
|
+
|
11
|
+
# for now, to help translation to this set of cops
|
12
|
+
Style/FrozenStringLiteralComment:
|
13
|
+
Enabled: true
|
14
|
+
|
15
|
+
# Our documentation needs work
|
16
|
+
Style/Documentation:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
# this isn't one size fits all, and is easier to leave up to dev
|
20
|
+
Style/NumericPredicate:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
# Raise vs Fail seems to be an on-going debate with no significant impact.
|
24
|
+
# Fixing our style to raise.
|
25
|
+
Style/SignalException:
|
26
|
+
EnforcedStyle: only_raise
|
27
|
+
|
28
|
+
# Prefer two line empty methods
|
29
|
+
Style/EmptyMethod:
|
30
|
+
EnforcedStyle: expanded
|
31
|
+
|
32
|
+
# disable warning about emoji in comments.
|
33
|
+
Style/AsciiComments:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# preferred methods to iterate hashes - https://rubystyle.guide/#hash-each
|
37
|
+
Style/HashEachMethods:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
# each_with_object and injects are replaced with transforms...
|
41
|
+
Style/HashTransformKeys:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
# transforms were enabled in ruby 2.5... https://rubystyle.guide/#hash-transform-methods
|
45
|
+
Style/HashTransformValues:
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
# ensures exponential numbers are written correctly. we don't use them.
|
49
|
+
# https://docs.rubocop.org/en/latest/cops_style/#styleexponentialnotation
|
50
|
+
Style/ExponentialNotation:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
# I like this as it makes it clear how the block is formed, especially
|
54
|
+
# when doing third party / api / web requests - where i expect failure
|
55
|
+
# more often than in typical code.
|
56
|
+
# https://docs.rubocop.org/rubocop/cops_style.html#styleredundantbegin
|
57
|
+
Style/RedundantBegin:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
## 0.85+ https://docs.rubocop.org/rubocop/cops_style.html
|
61
|
+
|
62
|
+
Style/AccessorGrouping:
|
63
|
+
Enabled: true
|
64
|
+
Style/ArrayCoercion:
|
65
|
+
Enabled: true
|
66
|
+
Style/BisectedAttrAccessor:
|
67
|
+
Enabled: true
|
68
|
+
Style/CaseLikeIf:
|
69
|
+
Enabled: true
|
70
|
+
Style/HashAsLastArrayItem:
|
71
|
+
Enabled: true
|
72
|
+
Style/HashLikeCase:
|
73
|
+
Enabled: true
|
74
|
+
Style/RedundantAssignment:
|
75
|
+
Enabled: true
|
76
|
+
Style/RedundantFetchBlock:
|
77
|
+
Enabled: true
|
78
|
+
Style/RedundantFileExtensionInRequire:
|
79
|
+
Enabled: true
|
80
|
+
Style/RedundantRegexpCharacterClass:
|
81
|
+
Enabled: true
|
82
|
+
Style/RedundantRegexpEscape:
|
83
|
+
Enabled: true
|
84
|
+
Style/SlicingWithRange:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
|
88
|
+
## 0.89 ... needs more validation
|
89
|
+
Style/ExplicitBlockArgument:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
Style/GlobalStdStream:
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
Style/OptionalBooleanParameter:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
Style/SingleArgumentDig:
|
99
|
+
Enabled: true
|
100
|
+
|
101
|
+
Style/StringConcatenation:
|
102
|
+
Enabled: true
|
@@ -0,0 +1 @@
|
|
1
|
+
# Cops regarding rubocop-thread-safety can be found here
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/smokeclouds/rubocop/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "smokeclouds-rubocop"
|
7
|
+
spec.version = Smokeclouds::Rubocop::VERSION
|
8
|
+
spec.authors = ["James Cox"]
|
9
|
+
spec.email = ["james@imaj.es"]
|
10
|
+
|
11
|
+
spec.summary = "A kept up-to-date rubocop configuration from an experienced ruby dev"
|
12
|
+
spec.homepage = "https://github.com/imajes/smokeclouds-rubocop"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
15
|
+
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/imajes/smokeclouds-rubocop/blob/main/CHANGELOG.md"
|
20
|
+
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
23
|
+
|
24
|
+
spec.require_paths = ['lib']
|
25
|
+
spec.files = Dir[
|
26
|
+
'{config,lib,spec}/**/*',
|
27
|
+
'.rubocop.yml',
|
28
|
+
'*.md',
|
29
|
+
'*.gemspec',
|
30
|
+
'Gemfile',
|
31
|
+
]
|
32
|
+
|
33
|
+
spec.add_dependency 'rubocop', '~> 1.12.0'
|
34
|
+
spec.add_dependency 'rubocop-faker', '~> 1.1.0'
|
35
|
+
spec.add_dependency 'rubocop-performance', '~> 1.10.2'
|
36
|
+
spec.add_dependency 'rubocop-rails', '~> 2.9.1'
|
37
|
+
spec.add_dependency 'rubocop-rspec', '~> 2.2.0'
|
38
|
+
spec.add_dependency 'rubocop-thread_safety', '~> 0.4.2'
|
39
|
+
|
40
|
+
spec.add_development_dependency 'rspec', '~> 3.10.0'
|
41
|
+
|
42
|
+
# For more information and examples about making a new gem, checkout our
|
43
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smokeclouds-rubocop
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Cox
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.12.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.12.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-faker
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-performance
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.10.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.10.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.9.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.9.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.2.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.2.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-thread_safety
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.4.2
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.4.2
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.10.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.10.0
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- james@imaj.es
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".rubocop.yml"
|
119
|
+
- CHANGELOG.md
|
120
|
+
- CODE_OF_CONDUCT.md
|
121
|
+
- Gemfile
|
122
|
+
- README.md
|
123
|
+
- config/bundler.yml
|
124
|
+
- config/faker.yml
|
125
|
+
- config/layout.yml
|
126
|
+
- config/lint.yml
|
127
|
+
- config/metrics.yml
|
128
|
+
- config/naming.yml
|
129
|
+
- config/others.yml
|
130
|
+
- config/performance.yml
|
131
|
+
- config/rails.yml
|
132
|
+
- config/rspec.yml
|
133
|
+
- config/security.yml
|
134
|
+
- config/style.yml
|
135
|
+
- config/thread-safety.yml
|
136
|
+
- lib/smokeclouds/rubocop.rb
|
137
|
+
- lib/smokeclouds/rubocop/version.rb
|
138
|
+
- smokeclouds-rubocop.gemspec
|
139
|
+
homepage: https://github.com/imajes/smokeclouds-rubocop
|
140
|
+
licenses:
|
141
|
+
- MIT
|
142
|
+
metadata:
|
143
|
+
allowed_push_host: https://rubygems.org
|
144
|
+
homepage_uri: https://github.com/imajes/smokeclouds-rubocop
|
145
|
+
source_code_uri: https://github.com/imajes/smokeclouds-rubocop
|
146
|
+
changelog_uri: https://github.com/imajes/smokeclouds-rubocop/blob/main/CHANGELOG.md
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: 2.4.0
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubygems_version: 3.1.4
|
163
|
+
signing_key:
|
164
|
+
specification_version: 4
|
165
|
+
summary: A kept up-to-date rubocop configuration from an experienced ruby dev
|
166
|
+
test_files: []
|