va-ruby-style 0.0.1
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 +4 -0
- data/.rubocop.yml +9 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +38 -0
- data/LICENSE +21 -0
- data/README.md +66 -0
- data/bin/va_ruby_style +5 -0
- data/default.yml +89 -0
- data/lib/va-ruby-style.rb +3 -0
- data/lib/va_ruby_style.rb +4 -0
- data/lib/va_ruby_style/cli.rb +14 -0
- data/lib/va_ruby_style/generators/files/default_setup.yml +3 -0
- data/lib/va_ruby_style/generators/setup.rb +21 -0
- data/release +9 -0
- data/va-ruby-style.gemspec +24 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d0edcc62d1c82874a8a8acb2daeacd18bcffec45
|
4
|
+
data.tar.gz: e080bb924137cbf2a793f4a4bda3218c3a9d3c6a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3c386f3935df97e12d9fc98e6f6adacfb2effd913a10898c6c70a71191d6d6bd0a2b379caf1fc865f202eef6f976ebe4e55bbe7539b81a998f0a8b43f1543fd9
|
7
|
+
data.tar.gz: 999d16cd5bd6ee7a6f62ba8ffd8e1a031640295683202c56a7d4fb48a39f07e20c966ec9bd4d9a87b83e2eed67ecde3447dedf36ea3bc007c6203b8531976381
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
va-ruby-style (0.0.0)
|
5
|
+
rubocop (= 0.55.0)
|
6
|
+
thor (= 0.19.4)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.0)
|
12
|
+
byebug (9.1.0)
|
13
|
+
parallel (1.12.1)
|
14
|
+
parser (2.5.1.2)
|
15
|
+
ast (~> 2.4.0)
|
16
|
+
powerpack (0.1.2)
|
17
|
+
rainbow (3.0.0)
|
18
|
+
rubocop (0.55.0)
|
19
|
+
parallel (~> 1.10)
|
20
|
+
parser (>= 2.5)
|
21
|
+
powerpack (~> 0.1)
|
22
|
+
rainbow (>= 2.2.2, < 4.0)
|
23
|
+
ruby-progressbar (~> 1.7)
|
24
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
25
|
+
ruby-progressbar (1.10.0)
|
26
|
+
thor (0.19.4)
|
27
|
+
unicode-display_width (1.4.0)
|
28
|
+
|
29
|
+
PLATFORMS
|
30
|
+
ruby
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
bundler (~> 1.12)
|
34
|
+
byebug (~> 9.1)
|
35
|
+
va-ruby-style!
|
36
|
+
|
37
|
+
BUNDLED WITH
|
38
|
+
1.16.0
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Pedro Matos Monteiro
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# va-ruby-style
|
2
|
+
|
3
|
+
This is a ruby gem that holds Visible Alpha's default set of coding style rules. It's basically a `rubocop` wrapper designed with the purpose of sharing a common set of rules across multiple ruby projects.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem directly:
|
8
|
+
```
|
9
|
+
gem install va-ruby-style
|
10
|
+
```
|
11
|
+
|
12
|
+
Or add it to your `Gemfile`:
|
13
|
+
```
|
14
|
+
gem 'va-ruby-style'
|
15
|
+
```
|
16
|
+
|
17
|
+
## Setup
|
18
|
+
|
19
|
+
The gem can be easily set up both in new or existing projects (even if already using `rubocop` directly), although the configuration process will be slightly different.
|
20
|
+
|
21
|
+
### New projects
|
22
|
+
|
23
|
+
This is the easiest form: simply add the gem to the project's `Gemfile` and run `va-ruby-style init`. This command will create the project's `.rubocop.yml` file.
|
24
|
+
|
25
|
+
From this moment, we're able to use `rubocop` normally and check if all files follow the specified base style rules.
|
26
|
+
|
27
|
+
### Existing projects
|
28
|
+
|
29
|
+
For existing projects, the process will be slightly different since a `.rubocop.yml` file might already exist.
|
30
|
+
|
31
|
+
The `init` command will not overwrite existing rubocop configuration files so, the existing `.rubocop.yml` should be removed before running the `va-ruby-style init` command. In addition to that, `rubocop` should be removed from the `Gemfile`, since it's no longer a direct project dependency.
|
32
|
+
|
33
|
+
After that, the following `rubocop` commands should be run:
|
34
|
+
|
35
|
+
1. `rubocop -a` to fix any offenses that can be automatically fixed in the existing files (according to the new set of rules);
|
36
|
+
2. `rubocop --auto-gen-config` to add offenses that can't be automatically fixed to the `rubocop_todo.yml` file.
|
37
|
+
|
38
|
+
**Note:** Rules should not be disabled/enabled directly in project files, where an offense occurs. The `rubocop_todo.yml` file should be used to centralize all existing and pending offenses instead.
|
39
|
+
|
40
|
+
## Extending the default set of rules
|
41
|
+
|
42
|
+
The generated `.rubocop.yml` file includes a default set of rules set in the gem's `default.yml` file. These rules can be changed and/or new rules can be added to a specific project though.
|
43
|
+
|
44
|
+
In order to add a new rule (not included in the default set of rules), simply add it after the `inherit_gem` setup:
|
45
|
+
|
46
|
+
```
|
47
|
+
inherit_gem:
|
48
|
+
va-ruby-style:
|
49
|
+
- default.yml
|
50
|
+
|
51
|
+
ProjectSpecificRule:
|
52
|
+
Enabled: true
|
53
|
+
```
|
54
|
+
|
55
|
+
To extend and/or modify an existing rule, reference it and add the necessary modifiers (Ex.: exclude particular files):
|
56
|
+
|
57
|
+
```
|
58
|
+
inherit_gem:
|
59
|
+
va-ruby-style:
|
60
|
+
- default.yml
|
61
|
+
|
62
|
+
Style/MethodCallWithArgsParentheses:
|
63
|
+
Exclude:
|
64
|
+
- 'Gemfile'
|
65
|
+
- 'db/migrate/*'
|
66
|
+
```
|
data/bin/va_ruby_style
ADDED
data/default.yml
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
3
|
+
DisplayCopNames: true
|
4
|
+
DisplayStyleGuide: true
|
5
|
+
|
6
|
+
Rails:
|
7
|
+
Enabled: true
|
8
|
+
|
9
|
+
Rails/HasAndBelongsToMany:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Rails/SkipsModelValidations:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Rails/HasManyOrHasOneDependent:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Rails/InverseOf:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/Documentation:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Naming/MethodName:
|
25
|
+
EnforcedStyle: snake_case
|
26
|
+
|
27
|
+
Layout/SpaceBeforeBlockBraces:
|
28
|
+
EnforcedStyle: space
|
29
|
+
EnforcedStyleForEmptyBraces: space
|
30
|
+
|
31
|
+
Layout/AlignParameters:
|
32
|
+
EnforcedStyle: with_fixed_indentation
|
33
|
+
|
34
|
+
Layout/TrailingBlankLines:
|
35
|
+
EnforcedStyle: final_newline
|
36
|
+
|
37
|
+
Layout/FirstMethodArgumentLineBreak:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
Layout/MultilineMethodCallBraceLayout:
|
41
|
+
EnforcedStyle: new_line
|
42
|
+
|
43
|
+
Layout/MultilineMethodCallIndentation:
|
44
|
+
EnforcedStyle: indented
|
45
|
+
|
46
|
+
Layout/IndentHash:
|
47
|
+
EnforcedStyle: consistent
|
48
|
+
|
49
|
+
Layout/IndentArray:
|
50
|
+
EnforcedStyle: consistent
|
51
|
+
|
52
|
+
Layout/ExtraSpacing:
|
53
|
+
AllowForAlignment: false
|
54
|
+
|
55
|
+
Style/SymbolArray:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Style/EmptyMethod:
|
59
|
+
EnforcedStyle: expanded
|
60
|
+
|
61
|
+
Style/FormatStringToken:
|
62
|
+
EnforcedStyle: unannotated
|
63
|
+
|
64
|
+
Style/IfUnlessModifier:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
Style/TrailingCommaInArrayLiteral:
|
68
|
+
EnforcedStyleForMultiline: comma
|
69
|
+
|
70
|
+
Style/TrailingCommaInHashLiteral:
|
71
|
+
EnforcedStyleForMultiline: comma
|
72
|
+
|
73
|
+
Style/TrailingCommaInArguments:
|
74
|
+
EnforcedStyleForMultiline: comma
|
75
|
+
|
76
|
+
Style/MethodCallWithArgsParentheses:
|
77
|
+
Enabled: true
|
78
|
+
IgnoredMethods: [
|
79
|
+
'require',
|
80
|
+
'require_relative',
|
81
|
+
'run',
|
82
|
+
'raise',
|
83
|
+
'throw',
|
84
|
+
'yield',
|
85
|
+
'receive',
|
86
|
+
'to',
|
87
|
+
'not_to',
|
88
|
+
'to_not',
|
89
|
+
]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'va_ruby_style/generators/setup'
|
5
|
+
|
6
|
+
module VARubyStyle
|
7
|
+
class CLI < Thor
|
8
|
+
|
9
|
+
desc 'init', 'Setup the project to start using visible alpha\'s ruby style'
|
10
|
+
def init
|
11
|
+
VARubyStyle::Generators::Setup.create_default_setup_file
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module VARubyStyle
|
6
|
+
module Generators
|
7
|
+
class Setup
|
8
|
+
def self.create_default_setup_file
|
9
|
+
working_dir = File.expand_path(Dir.pwd)
|
10
|
+
dest_file = "#{working_dir}/.rubocop.yml"
|
11
|
+
|
12
|
+
if File.file?(dest_file)
|
13
|
+
puts('.rubocop.yml already exists.')
|
14
|
+
else
|
15
|
+
src_file = File.dirname(__FILE__) + '/files/default_setup.yml'
|
16
|
+
FileUtils.copy_file(src_file, dest_file)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/release
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
cp va-ruby-style.gemspec va-ruby-style.gemspec.backup
|
3
|
+
sed -i.bak s/0.0.0/$1/g va-ruby-style.gemspec
|
4
|
+
sed -i.bak s/2001-01-01/`date +%Y-%m-%d`/g va-ruby-style.gemspec
|
5
|
+
gem build va-ruby-style.gemspec
|
6
|
+
mv va-ruby-style.gemspec.backup va-ruby-style.gemspec
|
7
|
+
gem push va-ruby-style-$1.gem
|
8
|
+
git tag -a v$1 -m "Release v$1"
|
9
|
+
git push origin --tags
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'va-ruby-style'
|
5
|
+
s.version = '0.0.1'
|
6
|
+
s.date = '2018-11-10'
|
7
|
+
s.summary = 'Visible Alpha\'s ruby style'
|
8
|
+
s.description = 'Visible Alpha\'s ruby style keeps a centralized set of linter rules for the ruby programming language.'
|
9
|
+
s.homepage = 'https://github.com/AlphaExchange/va-ruby-style'
|
10
|
+
s.authors = ['Pedro Monteiro']
|
11
|
+
s.email = ['pedro.monteiro@visiblealpha.com']
|
12
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
13
|
+
s.executables = `git ls-files`.split("\n").map{ |f| f =~ /^bin\/(.*)/ ? $1 : nil }.compact
|
14
|
+
s.require_paths = ['lib']
|
15
|
+
s.license = 'MIT'
|
16
|
+
|
17
|
+
s.required_ruby_version = '>= 2.2.2'
|
18
|
+
|
19
|
+
s.add_dependency 'rubocop', '0.55.0'
|
20
|
+
s.add_dependency 'thor', '0.19.4'
|
21
|
+
|
22
|
+
s.add_development_dependency 'bundler', '~> 1.12'
|
23
|
+
s.add_development_dependency 'byebug', '~> 9.1'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: va-ruby-style
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pedro Monteiro
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-11-10 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.55.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.55.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.19.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.19.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '9.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '9.1'
|
69
|
+
description: Visible Alpha's ruby style keeps a centralized set of linter rules for
|
70
|
+
the ruby programming language.
|
71
|
+
email:
|
72
|
+
- pedro.monteiro@visiblealpha.com
|
73
|
+
executables:
|
74
|
+
- va_ruby_style
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- ".rubocop.yml"
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
82
|
+
- LICENSE
|
83
|
+
- README.md
|
84
|
+
- bin/va_ruby_style
|
85
|
+
- default.yml
|
86
|
+
- lib/va-ruby-style.rb
|
87
|
+
- lib/va_ruby_style.rb
|
88
|
+
- lib/va_ruby_style/cli.rb
|
89
|
+
- lib/va_ruby_style/generators/files/default_setup.yml
|
90
|
+
- lib/va_ruby_style/generators/setup.rb
|
91
|
+
- release
|
92
|
+
- va-ruby-style.gemspec
|
93
|
+
homepage: https://github.com/AlphaExchange/va-ruby-style
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 2.2.2
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.5.2
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: Visible Alpha's ruby style
|
117
|
+
test_files: []
|