rubocop-isucon 2.0.1 → 2.0.2

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: b98ffbdad3aac15d06dc8606570be18e31b34a1ee1af1bec422983ce0ba65396
4
- data.tar.gz: 804d43a41d8ca7862fbca72cbc5af61867359b76ecd23dee57e275fcea5b24a5
3
+ metadata.gz: 765ace9ebe80b459b8f3347e7941f88e8c9b55a937b1b2491c15e8ee9d2bb3cb
4
+ data.tar.gz: 41b4827422e16e5c076b0f8a5498e8fd30262094579c869301985829d7eb8a0c
5
5
  SHA512:
6
- metadata.gz: 42b31825f977a06c7c3205641bca6d0bbb2325884c38d325791477b90ef82af1aa06cef8a35b10f3ec77502316609c2046dfd40614db211084cfe637de6e52cb
7
- data.tar.gz: fad3f42a8d568a4eb131c9c09ae3674990afab6fac232705b99e5c223a8eb078f125e23d525f815a4da6002f5b585a16253ee24aa18e5d0d02f169907b953339
6
+ metadata.gz: 8243e07bd96cee3ec98fb648a7562a1a3e91f37e962de740671ffb5400c558c560d1088c12f0b203b9487dd1ac8c8ca5990ee7bd9cf997ead8b144aa98e16123
7
+ data.tar.gz: 9c2952bd62fe3a28f78b260f98ad8624cb5196ffaf974db27c2b0158cef564d1613568ebcc7dd8a06a92bd7ae6950d7d1e1382d9446cf6dc404b498d2f36be6a
@@ -6,5 +6,7 @@ updates:
6
6
  directory: /
7
7
  schedule:
8
8
  interval: weekly
9
+ cooldown:
10
+ default-days: 7
9
11
  assignees:
10
12
  - sue445
@@ -30,7 +30,7 @@ jobs:
30
30
  runs-on: ubuntu-latest
31
31
  steps:
32
32
  - name: Checkout
33
- uses: actions/checkout@v4
33
+ uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
34
34
 
35
35
  - name: Install packages
36
36
  run: |
@@ -38,7 +38,7 @@ jobs:
38
38
  sudo apt-get update
39
39
  sudo apt-get install -y libgda-5.0
40
40
 
41
- - uses: ruby/setup-ruby@v1
41
+ - uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
42
42
  with:
43
43
  ruby-version: ruby
44
44
  bundler-cache: true
@@ -46,18 +46,18 @@ jobs:
46
46
  - run: bundle exec yard
47
47
 
48
48
  - name: Setup Pages
49
- uses: actions/configure-pages@v5
49
+ uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
50
50
  - name: Upload artifact
51
- uses: actions/upload-pages-artifact@v3
51
+ uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
52
52
  with:
53
53
  # Upload entire repository
54
54
  path: './doc'
55
55
  - name: Deploy to GitHub Pages
56
56
  id: deployment
57
- uses: actions/deploy-pages@v4
57
+ uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
58
58
 
59
59
  - name: Slack Notification (not success)
60
- uses: act10ns/slack@v2
60
+ uses: act10ns/slack@cfcc30955fe9377f4f55e1079e5419ee1014269f # v2
61
61
  if: "! success()"
62
62
  continue-on-error: true
63
63
  with:
@@ -0,0 +1,47 @@
1
+ name: Publish gem to rubygems.org
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ release:
8
+ if: github.repository == 'sue445/rubocop-isucon'
9
+ runs-on: ubuntu-latest
10
+
11
+ environment:
12
+ name: rubygems.org
13
+ url: https://rubygems.org/gems/rubocop-isucon
14
+
15
+ permissions:
16
+ contents: write
17
+ id-token: write
18
+
19
+ steps:
20
+ - name: Harden Runner
21
+ uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
22
+ with:
23
+ egress-policy: audit
24
+
25
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26
+
27
+ - name: Install packages
28
+ run: |
29
+ set -xe
30
+ sudo apt-get update
31
+ sudo apt-get install -y libgda-5.0
32
+
33
+ - name: Set up Ruby
34
+ uses: ruby/setup-ruby@eaecf785f6a34567a6d97f686bbb7bccc1ac1e5c # v1.237.0
35
+ with:
36
+ bundler-cache: true
37
+ ruby-version: ruby
38
+
39
+ - name: Publish to RubyGems
40
+ uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
41
+
42
+ - name: Create GitHub release
43
+ run: |
44
+ tag_name="$(git describe --tags --abbrev=0)"
45
+ gh release create "${tag_name}" --verify-tag --generate-notes
46
+ env:
47
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -26,12 +26,13 @@ jobs:
26
26
  - "3.4"
27
27
  gemfile:
28
28
  - activerecord_8_0
29
+ - activerecord_8_1
29
30
 
30
31
  env:
31
32
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
32
33
 
33
34
  steps:
34
- - uses: actions/checkout@v4
35
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
35
36
 
36
37
  - name: Install packages
37
38
  run: |
@@ -39,7 +40,7 @@ jobs:
39
40
  sudo apt-get update
40
41
  sudo apt-get install -y libgda-5.0
41
42
 
42
- - uses: ruby/setup-ruby@v1
43
+ - uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
43
44
  with:
44
45
  ruby-version: ${{ matrix.ruby }}
45
46
  bundler-cache: true
@@ -56,7 +57,7 @@ jobs:
56
57
  - run: bundle exec yard --fail-on-warning
57
58
 
58
59
  - name: Slack Notification (not success)
59
- uses: act10ns/slack@v2
60
+ uses: act10ns/slack@cfcc30955fe9377f4f55e1079e5419ee1014269f # v2
60
61
  if: "! success()"
61
62
  continue-on-error: true
62
63
  with:
@@ -72,7 +73,7 @@ jobs:
72
73
 
73
74
  steps:
74
75
  - name: Slack Notification (success)
75
- uses: act10ns/slack@v2
76
+ uses: act10ns/slack@cfcc30955fe9377f4f55e1079e5419ee1014269f # v2
76
77
  if: always()
77
78
  continue-on-error: true
78
79
  with:
data/.rubocop.yml CHANGED
@@ -1,7 +1,5 @@
1
1
  plugins:
2
2
  - rubocop-performance
3
-
4
- require:
5
3
  - rubocop-yard
6
4
 
7
5
  AllCops:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
- [full changelog](http://github.com/sue445/rubocop-isucon/compare/v2.0.1...main)
2
+ [full changelog](http://github.com/sue445/rubocop-isucon/compare/v2.0.2...main)
3
+
4
+ ## [2.0.2](https://github.com/sue445/rubocop-isucon/releases/tag/v2.0.2) - 2025-11-30
5
+ [full changelog](http://github.com/sue445/rubocop-isucon/compare/v2.0.1...v2.0.2)
6
+
7
+ * Release gem from GitHub Actions
8
+ * https://github.com/sue445/rubocop-isucon/pull/274
3
9
 
4
10
  ## [2.0.1](https://github.com/sue445/rubocop-isucon/releases/tag/v2.0.1) - 2025-03-25
5
11
  [full changelog](http://github.com/sue445/rubocop-isucon/compare/v2.0.0...v2.0.1)
data/README.md CHANGED
@@ -123,4 +123,4 @@ ISUCON is a trademark or registered trademark of LINE Corporation.
123
123
  https://isucon.net
124
124
 
125
125
  ## Presentation
126
- * [Fix SQL N\+1 queries with RuboCop](https://speakerdeck.com/sue445/fix-sql-n-plus-one-queries-with-rubocop) at [RubyKaigi 2023](https://rubykaigi.org/2013/) :gem:
126
+ * [Fix SQL N\+1 queries with RuboCop](https://speakerdeck.com/sue445/fix-sql-n-plus-one-queries-with-rubocop) at [RubyKaigi 2023](https://rubykaigi.org/2023/) :gem:
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 8.1.0.rc1"
6
+
7
+ group :sqlite3 do
8
+ # c.f. https://github.com/rails/rails/blob/v8.1.0.rc1/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L14
9
+ gem "sqlite3", ">= 2.1"
10
+ end
11
+
12
+ # eval_gemfile "#{__dir__}/common.gemfile"
13
+
14
+ gemspec path: "../"
@@ -16,7 +16,7 @@ module RuboCop
16
16
 
17
17
  # @return [Boolean]
18
18
  def correctable_gda?
19
- gda&.select_query? && gda.table_names.count == 1 && !gda.limit_clause? &&
19
+ gda&.select_query? && gda.table_names.one? && !gda.limit_clause? &&
20
20
  !gda.group_by_clause? && !gda.contains_aggregate_functions? && where_clause_with_only_single_unique_key?
21
21
  end
22
22
 
@@ -27,20 +27,20 @@ module RuboCop
27
27
 
28
28
  # @return [Boolean]
29
29
  def where_clause_with_only_primary_key?
30
- return false unless gda.where_nodes.count == 1
30
+ return false unless gda.where_nodes.one?
31
31
 
32
32
  primary_keys = connection.primary_keys(gda.table_names[0])
33
- return false unless primary_keys.count == 1
33
+ return false unless primary_keys.one?
34
34
 
35
35
  primary_keys.first == where_column_without_quote
36
36
  end
37
37
 
38
38
  # @return [Boolean]
39
39
  def where_clause_with_only_single_unique_index_column?
40
- return false unless gda.where_nodes.count == 1
40
+ return false unless gda.where_nodes.one?
41
41
 
42
42
  unique_index_columns = connection.unique_index_columns(gda.table_names[0])
43
- unique_index_columns.any? { |columns| columns.count == 1 && columns.first == where_column_without_quote }
43
+ unique_index_columns.any? { |columns| columns.one? && columns.first == where_column_without_quote }
44
44
  end
45
45
 
46
46
  # @return [Boolean]
@@ -24,7 +24,7 @@ module RuboCop
24
24
  def column_operand
25
25
  operand0_value = operands[0].value
26
26
 
27
- return operand0_value if operands.count == 1
27
+ return operand0_value if operands.one?
28
28
 
29
29
  operand1_value = operands[1].value
30
30
 
@@ -39,7 +39,7 @@ module RuboCop
39
39
 
40
40
  # @return [String,nil]
41
41
  def value_operand
42
- return nil if operands.count == 1
42
+ return nil if operands.one?
43
43
 
44
44
  operand0_value = operands[0].value
45
45
  operand1_value = operands[1].value
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Isucon
5
- VERSION = "2.0.1"
5
+ VERSION = "2.0.2"
6
6
  end
7
7
  end
@@ -49,7 +49,7 @@ Gem::Specification.new do |spec|
49
49
  spec.add_development_dependency "rspec", "~> 3.0"
50
50
  spec.add_development_dependency "rspec-its"
51
51
  spec.add_development_dependency "rubocop_auto_corrector"
52
- spec.add_development_dependency "rubocop-yard", ">= 0.9.2"
52
+ spec.add_development_dependency "rubocop-yard", ">= 1.0.0"
53
53
  spec.add_development_dependency "sqlite3"
54
54
  spec.add_development_dependency "yard"
55
55
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-isucon
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activerecord
@@ -183,14 +183,14 @@ dependencies:
183
183
  requirements:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
- version: 0.9.2
186
+ version: 1.0.0
187
187
  type: :development
188
188
  prerelease: false
189
189
  version_requirements: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - ">="
192
192
  - !ruby/object:Gem::Version
193
- version: 0.9.2
193
+ version: 1.0.0
194
194
  - !ruby/object:Gem::Dependency
195
195
  name: sqlite3
196
196
  requirement: !ruby/object:Gem::Requirement
@@ -228,6 +228,7 @@ extra_rdoc_files: []
228
228
  files:
229
229
  - ".github/dependabot.yml"
230
230
  - ".github/workflows/pages.yml"
231
+ - ".github/workflows/release_gem.yml"
231
232
  - ".github/workflows/test.yml"
232
233
  - ".gitignore"
233
234
  - ".rspec"
@@ -247,6 +248,7 @@ files:
247
248
  - config/default.yml
248
249
  - config/enable-only-performance.yml
249
250
  - gemfiles/activerecord_8_0.gemfile
251
+ - gemfiles/activerecord_8_1.gemfile
250
252
  - lib/rubocop-isucon.rb
251
253
  - lib/rubocop/cop/isucon/correctors/n_plus_one_query_corrector.rb
252
254
  - lib/rubocop/cop/isucon/correctors/n_plus_one_query_corrector/correctable_methods.rb
@@ -318,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
320
  - !ruby/object:Gem::Version
319
321
  version: '0'
320
322
  requirements: []
321
- rubygems_version: 3.6.2
323
+ rubygems_version: 3.6.7
322
324
  specification_version: 4
323
325
  summary: RuboCop plugin for ruby reference implementation of ISUCON
324
326
  test_files: []