boxt_ruby_style_guide 7.7.3 → 7.9.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb14b8f791b4feded3f27f40c3bb50de7087c97f6c68177831a0d480e52e3860
4
- data.tar.gz: db0f26c2a9cd3f5dc8137a74c03819f0744a09c64be7cdad45eb250994dd2ee3
3
+ metadata.gz: 2db56c662e2552cc18fdaff88a4d87d38efa019a2286332cb2867a20f214ef85
4
+ data.tar.gz: '03295724dfeb6cf863965794a1624b927f5e420120870d19d237be2267467099'
5
5
  SHA512:
6
- metadata.gz: 07e967593138ce3ac4fe0aea5f6eca2a53c46611e2a3694a3a582abd0d5e52fcbb1a461d8e3917d2fecdae8529f70be656bc849bdaed13391695cfa6f2c027ca
7
- data.tar.gz: 301463c3158cc8f859b408fbf8a0fc8a4c4cb8bcb102d64d7af2ab0a53d606753c1b61e574b6cea6eaa8d4ce1b44b44358ad8b59a349e21886889737b5725155
6
+ metadata.gz: 35a3f32bfee456654c65251d1b8e523586a92ae947af90b391e0559f7d6556eac28b80e1c434a6baf35ca3355e976efa192f3dabfdad195c84d198dd3af3899b
7
+ data.tar.gz: c6f958abf9b2c5fd0beaaf72f3ddf5a31a6bec143258519412554b56e1fc83a5015893f629ea836de85e77b7a7708b6834c87f9307b30b1f000ffbcffbf3a4d8
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
- rake lint:rubocop RUBOCOP_LINT_BASE=your-base-branch
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
- rake lint:rubocop_a RUBOCOP_LINT_BASE=your-base-branch
85
- rake lint:rubocop_A RUBOCOP_LINT_BASE=your-base-branch
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
@@ -10,4 +10,5 @@ RSpec::Core::RakeTask.new(:spec) do |t|
10
10
  t.pattern = Dir.glob("spec/**/*_spec.rb")
11
11
  end
12
12
 
13
+ desc "Map rake test to rake spec"
13
14
  task test: :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.7.3
1
+ 7.9.3
@@ -15,7 +15,7 @@ module BoxtRubyStyleGuide
15
15
 
16
16
  attr_reader :base
17
17
 
18
- def initialize(base = "master")
18
+ def initialize(base:)
19
19
  @base = base
20
20
  end
21
21
 
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
- Rake::Task[RUBOCOP_TASK_NAME].invoke
25
- end
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
- task :execute_rubocop, [:auto_flag] do |_t, args|
38
- if sanitized_file_paths.any?
39
- # Sanitize args to make sure only a single "a" or "A" is accepted
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 matching Ruby files changed"
18
+ puts "No Ruby files changed"
44
19
  end
45
20
  end
46
21
  end
47
22
 
48
23
  private
49
24
 
50
- # Returns Array
25
+ # Returns an array of files
51
26
  def sanitized_file_paths
52
- base = ENV.fetch("RUBOCOP_LINT_BASE", BASE_BRANCH)
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.7.3
4
+ version: 7.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boxt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-23 00:00:00.000000000 Z
11
+ date: 2021-03-01 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.0
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.0
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: 0.92.0
33
+ version: 1.11.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: 0.92.0
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.11.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.8.1
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.8.1
68
+ version: 2.9.1
89
69
  - !ruby/object:Gem::Dependency
90
- name: rubocop-rspec
70
+ name: rubocop-rake
91
71
  requirement: !ruby/object:Gem::Requirement
92
72
  requirements:
93
73
  - - '='
94
74
  - !ruby/object:Gem::Version
95
- version: 1.43.2
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: 1.43.2
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: byebug
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: '0.19'
194
- type: :development
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: '0.19'
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: