boxt_ruby_style_guide 7.7.0 → 7.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3269906781941588a2da2ed478c324852a270245e9aeb64cddc877835d6ede19
4
- data.tar.gz: 9b1255d5557fd33a70e3cb5f6fccf61d5c7ac44f37055bff8e193108927e00d8
3
+ metadata.gz: 1b20dbc0617054f0833a0ea820b2e2b52b33db8ab0d9be3f583d5eaa6ac4c8fd
4
+ data.tar.gz: cdadaee95107f3b2ae348c9dd8249dd8302b47a3a9cc06a023e4029f24ad858a
5
5
  SHA512:
6
- metadata.gz: d1ce04bee4be54bdc9b5bdb4fa55695d364e32546f0c7a0fa93fb458c72d38510cc48667f51809387e39ab12e37058592a3ac4ea3d43e7910177e17f2da6179b
7
- data.tar.gz: 4516330c35be5df90616fa65cf8370afa368b441fe3d495da0e5b9542bafd12d0218b1a331eeaa3c548cf93d3ea4f1a26098c5ad7da25ff6b8906dd5b4f543b6
6
+ metadata.gz: 4a80294c77bd1a084f6d407fa81b4df31a9a880a3ba6d32898162fa60df09cdc16fe16b770954b4ded58d73d115721a901965155c3f66c20a84a6c52552c7bc4
7
+ data.tar.gz: bab04c5492332e6610e26f682b3d6b17bfdd741bf2321b063cf4b9bb2fafb09fdec0bb18df00feb3ab3b8c92ee15510d48a82ff0ec478535a31fccbe79e29969
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.0
1
+ 7.9.1
data/default.yml CHANGED
@@ -1,11 +1,11 @@
1
1
  AllCops:
2
2
  Exclude:
3
3
  - "**/*/schema.rb"
4
- - Gemfile.lock
5
- - node_modules/**/*
6
- - tmp/**/*
7
- - vendor/**/*
8
- TargetRubyVersion: 2.7.1
4
+ - "Gemfile.lock"
5
+ - "node_modules/**/*"
6
+ - "tmp/**/*"
7
+ - "vendor/**/*"
8
+ TargetRubyVersion: 2.7.2
9
9
  Layout/LineLength:
10
10
  Exclude:
11
11
  - config/routes.rb
@@ -9,7 +9,7 @@ module BoxtRubyStyleGuide
9
9
  ##
10
10
  # Compare a given filepath with a grep-style filename pattern
11
11
  FILEPATH_PATTERN_MATCH = proc do |filepath, pattern|
12
- File.fnmatch(pattern, filepath)
12
+ File.fnmatch(pattern, filepath, File::FNM_PATHNAME)
13
13
  end
14
14
 
15
15
  ##
@@ -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 $RUBOCOP_CHANGED_FILES #{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.0
4
+ version: 7.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boxt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-19 00:00:00.000000000 Z
11
+ date: 2021-02-02 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.9.1
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.9.1
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.1.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.1.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.2
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: []