rubocop-isucon 2.0.1 → 2.0.3

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: 6bfbb0aff76e1d721b208ef87bd1f322e210d5e9ac9b6ac3791ac893a97f9486
4
+ data.tar.gz: 4e2f1101a5869bf5a5c10349dee879195fc5eb083d696f4e71391adeaf0414ff
5
5
  SHA512:
6
- metadata.gz: 42b31825f977a06c7c3205641bca6d0bbb2325884c38d325791477b90ef82af1aa06cef8a35b10f3ec77502316609c2046dfd40614db211084cfe637de6e52cb
7
- data.tar.gz: fad3f42a8d568a4eb131c9c09ae3674990afab6fac232705b99e5c223a8eb078f125e23d525f815a4da6002f5b585a16253ee24aa18e5d0d02f169907b953339
6
+ metadata.gz: a07112b77ea1737dc4aa199bf17649eafa00523821656452d75cc67f37597abb9c23d4e84fee5d4ebe49ffb414f6b9317a63fdef3b46b689de62ce61fba90bd3
7
+ data.tar.gz: fb37f3f112520507cc17516ea75f18056c6cb28790843476d8d5a23f8239ac23e1173e9b3bf679eef3cca0b8bcfa530c9085bc45851ca1f11ff48322b9b5452a
@@ -2,9 +2,19 @@
2
2
  version: 2
3
3
 
4
4
  updates:
5
+ ###########################################################
6
+ # NOTE: following sections are auto generated. DO NOT EDIT!
7
+ ###########################################################
5
8
  - package-ecosystem: github-actions
6
9
  directory: /
7
10
  schedule:
8
- interval: weekly
11
+ interval: monthly
12
+ time: "05:00"
13
+ timezone: Asia/Tokyo
9
14
  assignees:
10
15
  - sue445
16
+ cooldown:
17
+ default-days: 7
18
+ exclude:
19
+ - ruby/setup-ruby
20
+ ###########################################################
@@ -0,0 +1,31 @@
1
+ # ref. https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes
2
+
3
+ changelog:
4
+ exclude:
5
+ labels:
6
+ - chore
7
+
8
+ categories:
9
+ - title: ":bomb: Breaking Changes"
10
+ labels:
11
+ - breaking change
12
+
13
+ - title: ":lock: Security Fix"
14
+ labels:
15
+ - security
16
+
17
+ - title: ":rocket: Features"
18
+ labels:
19
+ - enhancement
20
+
21
+ - title: ":bug: Bug Fixes"
22
+ labels:
23
+ - bug
24
+
25
+ - title: ":dependabot: Dependency updates"
26
+ labels:
27
+ - dependencies
28
+
29
+ - title: ":pencil: Other Changes"
30
+ labels:
31
+ - "*"
@@ -0,0 +1,28 @@
1
+ name: dependabot-manager
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - opened
7
+ - synchronize # PR branch is rebased
8
+
9
+ jobs:
10
+ dependabot-auto-merge:
11
+ uses: sue445/workflows/.github/workflows/dependabot-auto-merge.yml@main
12
+ with:
13
+ repo-name: sue445/rubocop-isucon
14
+ secrets:
15
+ # TODO: Set secrets to Dependabot secrets
16
+ app-id: ${{ secrets.GH_APP_ID }}
17
+ private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
18
+ slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
19
+
20
+ dependabot-security-alert:
21
+ uses: sue445/workflows/.github/workflows/dependabot-security-alert.yml@main
22
+ with:
23
+ repo-name: sue445/rubocop-isucon
24
+ secrets:
25
+ # TODO: Set secrets to Dependabot secrets
26
+ app-id: ${{ secrets.GH_APP_ID }}
27
+ private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
28
+ slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
@@ -1,65 +1,22 @@
1
- # Simple workflow for deploying static content to GitHub Pages
2
- name: Deploy static content to Pages
1
+ name: Deploy yard to Pages
3
2
 
4
3
  on:
5
- # Runs on pushes targeting the default branch
6
4
  push:
7
5
  branches:
8
6
  - main
9
-
10
- # Allows you to run this workflow manually from the Actions tab
11
7
  workflow_dispatch:
12
8
 
13
- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14
9
  permissions:
15
10
  contents: read
16
11
  pages: write
17
12
  id-token: write
18
13
 
19
- # Allow one concurrent deployment
20
- concurrency:
21
- group: "pages"
22
- cancel-in-progress: true
23
-
24
14
  jobs:
25
- # Single deploy job since we're just deploying
26
15
  deploy:
27
- environment:
28
- name: github-pages
29
- url: ${{ steps.deployment.outputs.page_url }}
30
- runs-on: ubuntu-latest
31
- steps:
32
- - name: Checkout
33
- uses: actions/checkout@v4
34
-
35
- - name: Install packages
36
- run: |
37
- set -xe
38
- sudo apt-get update
39
- sudo apt-get install -y libgda-5.0
40
-
41
- - uses: ruby/setup-ruby@v1
42
- with:
43
- ruby-version: ruby
44
- bundler-cache: true
45
-
46
- - run: bundle exec yard
47
-
48
- - name: Setup Pages
49
- uses: actions/configure-pages@v5
50
- - name: Upload artifact
51
- uses: actions/upload-pages-artifact@v3
52
- with:
53
- # Upload entire repository
54
- path: './doc'
55
- - name: Deploy to GitHub Pages
56
- id: deployment
57
- uses: actions/deploy-pages@v4
58
-
59
- - name: Slack Notification (not success)
60
- uses: act10ns/slack@v2
61
- if: "! success()"
62
- continue-on-error: true
63
- with:
64
- status: ${{ job.status }}
65
- webhook-url: ${{ secrets.SLACK_WEBHOOK }}
16
+ uses: sue445/workflows/.github/workflows/pages-yard.yml@main
17
+ secrets:
18
+ slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
19
+ with:
20
+ before-command: |
21
+ sudo apt-get update
22
+ sudo apt-get install -y libgda-5.0
@@ -0,0 +1,18 @@
1
+ name: Publish gem to rubygems.org
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ release:
8
+ uses: sue445/workflows/.github/workflows/release_gem.yml@main
9
+ with:
10
+ repo-name: sue445/rubocop-isucon
11
+ gem-name: rubocop-isucon
12
+ before-command: |
13
+ set -xe
14
+ sudo apt-get update
15
+ sudo apt-get install -y libgda-5.0
16
+ permissions:
17
+ contents: write
18
+ id-token: write
@@ -24,14 +24,16 @@ jobs:
24
24
  - "3.2"
25
25
  - "3.3"
26
26
  - "3.4"
27
+ - "4.0"
27
28
  gemfile:
28
29
  - activerecord_8_0
30
+ - activerecord_8_1
29
31
 
30
32
  env:
31
33
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
32
34
 
33
35
  steps:
34
- - uses: actions/checkout@v4
36
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
35
37
 
36
38
  - name: Install packages
37
39
  run: |
@@ -39,7 +41,7 @@ jobs:
39
41
  sudo apt-get update
40
42
  sudo apt-get install -y libgda-5.0
41
43
 
42
- - uses: ruby/setup-ruby@v1
44
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
43
45
  with:
44
46
  ruby-version: ${{ matrix.ruby }}
45
47
  bundler-cache: true
@@ -53,10 +55,15 @@ jobs:
53
55
 
54
56
  - run: bundle exec rspec
55
57
  - run: bundle exec rubocop
56
- - run: bundle exec yard --fail-on-warning
58
+
59
+ - name: yard generating test
60
+ run: |
61
+ set -xe
62
+ bundle exec yard --fail-on-warning
63
+ ls -ld doc/
57
64
 
58
65
  - name: Slack Notification (not success)
59
- uses: act10ns/slack@v2
66
+ uses: act10ns/slack@d96404edccc6d6467fc7f8134a420c851b1e9054 # v2.2.0
60
67
  if: "! success()"
61
68
  continue-on-error: true
62
69
  with:
@@ -64,17 +71,16 @@ jobs:
64
71
  webhook-url: ${{ secrets.SLACK_WEBHOOK }}
65
72
  matrix: ${{ toJson(matrix) }}
66
73
 
67
- notify:
74
+ all-pass:
75
+ if: always()
76
+
68
77
  needs:
69
78
  - test
70
79
 
71
- runs-on: ubuntu-latest
80
+ runs-on: ubuntu-slim
72
81
 
73
82
  steps:
74
- - name: Slack Notification (success)
75
- uses: act10ns/slack@v2
76
- if: always()
77
- continue-on-error: true
83
+ - name: check dependent jobs
84
+ uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
78
85
  with:
79
- status: ${{ job.status }}
80
- webhook-url: ${{ secrets.SLACK_WEBHOOK }}
86
+ jobs: ${{ toJSON(needs) }}
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,17 @@
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.3...main)
3
+
4
+ ## [2.0.3](https://github.com/sue445/rubocop-isucon/releases/tag/v2.0.3) - 2026-08-23
5
+ [full changelog](http://github.com/sue445/rubocop-isucon/compare/v2.0.2...v2.0.3)
6
+
7
+ * Migrate release_gem workflow to sue445/workflows (Also testing the gem release)
8
+ * https://github.com/sue445/rubocop-isucon/pull/311
9
+
10
+ ## [2.0.2](https://github.com/sue445/rubocop-isucon/releases/tag/v2.0.2) - 2025-11-30
11
+ [full changelog](http://github.com/sue445/rubocop-isucon/compare/v2.0.1...v2.0.2)
12
+
13
+ * Release gem from GitHub Actions
14
+ * https://github.com/sue445/rubocop-isucon/pull/274
3
15
 
4
16
  ## [2.0.1](https://github.com/sue445/rubocop-isucon/releases/tag/v2.0.1) - 2025-03-25
5
17
  [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.3"
6
6
  end
7
7
  end
@@ -43,13 +43,14 @@ Gem::Specification.new do |spec|
43
43
  spec.add_dependency "rubocop-performance", ">= 1.24.0"
44
44
 
45
45
  spec.add_development_dependency "benchmark-ips"
46
+ spec.add_development_dependency "irb"
46
47
  spec.add_development_dependency "pry-byebug"
47
48
  spec.add_development_dependency "rake", "~> 13.0"
48
49
  spec.add_development_dependency "redcarpet"
49
50
  spec.add_development_dependency "rspec", "~> 3.0"
50
51
  spec.add_development_dependency "rspec-its"
51
52
  spec.add_development_dependency "rubocop_auto_corrector"
52
- spec.add_development_dependency "rubocop-yard", ">= 0.9.2"
53
+ spec.add_development_dependency "rubocop-yard", ">= 1.0.0"
53
54
  spec.add_development_dependency "sqlite3"
54
55
  spec.add_development_dependency "yard"
55
56
  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.3
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
@@ -93,6 +93,20 @@ dependencies:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: irb
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
96
110
  - !ruby/object:Gem::Dependency
97
111
  name: pry-byebug
98
112
  requirement: !ruby/object:Gem::Requirement
@@ -183,14 +197,14 @@ dependencies:
183
197
  requirements:
184
198
  - - ">="
185
199
  - !ruby/object:Gem::Version
186
- version: 0.9.2
200
+ version: 1.0.0
187
201
  type: :development
188
202
  prerelease: false
189
203
  version_requirements: !ruby/object:Gem::Requirement
190
204
  requirements:
191
205
  - - ">="
192
206
  - !ruby/object:Gem::Version
193
- version: 0.9.2
207
+ version: 1.0.0
194
208
  - !ruby/object:Gem::Dependency
195
209
  name: sqlite3
196
210
  requirement: !ruby/object:Gem::Requirement
@@ -227,7 +241,10 @@ extensions: []
227
241
  extra_rdoc_files: []
228
242
  files:
229
243
  - ".github/dependabot.yml"
244
+ - ".github/release.yml"
245
+ - ".github/workflows/dependabot-manager.yml"
230
246
  - ".github/workflows/pages.yml"
247
+ - ".github/workflows/release_gem.yml"
231
248
  - ".github/workflows/test.yml"
232
249
  - ".gitignore"
233
250
  - ".rspec"
@@ -247,6 +264,7 @@ files:
247
264
  - config/default.yml
248
265
  - config/enable-only-performance.yml
249
266
  - gemfiles/activerecord_8_0.gemfile
267
+ - gemfiles/activerecord_8_1.gemfile
250
268
  - lib/rubocop-isucon.rb
251
269
  - lib/rubocop/cop/isucon/correctors/n_plus_one_query_corrector.rb
252
270
  - lib/rubocop/cop/isucon/correctors/n_plus_one_query_corrector/correctable_methods.rb
@@ -318,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
336
  - !ruby/object:Gem::Version
319
337
  version: '0'
320
338
  requirements: []
321
- rubygems_version: 3.6.2
339
+ rubygems_version: 4.0.16
322
340
  specification_version: 4
323
341
  summary: RuboCop plugin for ruby reference implementation of ISUCON
324
342
  test_files: []