boxt_ruby_style_guide 7.2.0 → 7.6.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: ad901e73bc30af6e1eee0a142fb2ca9422abceb733bc5e31f4652014c43dcb9b
4
- data.tar.gz: bfabdeb23f3c4448d7192a27786ba9b8febebf669358a449bbab57c9b24103e6
3
+ metadata.gz: 7fdb78910aef325a37d80abf635b2c675d190e63669133b14f19ebcad1c480d9
4
+ data.tar.gz: 5c58cb56cfeb23d4769f8681bd21c16b5f39a3401ecbb6a016b3ba7cdf1c68f7
5
5
  SHA512:
6
- metadata.gz: 80994cd501fc8e71b7bd94215b12db3ae55186349fefe1a81a0e03095f2b1f92ce165074ace9042f5c469e3636e1512e137de6170edd931a85a261cc61c3fc70
7
- data.tar.gz: 55c6bc374533770ea2ff28b774247a71670314b46b5c2ee4324d1d1a8ea74ff905d6b023d9746aa814ae88a9b3174f9975bd6675f8c022eaa7d8c8732e4191b1
6
+ metadata.gz: be5aa640996292e3d526e91a27fb2365eebb84c2e2c02f32f0a1d2b47dbe04340e0e11f15a30d9b6c60a2b25a56430dce48a950cf2522b227ce0f51acb99c58d
7
+ data.tar.gz: 667f275e3560ec91b6c20ca8bdd6f58cfc7f079c1207812d891af364e5a086823e0f7679c8e0537598c9dd4f03d230c7853b8828787a481eb2a8e5b023adfc28
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.2.0
1
+ 7.6.0
@@ -1,33 +1,39 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.7.1
3
2
  Exclude:
4
3
  - "**/*/schema.rb"
5
- - "Gemfile.lock"
6
- - "node_modules/**/*"
7
- - "tmp/**/*"
8
- - "vendor/**/*"
4
+ - Gemfile.lock
5
+ - node_modules/**/*
6
+ - tmp/**/*
7
+ - vendor/**/*
8
+ TargetRubyVersion: 2.7.1
9
9
  Layout/LineLength:
10
- Max: 120 # Increase line length to 120
11
10
  Exclude:
12
- - "config/routes.rb"
11
+ - config/routes.rb
12
+ Max: 120
13
+ Metrics/AbcSize:
14
+ Exclude:
15
+ - db/migrate/**/*
13
16
  Metrics/BlockLength:
14
17
  Exclude:
15
18
  - "*.gemspec"
16
- - "Gemfile"
17
- - "config/routes.rb"
18
- - "spec/**/*"
19
- - "test/**/*"
19
+ - Gemfile
20
+ - config/routes.rb
21
+ - db/migrate/**/*
22
+ - spec/**/*
23
+ - test/**/*
20
24
  Metrics/ClassLength:
21
25
  Exclude:
22
- - "spec/**/*"
23
- - "test/**/*"
26
+ - db/migrate/**/*
27
+ - spec/**/*
28
+ - test/**/*
24
29
  Metrics/MethodLength:
25
30
  Exclude:
26
- - "spec/**/*"
27
- - "test/**/*"
31
+ - db/migrate/**/*
32
+ - spec/**/*
33
+ - test/**/*
34
+ Style/Documentation:
35
+ Enabled: false
28
36
  Style/DoubleNegation:
29
37
  Enabled: false
30
- Style/Documentation:
31
- Enabled: false # Disable Style/Documentation because...
32
38
  Style/StringLiterals:
33
- EnforcedStyle: double_quotes # Use double quotes ALL THE TIME!!!
39
+ EnforcedStyle: double_quotes
@@ -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,64 @@
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").delete("\s")
27
+ (
28
+ (#{RUBY_DIRS.join('|')})\\/.+\\.(rb|rake)
29
+ |^
30
+ (Gemfile|Rakefile|.+\\.gemspec)
31
+ \Z)
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(<<~BASH)
38
+ RUBOCOP_CHANGED_FILES=`#{diff_file_paths}`
39
+ if [ -z "$RUBOCOP_CHANGED_FILES" ]; then
40
+ echo "No matching Ruby files changed"
41
+ else
42
+ bundle exec rubocop $RUBOCOP_CHANGED_FILES
43
+ fi
44
+ BASH
45
+ end
46
+
47
+ private
48
+
49
+ # A list of the local file paths of Ruby files with committed changes.
50
+ #
51
+ # Run a git diff-tree command with the following otions:
52
+ # -r recursive
53
+ # --name-only Only return the name of the files
54
+ # --diff-filter Filter out results that have been deleted on HEAD
55
+ #
56
+ # Pipe the output from this command through grep to match only Ruby files in the
57
+ # desired directories
58
+ #
59
+ # Returns String
60
+ def diff_file_paths
61
+ base_branch = ENV.fetch("RUBOCOP_LINT_BASE", BASE_BRANCH)
62
+ "git diff -r --name-only --diff-filter=d #{base_branch} | egrep '#{GREP_PATTERN}'"
63
+ end
64
+ end
data/rails.yml CHANGED
@@ -1,29 +1,11 @@
1
- # Rails specific cops
2
- Rails/ApplicationController:
3
- Exclude:
4
- - "spec/**/*"
5
- - "test/**/*"
6
- Rails/SkipsModelValidations:
7
- Exclude:
8
- - "db/migrate/**/*"
9
- - "lib/tasks/**/*"
10
- - "spec/**/*"
11
- - "test/**/*"
12
- Rails/UnknownEnv:
13
- Environments:
14
- - cucumber
15
- - development
16
- - production
17
- - qa
18
- - test
19
- - uat
20
-
21
- # These rails cops are currently pending and will be enabled by default at some point, but adding for now to stop
22
- # Rubocop or VSCode complaining...
23
1
  Rails/ActiveRecordCallbacksOrder:
24
2
  Enabled: true
25
3
  Rails/AfterCommitOverride:
26
4
  Enabled: true
5
+ Rails/ApplicationController:
6
+ Exclude:
7
+ - spec/**/*
8
+ - test/**/*
27
9
  Rails/FindById:
28
10
  Enabled: true
29
11
  Rails/Inquiry:
@@ -44,8 +26,22 @@ Rails/RenderPlainText:
44
26
  Enabled: true
45
27
  Rails/ShortI18n:
46
28
  Enabled: true
29
+ Rails/SkipsModelValidations:
30
+ Exclude:
31
+ - db/migrate/**/*
32
+ - lib/tasks/**/*
33
+ - spec/**/*
34
+ - test/**/*
47
35
  Rails/SquishedSQLHeredocs:
48
36
  Enabled: true
37
+ Rails/UnknownEnv:
38
+ Environments:
39
+ - cucumber
40
+ - development
41
+ - production
42
+ - qa
43
+ - test
44
+ - uat
49
45
  Rails/WhereExists:
50
46
  Enabled: true
51
47
  Rails/WhereNot:
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.2.0
4
+ version: 7.6.0
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-09-25 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,14 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.91.1
19
+ version: 0.92.0
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: 0.91.1
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
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">"
42
+ - !ruby/object:Gem::Version
43
+ version: '5'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: rubocop-faker
29
49
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +148,14 @@ dependencies:
128
148
  requirements:
129
149
  - - "~>"
130
150
  - !ruby/object:Gem::Version
131
- version: '0.18'
151
+ version: '0.19'
132
152
  type: :development
133
153
  prerelease: false
134
154
  version_requirements: !ruby/object:Gem::Requirement
135
155
  requirements:
136
156
  - - "~>"
137
157
  - !ruby/object:Gem::Version
138
- version: '0.18'
158
+ version: '0.19'
139
159
  description: Ruby styleguide info for the BOXT projects, as well as config settings
140
160
  for Rubocop
141
161
  email:
@@ -152,6 +172,7 @@ files:
152
172
  - lib/boxt_ruby_style_guide.rb
153
173
  - lib/boxt_ruby_style_guide/railtie.rb
154
174
  - lib/boxt_ruby_style_guide/version.rb
175
+ - lib/tasks/lint.rake
155
176
  - pending.yml
156
177
  - rails-pending.yml
157
178
  - rails.yml
@@ -160,7 +181,7 @@ homepage: https://github.com/boxt/ruby-style-guide
160
181
  licenses:
161
182
  - MIT
162
183
  metadata: {}
163
- post_install_message:
184
+ post_install_message:
164
185
  rdoc_options: []
165
186
  require_paths:
166
187
  - lib
@@ -175,8 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
196
  - !ruby/object:Gem::Version
176
197
  version: '0'
177
198
  requirements: []
178
- rubygems_version: 3.1.4
179
- signing_key:
199
+ rubygems_version: 3.1.2
200
+ signing_key:
180
201
  specification_version: 4
181
202
  summary: Ruby styleguide info for the BOXT Ruby projects
182
203
  test_files: []