appbooster_rubocop_config 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.rubocop.yml +1 -0
- data/.travis.yml +8 -0
- data/Gemfile +6 -0
- data/Makefile +8 -0
- data/README.md +57 -0
- data/Rakefile +6 -0
- data/appbooster_rubocop_config.gemspec +37 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/default.yml +70 -0
- data/lib/rubocop/appbooster_rubocop_config/version.rb +3 -0
- data/lib/rubocop/appbooster_rubocop_config.rb +6 -0
- data/lib/rubocop/cop/lint/unless_multiple_conditions.rb +43 -0
- data/spec.yml +25 -0
- metadata +130 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 4c4554d26c0c3702092fd133c139c063f6e0792e
|
|
4
|
+
data.tar.gz: 45304b30a7dedeccf434f3b9e31b7d6807d19bd0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e02e2dff295f7634b364b7de75ca91edb9c576bca3e2af36694c2718a1e604d9149452b442dde234946beb8abdcb82d45c5dcb26f7519f14f07cac1c3d6ec564
|
|
7
|
+
data.tar.gz: 81f913c6cccebdb6db88e77fec0935beb2761ce8ad50d7111e35249f6f818da8513fcb8ff62d65251485b62383f12fe8665a406749b1dd5efadf0156bc86349b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
inherit_from: default.yml
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Makefile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# AppboosterRubocopConfig
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/appbooster/rubocop_config)
|
|
4
|
+
|
|
5
|
+
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/appbooster_rubocop_config`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
6
|
+
|
|
7
|
+
TODO: Delete this and the text above, and describe your gem
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Add this line to your application's Gemfile:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'appbooster_rubocop_config', github: 'appbooster/rubocop_config'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
And then execute:
|
|
18
|
+
|
|
19
|
+
$ bundle
|
|
20
|
+
|
|
21
|
+
Or install it yourself as:
|
|
22
|
+
|
|
23
|
+
$ gem install appbooster_rubocop_config
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Configurate your project with this template.
|
|
28
|
+
|
|
29
|
+
1. `.rubocop.yml`
|
|
30
|
+
|
|
31
|
+
```yml
|
|
32
|
+
inherit_gem:
|
|
33
|
+
appbooster_rubocop_config: default.yml
|
|
34
|
+
|
|
35
|
+
AllCops:
|
|
36
|
+
TargetRubyVersion: ENTER_YOUR_RUBY_VERSION_HERE
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
1. `./spec/.rubocop.yml`
|
|
40
|
+
|
|
41
|
+
```yml
|
|
42
|
+
inherit_gem:
|
|
43
|
+
appbooster_rubocop_config: spec.yml
|
|
44
|
+
inherit_from:
|
|
45
|
+
- ../.rubocop.yml
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Development
|
|
49
|
+
|
|
50
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `make` to run the tests and lints. Or you can call it seperatly `make lint` for linting and `make test` for testing.
|
|
51
|
+
|
|
52
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
53
|
+
TODO: create `make release`
|
|
54
|
+
|
|
55
|
+
## Contributing
|
|
56
|
+
|
|
57
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/appbooster_rubocop_config.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "rubocop/appbooster_rubocop_config/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "appbooster_rubocop_config"
|
|
8
|
+
spec.version = AppboosterRubocopConfig::VERSION
|
|
9
|
+
spec.authors = ["Dmitriy Ivliev"]
|
|
10
|
+
spec.email = ["rootkit89@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "Shared rubocop config of Appbooster organization"
|
|
13
|
+
spec.homepage = "https://github.com/appbooster/rubocop_config"
|
|
14
|
+
|
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
17
|
+
if spec.respond_to?(:metadata)
|
|
18
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
19
|
+
else
|
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
21
|
+
"public gem pushes."
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
25
|
+
f.match(%r{^(test|spec|features)/})
|
|
26
|
+
end
|
|
27
|
+
spec.bindir = "exe"
|
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
29
|
+
spec.require_paths = ["lib"]
|
|
30
|
+
|
|
31
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
|
32
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
34
|
+
|
|
35
|
+
spec.add_dependency "rubocop", "~> 0.51.0"
|
|
36
|
+
spec.add_dependency "rubocop-rspec", "~> 1.20"
|
|
37
|
+
end
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "appbooster_rubocop_config"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/default.yml
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require:
|
|
2
|
+
- ./lib/rubocop/appbooster_rubocop_config
|
|
3
|
+
|
|
4
|
+
AllCops:
|
|
5
|
+
Include:
|
|
6
|
+
- "Rakefile"
|
|
7
|
+
- "config.ru"
|
|
8
|
+
- "lib/**/*.rake"
|
|
9
|
+
Exclude:
|
|
10
|
+
- "bundle/**/*"
|
|
11
|
+
- "vendor/**/*"
|
|
12
|
+
- "db/**/*"
|
|
13
|
+
- "script/**"
|
|
14
|
+
- "node_modules/**/*"
|
|
15
|
+
- "bin/**"
|
|
16
|
+
- "*Gemfile*"
|
|
17
|
+
- "*.gemspec"
|
|
18
|
+
|
|
19
|
+
Layout/SpaceInLambdaLiteral:
|
|
20
|
+
EnforcedStyle: require_space
|
|
21
|
+
|
|
22
|
+
Layout/IndentHash:
|
|
23
|
+
EnforcedStyle: consistent
|
|
24
|
+
|
|
25
|
+
# Commonly used screens these days easily fit more than 80 characters.
|
|
26
|
+
Metrics/LineLength:
|
|
27
|
+
Max: 120
|
|
28
|
+
|
|
29
|
+
Metrics/AbcSize:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
Metrics/ParameterLists:
|
|
33
|
+
CountKeywordArgs: false
|
|
34
|
+
|
|
35
|
+
Naming/FileName:
|
|
36
|
+
Exclude:
|
|
37
|
+
- "Capfile"
|
|
38
|
+
- "Vagrantfile"
|
|
39
|
+
|
|
40
|
+
Rails:
|
|
41
|
+
Enabled: true
|
|
42
|
+
|
|
43
|
+
Rails/SkipsModelValidations:
|
|
44
|
+
Enabled: true
|
|
45
|
+
|
|
46
|
+
# Single quotes being faster is hardly measurable and only affects parse time.
|
|
47
|
+
# Enforcing double quotes reduces the times where you need to change them
|
|
48
|
+
# when introducing an interpolation. Use single quotes only if their semantics
|
|
49
|
+
# are needed.
|
|
50
|
+
Style/StringLiterals:
|
|
51
|
+
EnforcedStyle: double_quotes
|
|
52
|
+
|
|
53
|
+
Style/SafeNavigation:
|
|
54
|
+
Enabled: true
|
|
55
|
+
|
|
56
|
+
Style/Documentation:
|
|
57
|
+
Enabled: false
|
|
58
|
+
|
|
59
|
+
Style/FrozenStringLiteralComment:
|
|
60
|
+
Enabled: false
|
|
61
|
+
|
|
62
|
+
Style/ClassAndModuleChildren:
|
|
63
|
+
Enabled: false
|
|
64
|
+
|
|
65
|
+
Style/NumericPredicate:
|
|
66
|
+
Enabled: false
|
|
67
|
+
|
|
68
|
+
Lint/UnlessMultipleConditions:
|
|
69
|
+
Description: 'Do not use `unless` with multiple conditions.'
|
|
70
|
+
Enabled: true
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rubocop"
|
|
4
|
+
|
|
5
|
+
module RuboCop
|
|
6
|
+
module Cop
|
|
7
|
+
module Lint
|
|
8
|
+
# This cop checks that `unless` is not used with multiple conditions.
|
|
9
|
+
# In general, using multiple conditions with `unless` reduces readability.
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# # bad
|
|
13
|
+
# unless foo && bar
|
|
14
|
+
# something
|
|
15
|
+
# end
|
|
16
|
+
#
|
|
17
|
+
# # bad
|
|
18
|
+
# unless foo || bar
|
|
19
|
+
# something
|
|
20
|
+
# end
|
|
21
|
+
#
|
|
22
|
+
# # good
|
|
23
|
+
# if !foo || !bar
|
|
24
|
+
# something
|
|
25
|
+
# end
|
|
26
|
+
#
|
|
27
|
+
# # good
|
|
28
|
+
# if !foo && !bar
|
|
29
|
+
# something
|
|
30
|
+
# end
|
|
31
|
+
class UnlessMultipleConditions < Cop
|
|
32
|
+
MSG = "Avoid using `unless` with multiple conditions.".freeze
|
|
33
|
+
|
|
34
|
+
def on_if(node)
|
|
35
|
+
return unless node.unless?
|
|
36
|
+
|
|
37
|
+
add_offense(node.condition) if node.condition.and_type? ||
|
|
38
|
+
node.condition.or_type?
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
data/spec.yml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require: rubocop-rspec
|
|
2
|
+
|
|
3
|
+
inherit_from:
|
|
4
|
+
- default.yml
|
|
5
|
+
|
|
6
|
+
Metrics/BlockLength:
|
|
7
|
+
Enabled: false
|
|
8
|
+
|
|
9
|
+
Metrics/ParameterLists:
|
|
10
|
+
Enabled: false
|
|
11
|
+
|
|
12
|
+
Naming/AccessorMethodName:
|
|
13
|
+
Enabled: false
|
|
14
|
+
|
|
15
|
+
RSpec/MessageSpies:
|
|
16
|
+
EnforcedStyle: receive
|
|
17
|
+
|
|
18
|
+
RSpec/MultipleExpectations:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
RSpec/NestedGroups:
|
|
22
|
+
Max: 5
|
|
23
|
+
|
|
24
|
+
RSpec/ExampleLength:
|
|
25
|
+
Max: 10
|
metadata
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: appbooster_rubocop_config
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Dmitriy Ivliev
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-03-12 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.15'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.15'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rubocop
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 0.51.0
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 0.51.0
|
|
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: '1.20'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '1.20'
|
|
83
|
+
description:
|
|
84
|
+
email:
|
|
85
|
+
- rootkit89@gmail.com
|
|
86
|
+
executables: []
|
|
87
|
+
extensions: []
|
|
88
|
+
extra_rdoc_files: []
|
|
89
|
+
files:
|
|
90
|
+
- ".gitignore"
|
|
91
|
+
- ".rspec"
|
|
92
|
+
- ".rubocop.yml"
|
|
93
|
+
- ".travis.yml"
|
|
94
|
+
- Gemfile
|
|
95
|
+
- Makefile
|
|
96
|
+
- README.md
|
|
97
|
+
- Rakefile
|
|
98
|
+
- appbooster_rubocop_config.gemspec
|
|
99
|
+
- bin/console
|
|
100
|
+
- bin/setup
|
|
101
|
+
- default.yml
|
|
102
|
+
- lib/rubocop/appbooster_rubocop_config.rb
|
|
103
|
+
- lib/rubocop/appbooster_rubocop_config/version.rb
|
|
104
|
+
- lib/rubocop/cop/lint/unless_multiple_conditions.rb
|
|
105
|
+
- spec.yml
|
|
106
|
+
homepage: https://github.com/appbooster/rubocop_config
|
|
107
|
+
licenses: []
|
|
108
|
+
metadata:
|
|
109
|
+
allowed_push_host: https://rubygems.org
|
|
110
|
+
post_install_message:
|
|
111
|
+
rdoc_options: []
|
|
112
|
+
require_paths:
|
|
113
|
+
- lib
|
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
|
+
requirements:
|
|
116
|
+
- - ">="
|
|
117
|
+
- !ruby/object:Gem::Version
|
|
118
|
+
version: '0'
|
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '0'
|
|
124
|
+
requirements: []
|
|
125
|
+
rubyforge_project:
|
|
126
|
+
rubygems_version: 2.6.11
|
|
127
|
+
signing_key:
|
|
128
|
+
specification_version: 4
|
|
129
|
+
summary: Shared rubocop config of Appbooster organization
|
|
130
|
+
test_files: []
|