tt_ruby_style 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -0
- data/.rubocop.yml +1 -0
- data/Gemfile +4 -0
- data/Makefile +13 -0
- data/README.md +43 -0
- data/RELEASING.md +15 -0
- data/Rakefile +1 -0
- data/bin/build +6 -0
- data/bin/bundle +109 -0
- data/bin/publish +6 -0
- data/bin/rake +27 -0
- data/bin/setup +8 -0
- data/default.yml +69 -0
- data/lib/talent_tech/style/version.rb +5 -0
- data/lib/talent_tech/style.rb +7 -0
- data/tt_ruby_style.gemspec +32 -0
- metadata +21 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66a59d69f4690563f9f62d29f23bd4bc32bb881d5b9cc9c8eb7bbeb3c1086e65
|
4
|
+
data.tar.gz: 5e95401ed73046be6e6e60bca6cfdfb9ba2666a5e385794c670b72af895d33f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b875ccf8c3932fd2b5c90beac53709a8d759140a14f7a197e87d6702ff7403e4b9081251d0ed1cfec12841822f00d800b4013f96c6d31cbcab2ceb676350e4d7
|
7
|
+
data.tar.gz: e9f66d1f2d8daff4cf7065c153e299d00439817a3fb82810c9e6a35fb20d38f5b4b2502a74c115f909598c1781749ddaac552634bb5ef2954916cc5fc49b75db
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: default.yml
|
data/Gemfile
ADDED
data/Makefile
ADDED
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# tt_ruby_style
|
2
|
+
|
3
|
+
Percy shared style configs.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
group :test, :development do
|
11
|
+
gem 'tt_ruby_style'
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
15
|
+
Or, for a Ruby library, add this to your gemspec:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
spec.add_development_dependency 'tt_ruby_style'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then run:
|
22
|
+
|
23
|
+
```bash
|
24
|
+
$ bundle install
|
25
|
+
```
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Create a `.rubocop.yml` with the following directives:
|
30
|
+
|
31
|
+
```yaml
|
32
|
+
inherit_gem:
|
33
|
+
tt_ruby_style:
|
34
|
+
- default.yml
|
35
|
+
```
|
36
|
+
|
37
|
+
Now, run:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
$ bundle exec rubocop
|
41
|
+
```
|
42
|
+
|
43
|
+
You do not need to include rubocop directly in your application's dependencies. tt_ruby_style will include a specific version of `rubocop` and `rubocop-rails` that is shared across all projects.
|
data/RELEASING.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Releasing
|
2
|
+
|
3
|
+
1. Update version.rb file accordingly.
|
4
|
+
1. Tag the release: `git tag vVERSION`
|
5
|
+
1. Push changes: `git push --tags`
|
6
|
+
1. Update the release notes on GitHub.com
|
7
|
+
1. Build and publish:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
make deploy
|
11
|
+
```
|
12
|
+
|
13
|
+
* Announce the new release,
|
14
|
+
making sure to say "thank you" to the contributors
|
15
|
+
who helped shape this version!
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/build
ADDED
data/bin/bundle
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'bundle' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
|
11
|
+
m = Module.new do
|
12
|
+
module_function
|
13
|
+
|
14
|
+
def invoked_as_script?
|
15
|
+
File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
|
16
|
+
end
|
17
|
+
|
18
|
+
def env_var_version
|
19
|
+
ENV['BUNDLER_VERSION']
|
20
|
+
end
|
21
|
+
|
22
|
+
def cli_arg_version
|
23
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
24
|
+
return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update`
|
25
|
+
|
26
|
+
bundler_version = nil
|
27
|
+
update_index = nil
|
28
|
+
ARGV.each_with_index do |a, i|
|
29
|
+
bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
30
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
31
|
+
|
32
|
+
bundler_version = Regexp.last_match(1) || '>= 0.a'
|
33
|
+
update_index = i
|
34
|
+
end
|
35
|
+
bundler_version
|
36
|
+
end
|
37
|
+
|
38
|
+
def gemfile
|
39
|
+
gemfile = ENV['BUNDLE_GEMFILE']
|
40
|
+
return gemfile if gemfile.present?
|
41
|
+
|
42
|
+
File.expand_path('../Gemfile', __dir__)
|
43
|
+
end
|
44
|
+
|
45
|
+
def lockfile
|
46
|
+
lockfile =
|
47
|
+
case File.basename(gemfile)
|
48
|
+
when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile)
|
49
|
+
else "#{gemfile}.lock"
|
50
|
+
end
|
51
|
+
File.expand_path(lockfile)
|
52
|
+
end
|
53
|
+
|
54
|
+
def lockfile_version
|
55
|
+
return unless File.file?(lockfile)
|
56
|
+
|
57
|
+
lockfile_contents = File.read(lockfile)
|
58
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
59
|
+
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||= begin
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version || "#{Gem::Requirement.default}.a"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def load_bundler!
|
71
|
+
ENV['BUNDLE_GEMFILE'] ||= gemfile
|
72
|
+
|
73
|
+
# must dup string for RG < 1.8 compatibility
|
74
|
+
activate_bundler(bundler_version.dup)
|
75
|
+
end
|
76
|
+
|
77
|
+
def activate_bundler(bundler_version)
|
78
|
+
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new('2.0')
|
79
|
+
bundler_version = '< 2'
|
80
|
+
end
|
81
|
+
gem_error = activation_error_handling do
|
82
|
+
gem 'bundler', bundler_version
|
83
|
+
end
|
84
|
+
return if gem_error.nil?
|
85
|
+
|
86
|
+
require_error = activation_error_handling do
|
87
|
+
require 'bundler/version'
|
88
|
+
end
|
89
|
+
if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
90
|
+
return
|
91
|
+
end
|
92
|
+
|
93
|
+
# rubocop:disable Metrics/LineLength
|
94
|
+
warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
|
95
|
+
# rubocop:enable Metrics/LineLength
|
96
|
+
exit 42
|
97
|
+
end
|
98
|
+
|
99
|
+
def activation_error_handling
|
100
|
+
yield
|
101
|
+
nil
|
102
|
+
rescue StandardError, LoadError => e
|
103
|
+
e
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
m.load_bundler!
|
108
|
+
|
109
|
+
load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script?
|
data/bin/publish
ADDED
data/bin/rake
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'rubygems'
|
25
|
+
require 'bundler/setup'
|
26
|
+
|
27
|
+
load Gem.bin_path('rake', 'rake')
|
data/bin/setup
ADDED
data/default.yml
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require: rubocop-rails
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.6.5
|
5
|
+
Exclude:
|
6
|
+
- 'db/schema.rb'
|
7
|
+
- 'lib/tasks/auto_annotate_models.rake'
|
8
|
+
- 'lib/twirp/**/*'
|
9
|
+
|
10
|
+
# Eats a lot of the upper section space
|
11
|
+
Style/FrozenStringLiteralComment:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
# Why not?
|
15
|
+
Style/LambdaCall:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
# Sometimes can be useful to chain blocks
|
19
|
+
Style/MultilineBlockChain:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
# Don't think we should document any files
|
23
|
+
Style/Documentation:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
# Class::() {} - looks fine to me
|
27
|
+
Style/ColonMethodCall:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
# Eats the indentation level
|
31
|
+
Style/ClassAndModuleChildren:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
# Писать комменты на русском
|
35
|
+
Style/AsciiComments:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Security/Eval:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
# Specs size could be enormous
|
42
|
+
Metrics/BlockLength:
|
43
|
+
Exclude:
|
44
|
+
- spec/**/*_spec.rb
|
45
|
+
|
46
|
+
Metrics/LineLength:
|
47
|
+
Max: 120
|
48
|
+
|
49
|
+
# TODO need to agree
|
50
|
+
Metrics/CyclomaticComplexity:
|
51
|
+
Max: 10
|
52
|
+
|
53
|
+
# TODO need to agree
|
54
|
+
Metrics/MethodLength:
|
55
|
+
Max: 20
|
56
|
+
|
57
|
+
# TODO need to agree
|
58
|
+
Metrics/PerceivedComplexity:
|
59
|
+
Max: 20
|
60
|
+
|
61
|
+
Metrics/AbcSize:
|
62
|
+
Max: 20
|
63
|
+
|
64
|
+
# Offense count: 85
|
65
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
66
|
+
# ExcludedMethods: refine
|
67
|
+
Metrics/BlockLength:
|
68
|
+
Max: 203
|
69
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'talent_tech/style/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.author = 'TalentTech Team'
|
7
|
+
spec.name = 'tt_ruby_style'
|
8
|
+
spec.version = TalentTech::Style::VERSION
|
9
|
+
spec.date = '2020-03-26'
|
10
|
+
spec.summary = 'TalentTech rules for rubocop'
|
11
|
+
spec.require_paths = ['lib']
|
12
|
+
|
13
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
14
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
15
|
+
if spec.respond_to?(:metadata)
|
16
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
17
|
+
else
|
18
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
19
|
+
'public gem pushes.'
|
20
|
+
end
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
f.match(%r{^(test|spec|features)/})
|
24
|
+
end
|
25
|
+
spec.bindir = 'exe'
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
|
28
|
+
spec.add_dependency 'rubocop', '~> 0.77.0'
|
29
|
+
spec.add_dependency 'rubocop-rails', '~> 2.4.1'
|
30
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
31
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
32
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tt_ruby_style
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TalentTech Team
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
@@ -71,10 +71,27 @@ email:
|
|
71
71
|
executables: []
|
72
72
|
extensions: []
|
73
73
|
extra_rdoc_files: []
|
74
|
-
files:
|
74
|
+
files:
|
75
|
+
- ".gitignore"
|
76
|
+
- ".rubocop.yml"
|
77
|
+
- Gemfile
|
78
|
+
- Makefile
|
79
|
+
- README.md
|
80
|
+
- RELEASING.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/build
|
83
|
+
- bin/bundle
|
84
|
+
- bin/publish
|
85
|
+
- bin/rake
|
86
|
+
- bin/setup
|
87
|
+
- default.yml
|
88
|
+
- lib/talent_tech/style.rb
|
89
|
+
- lib/talent_tech/style/version.rb
|
90
|
+
- tt_ruby_style.gemspec
|
75
91
|
homepage:
|
76
92
|
licenses: []
|
77
|
-
metadata:
|
93
|
+
metadata:
|
94
|
+
allowed_push_host: https://rubygems.org
|
78
95
|
post_install_message:
|
79
96
|
rdoc_options: []
|
80
97
|
require_paths:
|