boxt_ruby_style_guide 7.3.0 → 7.4.0
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 +4 -4
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/boxt_ruby_style_guide.rb +7 -11
- data/lib/boxt_ruby_style_guide/railtie.rb +1 -1
- data/lib/tasks/lint.rake +62 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00a10b1e139e15aa28f133847e8a102bba235fd15840b8da636cc2658cbbd821
|
4
|
+
data.tar.gz: '0683e861cc45e0177b5e9f96c4ac05e47ae77b99314978463fa9178da217277d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65c4b44b3a1eb0077bcaf1dc2be3035439fd7b9b0771409f1b02483ac81f5d2b744768f6901206e600f9cbb3fec0743ef585e52f89fabac58250ebcfc44b6891
|
7
|
+
data.tar.gz: 3d3b1cc9df23483d023e55b1029e47d98cfdc62982c366f8992b5ef6ee95077f216f9368498447d478c9ebe7530cd7e2e1fb94c5147702c706409e369a2f8ed1
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.4.0
|
@@ -4,17 +4,13 @@ require "boxt_ruby_style_guide/railtie" if defined?(Rails)
|
|
4
4
|
require "boxt_ruby_style_guide/version"
|
5
5
|
|
6
6
|
module BoxtRubyStyleGuide
|
7
|
-
|
8
|
-
def install_tasks
|
9
|
-
Dir[File.join(gem_spec.gem_dir, "tasks/*.rake")].each do |file|
|
10
|
-
load(file)
|
11
|
-
end
|
12
|
-
end
|
7
|
+
module_function
|
13
8
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
##
|
10
|
+
# Provide a root path helper for the gem root dir
|
11
|
+
#
|
12
|
+
# Returns Pathname
|
13
|
+
def root
|
14
|
+
Pathname.new(File.dirname(__dir__))
|
19
15
|
end
|
20
16
|
end
|
@@ -5,7 +5,7 @@ require "rails"
|
|
5
5
|
module BoxtRubyStyleGuide
|
6
6
|
class Railtie < Rails::Railtie
|
7
7
|
rake_tasks do
|
8
|
-
files =
|
8
|
+
files = BoxtRubyStyleGuide.root.join("lib", "tasks", "*.rake")
|
9
9
|
Dir[files].each { |file| load(file) }
|
10
10
|
end
|
11
11
|
end
|
data/lib/tasks/lint.rake
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "boxt_ruby_style_guide"
|
4
|
+
require "rubocop"
|
5
|
+
|
6
|
+
##
|
7
|
+
# The base branch to compare HEAD with for changes
|
8
|
+
BASE_BRANCH = "develop"
|
9
|
+
|
10
|
+
##
|
11
|
+
# Directories containing Ruby files to lint
|
12
|
+
RUBY_DIRS = %w[app lib test spec].freeze
|
13
|
+
|
14
|
+
##
|
15
|
+
# Grep file pattern to make sure we only check files that are Ruby files
|
16
|
+
# This pattern matches the following:
|
17
|
+
#
|
18
|
+
# - Gemfile
|
19
|
+
# - Rakefile
|
20
|
+
# - *.gemspec
|
21
|
+
# - app/**/*.{rb,rake}
|
22
|
+
# - lib/**/*.{rb,rake}
|
23
|
+
# - test/**/*.{rb,rake}
|
24
|
+
# - spec/**/*.{rb,rake}
|
25
|
+
#
|
26
|
+
GREP_PATTERN = <<~STRING.delete("\n")
|
27
|
+
(
|
28
|
+
(#{RUBY_DIRS.join('|')})\\/.+\\.(rb|rake)
|
29
|
+
|^
|
30
|
+
(Gemfile|Rakefile|.+\\.gemspec)
|
31
|
+
)
|
32
|
+
STRING
|
33
|
+
|
34
|
+
namespace :lint do
|
35
|
+
desc "Runs rubocop against all files with committed changes different from base branch"
|
36
|
+
task :rubocop do
|
37
|
+
exec("rubocop #{diff_file_paths};")
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# A list of the local file paths of Ruby files with committed changes.
|
43
|
+
#
|
44
|
+
# Run a git diff-tree command with the following otions:
|
45
|
+
# -r recursive
|
46
|
+
# --name-only Only return the name of the files
|
47
|
+
# --diff-filter Filter out results that have been deleted on HEAD
|
48
|
+
#
|
49
|
+
# Pipe the output from this command through grep to match only Ruby files in the
|
50
|
+
# desired directories
|
51
|
+
#
|
52
|
+
# Returns String
|
53
|
+
def diff_file_paths
|
54
|
+
base_branch = ENV.fetch("RUBOCOP_LINT_BASE", BASE_BRANCH)
|
55
|
+
command = <<~BASH
|
56
|
+
git diff-tree -r --name-only --diff-filter=d #{base_branch} HEAD \
|
57
|
+
| egrep '#{GREP_PATTERN}'
|
58
|
+
BASH
|
59
|
+
file_paths = `#{command}`
|
60
|
+
file_paths.gsub(/\n|\r/, " ")
|
61
|
+
end
|
62
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4.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-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.92.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rubocop-faker
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +142,14 @@ dependencies:
|
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0.
|
145
|
+
version: '0.19'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0.
|
152
|
+
version: '0.19'
|
139
153
|
description: Ruby styleguide info for the BOXT projects, as well as config settings
|
140
154
|
for Rubocop
|
141
155
|
email:
|
@@ -152,6 +166,7 @@ files:
|
|
152
166
|
- lib/boxt_ruby_style_guide.rb
|
153
167
|
- lib/boxt_ruby_style_guide/railtie.rb
|
154
168
|
- lib/boxt_ruby_style_guide/version.rb
|
169
|
+
- lib/tasks/lint.rake
|
155
170
|
- pending.yml
|
156
171
|
- rails-pending.yml
|
157
172
|
- rails.yml
|