boxt_ruby_style_guide 7.7.3 → 7.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -10
- data/VERSION +1 -1
- data/lib/boxt_ruby_style_guide/git_diff.rb +1 -1
- data/lib/tasks/lint.rake +11 -36
- metadata +30 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e8f3ee70573d3493385981a232a6b08389bdf815827b097aa7a24478f7e5a80
|
4
|
+
data.tar.gz: 7a7fede5a038a4e0b764b3ad629d83bafeeed03d9b980c4b851baefbf777c45a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffe098e6a1fa3323b8897fbf5cdbff05b0e4e37d66988fdecb15a0f866b7e110c430f6ce427bc15c7ce82fa9a4165029ee514788046c451ea271b6fa65a78bdd
|
7
|
+
data.tar.gz: 3a090c5cd4ce2bd4055866e9587842a759800b580c4cc196bc936c5005da60052789e117153bb3bb38175d6197176c6a5fba54ab193c5daea931f16dde00ae63
|
data/README.md
CHANGED
@@ -24,13 +24,6 @@ And then execute:
|
|
24
24
|
bundle
|
25
25
|
```
|
26
26
|
|
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
27
|
Rails apps should have access to the lint tasks by default.
|
35
28
|
|
36
29
|
## Usage
|
@@ -75,14 +68,14 @@ Lint tasks to run against files listed as changed by Git.
|
|
75
68
|
To run `rubocop` against any changed files use:
|
76
69
|
|
77
70
|
```sh
|
78
|
-
|
71
|
+
RUBOCOP_LINT_BASE=your-base-branch rake lint:rubocop
|
79
72
|
```
|
80
73
|
|
81
74
|
To run `rubocop` with autofix, use one of the following:
|
82
75
|
|
83
76
|
```sh
|
84
|
-
|
85
|
-
|
77
|
+
RUBOCOP_LINT_BASE=your-base-branch rake lint:rubocop -a
|
78
|
+
RUBOCOP_LINT_BASE=your-base-branch rake lint:rubocop -A
|
86
79
|
```
|
87
80
|
|
88
81
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.8.0
|
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.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boxt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-28 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.4.2
|
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.4.2
|
61
41
|
- !ruby/object:Gem::Dependency
|
62
42
|
name: rubocop-faker
|
63
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,14 +72,14 @@ dependencies:
|
|
92
72
|
requirements:
|
93
73
|
- - '='
|
94
74
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
75
|
+
version: 2.0.0
|
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:
|
82
|
+
version: 2.0.0
|
103
83
|
- !ruby/object:Gem::Dependency
|
104
84
|
name: bundler
|
105
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +122,26 @@ dependencies:
|
|
142
122
|
- - ">="
|
143
123
|
- !ruby/object:Gem::Version
|
144
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '5'
|
132
|
+
- - "<"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '7'
|
135
|
+
type: :development
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '5'
|
142
|
+
- - "<"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '7'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: rake
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|