aroundhome_cops 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.gitlab-ci.yml +33 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +98 -0
- data/Gemfile +5 -0
- data/README.md +44 -0
- data/aroundhome_cops.gemspec +22 -0
- data/default.yml +167 -0
- data/lib/aroundhome_cops.rb +5 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8b9bd51596d52489367945aaa124fd6553037b18c02532108d7257ce32cdc730
|
4
|
+
data.tar.gz: be240ec3e67e0f2d0b6c5df03ec67ec4fbb6430dd0a169e436bf78eab4284b54
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 55bf0c984dec9a4618ca6666a3f55eb0bad1fa6e9853c65bcec2f5bf51cd99f883cf558e5f2a37dcd35c3fbdc9e19f03b39170ed63014f5219124cdbedcdae4c
|
7
|
+
data.tar.gz: fbe4d180f3285f76b38dd1371004d265d22c9efbd212b8073541d3efa6e128a5dfcf126687931f0fc6d55b5a5b7ccd1973cdd5f3fb367ebe677c39e2a2f0b47b
|
data/.gitignore
ADDED
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
image: ruby:latest
|
2
|
+
|
3
|
+
stages:
|
4
|
+
- test
|
5
|
+
- publish
|
6
|
+
|
7
|
+
variables:
|
8
|
+
SSH_AUTH_SOCK: "/ssh-agent"
|
9
|
+
|
10
|
+
before_script:
|
11
|
+
- mkdir -p /root/.ssh && ssh-keyscan -H codevault.io > /root/.ssh/known_hosts 2>/dev/null
|
12
|
+
- bundle config jobs 8
|
13
|
+
- bundle install --path=/tmp/bundler --quiet
|
14
|
+
|
15
|
+
rubocop:
|
16
|
+
stage: test
|
17
|
+
script:
|
18
|
+
- bundle exec rubocop
|
19
|
+
|
20
|
+
publish_gem:
|
21
|
+
stage: publish
|
22
|
+
script:
|
23
|
+
- mkdir ~/.gem
|
24
|
+
- |
|
25
|
+
cat << EOF > ~/.gem/credentials
|
26
|
+
---
|
27
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
28
|
+
EOF
|
29
|
+
- chmod 0600 ~/.gem/credentials
|
30
|
+
- gem build aroundhome_cops.gemspec
|
31
|
+
- gem push $(find `pwd` -name "aroundhome_cops-*.gem")
|
32
|
+
only:
|
33
|
+
- master
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
## Version 2.0.0
|
2
|
+
|
3
|
+
* Rename to `aroundhome_cops` (our company name changed a while ago)
|
4
|
+
* **Breaking**: This requires you to make changes to `.rubocop.yml`
|
5
|
+
* Remove references to internals from the repository, so that open sourcing
|
6
|
+
the gem is possible
|
7
|
+
|
8
|
+
## Version 1.7.0
|
9
|
+
|
10
|
+
* Do not count keyword arguments in `Metrics/ParameterLists`
|
11
|
+
|
12
|
+
## Version 1.6.0
|
13
|
+
|
14
|
+
* Rubocop 0.86
|
15
|
+
* Enable new cops
|
16
|
+
|
17
|
+
## Version 1.5.0
|
18
|
+
|
19
|
+
* Rubocop 0.82:
|
20
|
+
* Enable new cops
|
21
|
+
* Keep `Layout/LineLength` disabled for migrations
|
22
|
+
* Use new gem source
|
23
|
+
|
24
|
+
## Version 1.4.0
|
25
|
+
|
26
|
+
* Rubocop 0.78 compatibility: Do not mention Rails cops anymore, since those have been removed
|
27
|
+
|
28
|
+
## Version 1.3.5
|
29
|
+
|
30
|
+
* **Removes**
|
31
|
+
* Perfomance rules. 0.68 version of rubocop dropping support for these rules. If needed by the team due to conventions, take a look into gem rubocop-perfomance.
|
32
|
+
* **Discussion issue**
|
33
|
+
* https://codevault.io/aroundhome/aroundhome_cops/issues/2
|
34
|
+
|
35
|
+
## Version 1.3.4
|
36
|
+
|
37
|
+
* Ignore node_modules
|
38
|
+
|
39
|
+
## Version 1.3.3
|
40
|
+
|
41
|
+
* Ignore all public files
|
42
|
+
|
43
|
+
## Version 1.3.2
|
44
|
+
|
45
|
+
* Ignore uploaded files directory
|
46
|
+
|
47
|
+
## Version 1.3.1
|
48
|
+
|
49
|
+
* Ignore playground directory
|
50
|
+
|
51
|
+
## Version 1.3.0
|
52
|
+
|
53
|
+
* Ignore all migrations before 2018
|
54
|
+
* Exempt all migrations from metric checks
|
55
|
+
|
56
|
+
## Version 1.2.3
|
57
|
+
|
58
|
+
* Also ignore `Metrics/BlockLength` violations for `xdescribe` and `xcontext`
|
59
|
+
(which are RSpec's pending equivalents of `describe` and `context`)
|
60
|
+
|
61
|
+
## Version 1.2.2
|
62
|
+
|
63
|
+
* `Style/FormatStringToken` temporary disabled because of a bug in Rubocop 0.52.0
|
64
|
+
|
65
|
+
## Version 1.2.1
|
66
|
+
|
67
|
+
* AllCops
|
68
|
+
* Exclude:
|
69
|
+
* We now Exclude all migrations being done before 2017
|
70
|
+
## Version 1.2.0
|
71
|
+
|
72
|
+
* Increase threshold for `Metrics/MethodLength`
|
73
|
+
|
74
|
+
## Version 1.1.2
|
75
|
+
|
76
|
+
* Metrics/BlockLength: Exclude the following file:
|
77
|
+
- \*.gemspec
|
78
|
+
|
79
|
+
## Version 1.1.1
|
80
|
+
|
81
|
+
* Rubocop of at least 0.51 version is now required
|
82
|
+
* Removed `EnforcedStyle: never` from `Style/Encoding` since it is not supported anymore
|
83
|
+
|
84
|
+
## Version 1.1.0
|
85
|
+
|
86
|
+
* Metrics/BlockLength: Exclude the following methods:
|
87
|
+
- factory
|
88
|
+
- define
|
89
|
+
- shared_examples_for
|
90
|
+
- shared_examples
|
91
|
+
|
92
|
+
* Metrics/BlockLength: Exclude the following file:
|
93
|
+
- spec_helper.rb
|
94
|
+
|
95
|
+
|
96
|
+
## Version 1.0.0
|
97
|
+
|
98
|
+
* Initial version as a gem
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# AroundhomeCops
|
2
|
+
|
3
|
+
This repository hosts our configuration gem for rubocop.
|
4
|
+
|
5
|
+
The configuration provided here is intended to apply to all of our projects.
|
6
|
+
Your application might have special rules of its own, which you can freely
|
7
|
+
override in your local configuration. But if you think a rule is of general
|
8
|
+
relevance, that it should probably live here.
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
Include this gem in your Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'aroundhome_cops'
|
16
|
+
```
|
17
|
+
|
18
|
+
Let your `.rubocop.yml` inherit from this gem:
|
19
|
+
|
20
|
+
```yml
|
21
|
+
inherit_gem:
|
22
|
+
aroundhome_cops:
|
23
|
+
- default.yml
|
24
|
+
```
|
25
|
+
|
26
|
+
## Customizing rules
|
27
|
+
|
28
|
+
The snippet above is everything needed to use this configuration as default.
|
29
|
+
Starting from there it is possible to make local changes to the configuration.
|
30
|
+
|
31
|
+
Take this example `.rubocop.yml`:
|
32
|
+
|
33
|
+
```yml
|
34
|
+
inherit_gem:
|
35
|
+
aroundhome_cops:
|
36
|
+
- default.yml
|
37
|
+
|
38
|
+
# We still have unfixed offenses in some files
|
39
|
+
inherit_from: .rubocop_todo.yml
|
40
|
+
|
41
|
+
# This project agreed on a different line length than the rest of the company
|
42
|
+
Metrics/LineLength:
|
43
|
+
Max: 120
|
44
|
+
```
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib = File.expand_path('lib', __dir__)
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
+
require 'aroundhome_cops'
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'aroundhome_cops'
|
10
|
+
spec.version = AroundhomeCops::VERSION
|
11
|
+
spec.authors = ['Jan Sandbrink']
|
12
|
+
spec.email = ['jan.sandbrink@aroundhome.de']
|
13
|
+
|
14
|
+
spec.summary = 'Dependency and configuration for rubocop.'
|
15
|
+
spec.homepage = 'https://github.com/aroundhome/aroundhome_cops'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
.reject { |f| f.match(%r{^spec/}) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'rubocop', '~> 0.86'
|
22
|
+
end
|
data/default.yml
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'bin/**/*'
|
4
|
+
- 'db/schema.rb'
|
5
|
+
- 'doc/**/*'
|
6
|
+
- 'docker_app/**/*'
|
7
|
+
- 'Guardfile'
|
8
|
+
- 'tmp/**/*'
|
9
|
+
- 'vendor/**/*'
|
10
|
+
- 'playground/**/*'
|
11
|
+
- 'public/**/*'
|
12
|
+
- 'node_modules/**/*'
|
13
|
+
- 'db/migrate/200*.rb'
|
14
|
+
- 'db/migrate/2010*.rb'
|
15
|
+
- 'db/migrate/2011*.rb'
|
16
|
+
- 'db/migrate/2012*.rb'
|
17
|
+
- 'db/migrate/2013*.rb'
|
18
|
+
- 'db/migrate/2014*.rb'
|
19
|
+
- 'db/migrate/2015*.rb'
|
20
|
+
- 'db/migrate/2016*.rb'
|
21
|
+
- 'db/migrate/2017*.rb'
|
22
|
+
|
23
|
+
# Models can have a bunch of attributes which lead to long methods and high
|
24
|
+
# complexity values. However, these methods are still very readable because they
|
25
|
+
# usually have a lot of repetition.
|
26
|
+
Metrics:
|
27
|
+
Exclude:
|
28
|
+
- 'db/migrate/*.rb'
|
29
|
+
|
30
|
+
# See above (Metrics). This cop was previously called Metrics/LineLength
|
31
|
+
# and therefore disabled as well for migrations.
|
32
|
+
Layout/LineLength:
|
33
|
+
Exclude:
|
34
|
+
- 'db/migrate/*.rb'
|
35
|
+
|
36
|
+
|
37
|
+
# We need to configure exemptions for blocks that we generally accept to be
|
38
|
+
# long, since they are less comparable to methods and more comparable to
|
39
|
+
# modules/classes.
|
40
|
+
Metrics/BlockLength:
|
41
|
+
ExcludedMethods:
|
42
|
+
- context
|
43
|
+
- describe
|
44
|
+
- namespace
|
45
|
+
- factory
|
46
|
+
- define
|
47
|
+
- shared_examples_for
|
48
|
+
- shared_examples
|
49
|
+
- xcontext
|
50
|
+
- xdescribe
|
51
|
+
Exclude:
|
52
|
+
- 'config/environments/*.rb' # instead of excluding all :configure methods
|
53
|
+
- 'config/routes.rb'
|
54
|
+
- 'spec/spec_helper.rb' # instead of excluding all :configure methods
|
55
|
+
- '*.gemspec' # a gemspec could easily have more than the 25 lines limit
|
56
|
+
|
57
|
+
# Increase from rubocops default limit of 10 lines.
|
58
|
+
# The idea of increasing the default limit is to reduce the "false alarm rate"
|
59
|
+
# of this cop on projects without a rubocop_todo.yml.
|
60
|
+
# The intention of the cop is to fight complicated methods, but it often triggers
|
61
|
+
# for (subjectively) easy methods, too.
|
62
|
+
Metrics/MethodLength:
|
63
|
+
Max: 16
|
64
|
+
|
65
|
+
Style/AsciiComments:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
Style/Documentation:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
# Encoding comments are not neccessary in all 2.x versions of ruby, since
|
72
|
+
# UTF-8 has become the default encoding.
|
73
|
+
Style/Encoding:
|
74
|
+
Enabled: true
|
75
|
+
Exclude:
|
76
|
+
- '*.gemspec'
|
77
|
+
|
78
|
+
# Ruby 2.3 introduced optional automatic freezing of string literals
|
79
|
+
# This might become default in future versions.
|
80
|
+
# For details on this feature see the internet, e.g. https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3
|
81
|
+
Style/FrozenStringLiteralComment:
|
82
|
+
EnforcedStyle: always
|
83
|
+
|
84
|
+
# This cop tries to make you use module_funtion instead of extend self
|
85
|
+
# This is bad because both have their own use-case and should not be used
|
86
|
+
# and sometimes cannot be used to do the same thing
|
87
|
+
Style/ModuleFunction:
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
# While it is very often useful to separate numbers after every three digits
|
91
|
+
# for readability, this mostly doesn't make sense if the number doesn't
|
92
|
+
# represent an amount but rather an identifier. Thus the use of underscores
|
93
|
+
# every three digits is recommended but not enforced.
|
94
|
+
Style/NumericLiterals:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
# Do not force the same one letter variable names for all occurences of inject
|
98
|
+
Style/SingleLineBlockParams:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
# Rubocop 0.52.0 added new 'unannotated' style, which mistakenly treat
|
102
|
+
# date/time formatting strings as regular formatting strings
|
103
|
+
# Disable is temporary until the fix is released.
|
104
|
+
# To check if the bug was fixed, make sure this code is okay for Rubocop:
|
105
|
+
# Time.strptime('2017-12-13', '%Y-%m-%d')
|
106
|
+
Style/FormatStringToken:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
# The maximum amount of positional arguments in a method really shouldn't exceed
|
110
|
+
# the rubocop default of 5.
|
111
|
+
# However, keyword arguments do not make a method signature as unreadable as positional
|
112
|
+
# arguments. There are valid cases for longer argument lists (e.g. data objects or
|
113
|
+
# DSLs with implicit default values).
|
114
|
+
# In those cases keyword args provide a good balance between readability and the need to
|
115
|
+
# pass more arguments into an object.
|
116
|
+
Metrics/ParameterLists:
|
117
|
+
CountKeywordArgs: false
|
118
|
+
|
119
|
+
# ----------------- Rubocop-forced enablements --------------
|
120
|
+
|
121
|
+
# Since version 0.80 rubocop wants to cause fewer breaking changes by new cops.
|
122
|
+
# Since then new cops have to be manually enabled/disabled for a warning to
|
123
|
+
# disappear. Unless there is a reason to opt out of them, we will enable all of
|
124
|
+
# them below.
|
125
|
+
# Disabled cops will appear above with a comment explaining disablement.
|
126
|
+
|
127
|
+
Layout/SpaceAroundMethodCallOperator:
|
128
|
+
Enabled: true
|
129
|
+
|
130
|
+
Lint/RaiseException:
|
131
|
+
Enabled: true
|
132
|
+
|
133
|
+
Lint/StructNewOverride:
|
134
|
+
Enabled: true
|
135
|
+
|
136
|
+
Style/ExponentialNotation:
|
137
|
+
Enabled: true
|
138
|
+
|
139
|
+
Style/HashEachMethods:
|
140
|
+
Enabled: true
|
141
|
+
|
142
|
+
Style/HashTransformKeys:
|
143
|
+
Enabled: true
|
144
|
+
|
145
|
+
Style/HashTransformValues:
|
146
|
+
Enabled: true
|
147
|
+
|
148
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
149
|
+
Enabled: true
|
150
|
+
|
151
|
+
Lint/DeprecatedOpenSSLConstant:
|
152
|
+
Enabled: true
|
153
|
+
|
154
|
+
Lint/MixedRegexpCaptureTypes:
|
155
|
+
Enabled: true
|
156
|
+
|
157
|
+
Style/RedundantFetchBlock:
|
158
|
+
Enabled: true
|
159
|
+
|
160
|
+
Style/RedundantRegexpCharacterClass:
|
161
|
+
Enabled: true
|
162
|
+
|
163
|
+
Style/RedundantRegexpEscape:
|
164
|
+
Enabled: true
|
165
|
+
|
166
|
+
Style/SlicingWithRange:
|
167
|
+
Enabled: true
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aroundhome_cops
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jan Sandbrink
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-16 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: '0.86'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.86'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- jan.sandbrink@aroundhome.de
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".gitlab-ci.yml"
|
36
|
+
- ".rubocop.yml"
|
37
|
+
- CHANGELOG.md
|
38
|
+
- Gemfile
|
39
|
+
- README.md
|
40
|
+
- aroundhome_cops.gemspec
|
41
|
+
- default.yml
|
42
|
+
- lib/aroundhome_cops.rb
|
43
|
+
homepage: https://github.com/aroundhome/aroundhome_cops
|
44
|
+
licenses: []
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubygems_version: 3.1.2
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: Dependency and configuration for rubocop.
|
65
|
+
test_files: []
|