boxt_ruby_style_guide 7.7.2 → 7.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -15
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/default.yml +1 -1
- data/lib/boxt_ruby_style_guide/git_diff.rb +1 -1
- data/lib/tasks/lint.rake +11 -36
- metadata +23 -127
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f80925ef4cebf042e32849792ad200553a71646704fba299a502940649b66cd4
|
4
|
+
data.tar.gz: 672f8b91fc0218521b17f5857235eef8eede17ba4c7812f4e4a9253030df079c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efac4d096f3d5772db668628c832a9df08e4e3756d2c62a7915063b9233b0ffa06768da9bebd92bc62053cdeadaae129bbd11d2f15c43c896eb1bd24a3020d55
|
7
|
+
data.tar.gz: e13776ce69c0bbd8102f41a9259d89dac66dcf5a7728960fbd3686352b14791e61032486680bf3fbc4aaa6372779bec78219a75fdaefa94e065f5d905a748fa0
|
data/README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
# BOXT Ruby Style Guide
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/boxt_ruby_style_guide.png)](https://badge.fury.io/rb/boxt_ruby_style_guide)
|
4
|
+
|
3
5
|
Ruby style guide and base Rubocop settings for Boxt Ruby projects.
|
4
6
|
|
5
7
|
For the most part we are using [this Ruby style guide](https://github.com/bbatsov/ruby-style-guide) as the base guide, with any deviations can be found in the `default.yml`.
|
6
8
|
|
7
|
-
[![Gem Version](https://badge.fury.io/rb/boxt_ruby_style_guide.png)](https://badge.fury.io/rb/boxt_ruby_style_guide)
|
8
|
-
[![CircleCI](https://circleci.com/gh/boxt/boxt_ruby_style_guide/tree/master.svg?style=svg)](https://circleci.com/gh/boxt/boxt_ruby_style_guide/tree/master)
|
9
|
-
|
10
9
|
## Installation
|
11
10
|
|
12
11
|
Add this line to your application's Gemfile:
|
@@ -24,15 +23,6 @@ And then execute:
|
|
24
23
|
bundle
|
25
24
|
```
|
26
25
|
|
27
|
-
To make the lint rake tasks available to non Rails apps and gems, add the following to the project's `Rakefile`:
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
require "boxt_ruby_style_guide"
|
31
|
-
BoxtRubyStyleGuide.install_tasks
|
32
|
-
```
|
33
|
-
|
34
|
-
Rails apps should have access to the lint tasks by default.
|
35
|
-
|
36
26
|
## Usage
|
37
27
|
|
38
28
|
Add a `.rubocop.yml` file to the root of your project with the following settings:
|
@@ -53,6 +43,7 @@ The following Rubocop gems are also installed with this gem:
|
|
53
43
|
|
54
44
|
* [rubocop-faker](https://github.com/koic/rubocop-faker)
|
55
45
|
* [rubocop-rails](https://github.com/rubocop-hq/rubocop-rails)
|
46
|
+
* [rubocop-rake](https://github.com/rubocop-hq/rubocop-rake)
|
56
47
|
* [rubocop-rspec](https://github.com/rubocop-hq/rubocop-rspec)
|
57
48
|
|
58
49
|
To enable add the following to your `.rubocop.yml` file.
|
@@ -65,6 +56,7 @@ inherit_gem:
|
|
65
56
|
require:
|
66
57
|
- rubocop-faker # if your project is using the Faker gem then add this
|
67
58
|
- rubocop-rails # if your project is a Rails app/engine then add this, plus the - rails.yml setting above
|
59
|
+
- rubocop-rake # if your project is using rake then add this
|
68
60
|
- rubocop-rspec # if your project is using rspec then add this, plus the - rspec.yml setting above
|
69
61
|
```
|
70
62
|
|
@@ -75,14 +67,14 @@ Lint tasks to run against files listed as changed by Git.
|
|
75
67
|
To run `rubocop` against any changed files use:
|
76
68
|
|
77
69
|
```sh
|
78
|
-
|
70
|
+
RUBOCOP_LINT_BASE=your-base-branch rake lint:rubocop
|
79
71
|
```
|
80
72
|
|
81
73
|
To run `rubocop` with autofix, use one of the following:
|
82
74
|
|
83
75
|
```sh
|
84
|
-
|
85
|
-
|
76
|
+
RUBOCOP_LINT_BASE=your-base-branch rake lint:rubocop -a
|
77
|
+
RUBOCOP_LINT_BASE=your-base-branch rake lint:rubocop -A
|
86
78
|
```
|
87
79
|
|
88
80
|
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.9.2
|
data/default.yml
CHANGED
data/lib/tasks/lint.rake
CHANGED
@@ -1,55 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "boxt_ruby_style_guide"
|
4
|
-
require "rubocop"
|
5
|
-
|
6
|
-
require "boxt_ruby_style_guide/git_diff"
|
7
4
|
require "boxt_ruby_style_guide/filepath_matcher"
|
8
|
-
|
9
|
-
|
10
|
-
# The base branch to compare HEAD with for changes
|
11
|
-
BASE_BRANCH = "develop"
|
12
|
-
|
13
|
-
##
|
14
|
-
# Name of the master Rubocop lint task to run
|
15
|
-
RUBOCOP_TASK_NAME = :"lint:execute_rubocop"
|
16
|
-
|
17
|
-
##
|
18
|
-
# Pattern for matching autofix options
|
19
|
-
AUTO_REGEX = /\A-a\Z/i.freeze
|
5
|
+
require "boxt_ruby_style_guide/git_diff"
|
6
|
+
require "rubocop"
|
20
7
|
|
21
8
|
namespace :lint do
|
22
9
|
desc "Runs rubocop against all files with committed changes different from base branch"
|
23
10
|
task :rubocop do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
desc "Runs rubocop against all files using -a (soft autofix) option"
|
28
|
-
task :rubocop_a do
|
29
|
-
Rake::Task[RUBOCOP_TASK_NAME].invoke("-a")
|
30
|
-
end
|
31
|
-
|
32
|
-
desc "Runs rubocop against all files using -A (hard autofix) option"
|
33
|
-
task :rubocop_A do
|
34
|
-
Rake::Task[RUBOCOP_TASK_NAME].invoke("-A")
|
35
|
-
end
|
11
|
+
file_paths = sanitized_file_paths
|
12
|
+
puts "File paths: #{file_paths.join(', ')}"
|
36
13
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
auto_flag = AUTO_REGEX.match(args[:auto_flag])
|
41
|
-
exec("bundle exec rubocop #{sanitized_file_paths.join(" ")} #{auto_flag}".strip)
|
14
|
+
if file_paths.any?
|
15
|
+
auto_flag_opt = ARGV.select { |a| ["-a", "-A"].include?(a) }.first
|
16
|
+
exec("bundle exec rubocop #{file_paths.join(' ')} #{auto_flag_opt}".strip)
|
42
17
|
else
|
43
|
-
puts "No
|
18
|
+
puts "No Ruby files changed"
|
44
19
|
end
|
45
20
|
end
|
46
21
|
end
|
47
22
|
|
48
23
|
private
|
49
24
|
|
50
|
-
# Returns
|
25
|
+
# Returns an array of files
|
51
26
|
def sanitized_file_paths
|
52
|
-
base = ENV.fetch("RUBOCOP_LINT_BASE",
|
53
|
-
changed_files = BoxtRubyStyleGuide::GitDiff.new(base).all
|
27
|
+
base = ENV.fetch("RUBOCOP_LINT_BASE", "main")
|
28
|
+
changed_files = BoxtRubyStyleGuide::GitDiff.new(base: base).all
|
54
29
|
BoxtRubyStyleGuide::FilepathMatcher.new(*changed_files).all_matches
|
55
30
|
end
|
metadata
CHANGED
@@ -1,63 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boxt_ruby_style_guide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boxt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.4
|
19
|
+
version: '1.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.4
|
26
|
+
version: '1.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.10.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '5'
|
48
|
-
- - "<"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '7'
|
51
|
-
type: :development
|
52
|
-
prerelease: false
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - ">"
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '5'
|
58
|
-
- - "<"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '7'
|
40
|
+
version: 1.10.0
|
61
41
|
- !ruby/object:Gem::Dependency
|
62
42
|
name: rubocop-faker
|
63
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,126 +58,42 @@ dependencies:
|
|
78
58
|
requirements:
|
79
59
|
- - '='
|
80
60
|
- !ruby/object:Gem::Version
|
81
|
-
version: 2.
|
61
|
+
version: 2.9.1
|
82
62
|
type: :runtime
|
83
63
|
prerelease: false
|
84
64
|
version_requirements: !ruby/object:Gem::Requirement
|
85
65
|
requirements:
|
86
66
|
- - '='
|
87
67
|
- !ruby/object:Gem::Version
|
88
|
-
version: 2.
|
68
|
+
version: 2.9.1
|
89
69
|
- !ruby/object:Gem::Dependency
|
90
|
-
name: rubocop-
|
70
|
+
name: rubocop-rake
|
91
71
|
requirement: !ruby/object:Gem::Requirement
|
92
72
|
requirements:
|
93
73
|
- - '='
|
94
74
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
75
|
+
version: 0.5.1
|
96
76
|
type: :runtime
|
97
77
|
prerelease: false
|
98
78
|
version_requirements: !ruby/object:Gem::Requirement
|
99
79
|
requirements:
|
100
80
|
- - '='
|
101
81
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: bundler
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '2.1'
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '2.1'
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: bundler-audit
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 0.7.0.1
|
124
|
-
type: :development
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: 0.7.0.1
|
82
|
+
version: 0.5.1
|
131
83
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - ">="
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '0'
|
138
|
-
type: :development
|
139
|
-
prerelease: false
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - ">="
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '0'
|
145
|
-
- !ruby/object:Gem::Dependency
|
146
|
-
name: rake
|
147
|
-
requirement: !ruby/object:Gem::Requirement
|
148
|
-
requirements:
|
149
|
-
- - "~>"
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '13.0'
|
152
|
-
type: :development
|
153
|
-
prerelease: false
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - "~>"
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '13.0'
|
159
|
-
- !ruby/object:Gem::Dependency
|
160
|
-
name: rspec
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
162
|
-
requirements:
|
163
|
-
- - "~>"
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '3.9'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
requirements:
|
170
|
-
- - "~>"
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: '3.9'
|
173
|
-
- !ruby/object:Gem::Dependency
|
174
|
-
name: rspec-nc
|
175
|
-
requirement: !ruby/object:Gem::Requirement
|
176
|
-
requirements:
|
177
|
-
- - "~>"
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: '0.3'
|
180
|
-
type: :development
|
181
|
-
prerelease: false
|
182
|
-
version_requirements: !ruby/object:Gem::Requirement
|
183
|
-
requirements:
|
184
|
-
- - "~>"
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version: '0.3'
|
187
|
-
- !ruby/object:Gem::Dependency
|
188
|
-
name: simplecov
|
84
|
+
name: rubocop-rspec
|
189
85
|
requirement: !ruby/object:Gem::Requirement
|
190
86
|
requirements:
|
191
|
-
- -
|
87
|
+
- - '='
|
192
88
|
- !ruby/object:Gem::Version
|
193
|
-
version:
|
194
|
-
type: :
|
89
|
+
version: 2.2.0
|
90
|
+
type: :runtime
|
195
91
|
prerelease: false
|
196
92
|
version_requirements: !ruby/object:Gem::Requirement
|
197
93
|
requirements:
|
198
|
-
- -
|
94
|
+
- - '='
|
199
95
|
- !ruby/object:Gem::Version
|
200
|
-
version:
|
96
|
+
version: 2.2.0
|
201
97
|
description: Ruby styleguide info for the BOXT projects, as well as config settings
|
202
98
|
for Rubocop
|
203
99
|
email:
|
@@ -225,7 +121,7 @@ homepage: https://github.com/boxt/ruby-style-guide
|
|
225
121
|
licenses:
|
226
122
|
- MIT
|
227
123
|
metadata: {}
|
228
|
-
post_install_message:
|
124
|
+
post_install_message:
|
229
125
|
rdoc_options: []
|
230
126
|
require_paths:
|
231
127
|
- lib
|
@@ -240,8 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
136
|
- !ruby/object:Gem::Version
|
241
137
|
version: '0'
|
242
138
|
requirements: []
|
243
|
-
rubygems_version: 3.1.
|
244
|
-
signing_key:
|
139
|
+
rubygems_version: 3.1.4
|
140
|
+
signing_key:
|
245
141
|
specification_version: 4
|
246
142
|
summary: Ruby styleguide info for the BOXT Ruby projects
|
247
143
|
test_files: []
|