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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db37fda2704f058428f66ef3227058dc67c4abd08df1829c5674ff827079bbf6
4
- data.tar.gz: 90302060b3ae806b43f4cce6165744e6b5af59566176dffbc878875a876038c9
3
+ metadata.gz: 00a10b1e139e15aa28f133847e8a102bba235fd15840b8da636cc2658cbbd821
4
+ data.tar.gz: '0683e861cc45e0177b5e9f96c4ac05e47ae77b99314978463fa9178da217277d'
5
5
  SHA512:
6
- metadata.gz: 5e2bcb595827b288a7d6f9d068ff46036f25fc93bd3e39f3f481d8e5eb6ddbe94f23f65dd8554383cfc009dc4ff9ecf19d00a6564aa45181af77971660826bf3
7
- data.tar.gz: 147a875753ac204afb7b063f00e10047ec7ef1c8a39c28827ded7d2515b0f6076c418a1e11fb9b3c2ab2a93b2220200bc573fa04f96c9523bf545a90b1f4e223
6
+ metadata.gz: 65c4b44b3a1eb0077bcaf1dc2be3035439fd7b9b0771409f1b02483ac81f5d2b744768f6901206e600f9cbb3fec0743ef585e52f89fabac58250ebcfc44b6891
7
+ data.tar.gz: 3d3b1cc9df23483d023e55b1029e47d98cfdc62982c366f8992b5ef6ee95077f216f9368498447d478c9ebe7530cd7e2e1fb94c5147702c706409e369a2f8ed1
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require "bundler/gem_tasks"
4
4
  require "rake/testtask"
5
5
  require "rspec/core/rake_task"
6
6
 
7
- import "./tasks/lint.rake"
7
+ import "lib/tasks/lint.rake"
8
8
 
9
9
  RSpec::Core::RakeTask.new(:spec) do |t|
10
10
  t.pattern = Dir.glob("spec/**/*_spec.rb")
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.3.0
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
- class << self
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
- private
15
-
16
- def gem_spec
17
- Gem::Specification.find_by_name("boxt_ruby_style_guide")
18
- end
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 = File.join(File.dirname(__FILE__), "../../tasks/*.rake")
8
+ files = BoxtRubyStyleGuide.root.join("lib", "tasks", "*.rake")
9
9
  Dir[files].each { |file| load(file) }
10
10
  end
11
11
  end
@@ -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.3.0
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-09-28 00:00:00.000000000 Z
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.18'
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.18'
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