fbe 0.47.0 → 0.48.1

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: ea72dd302f243abc5aaa0da86d414580675387042d714f1a60fa9addfe8e9a70
4
- data.tar.gz: '09633905c14bfb956572d30a2a831be6df7fc56c8f95232a6a7cb8637b18b8be'
3
+ metadata.gz: 4392267bd1f65b17c78d201c2a4516ffdcae3b94c23635d069080bfe605a4108
4
+ data.tar.gz: aec58a15b372a499cebbc83030780299e76a9f0410aa4fb4f36a6edd078d90eb
5
5
  SHA512:
6
- metadata.gz: b24e9117c568b82350034ea63188091a1fe5f82a8c4db26c6af3fe20626023f67c7317bf736bf434b13f0ae64d9cb2154561a4a7d7a212f99c48aa2cf3b0f8c9
7
- data.tar.gz: 53699c7aac11b4e18bd45d9946c847dd79b0ae6c63509b1d58eb9baf6a61449480da94e30f83a7df5f079cd70b781cb0b97d59b40a6a96a07031e9008ba8cbdd
6
+ metadata.gz: 2dd7e4369b69c8a81c84d464928b00c6841dfd322dda9cbc0dd0a060ae6c5c54a1be30f22be08e72a8598771681ac0f0902372fede811f17bf9ce201dc529567
7
+ data.tar.gz: '08047926731e07c24ee1d61d8cb2d3fb01c56d0b8a093e53ee8def31d9251b90c50e3a4214c2d559d629f4bdf3b74c5b86b8619f12432ebeac8437af9e3be02a'
@@ -15,7 +15,7 @@ jobs:
15
15
  - uses: actions/checkout@v6
16
16
  - uses: ruby/setup-ruby@v1
17
17
  with:
18
- ruby-version: 3.4.7
18
+ ruby-version: 3.4.8
19
19
  bundler-cache: true
20
20
  - run: bundle config set --global path "$(pwd)/vendor/bundle"
21
21
  - run: bundle install --no-color
data/Gemfile CHANGED
@@ -6,7 +6,8 @@
6
6
  source 'https://rubygems.org'
7
7
  gemspec
8
8
 
9
- gem 'minitest', '~>5.25', require: false
9
+ gem 'minitest', '~>6.0', require: false
10
+ gem 'minitest-mock', '~>5.27', require: false
10
11
  gem 'minitest-reporters', '~>1.7', require: false
11
12
  gem 'minitest-stub-const', '~>0.6', require: false
12
13
  gem 'os', '~>1.1', require: false
data/Gemfile.lock CHANGED
@@ -122,7 +122,7 @@ GEM
122
122
  intercepted (0.2.0)
123
123
  iri (0.11.3)
124
124
  joined (0.4.0)
125
- json (2.17.1)
125
+ json (2.18.0)
126
126
  judges (0.58.0)
127
127
  backtrace (~> 0.4)
128
128
  baza.rb (~> 0.10)
@@ -148,7 +148,9 @@ GEM
148
148
  logger (1.7.0)
149
149
  loog (0.6.1)
150
150
  logger (~> 1.0)
151
- minitest (5.27.0)
151
+ minitest (6.0.0)
152
+ prism (~> 1.5)
153
+ minitest-mock (5.27.0)
152
154
  minitest-reporters (1.7.1)
153
155
  ansi
154
156
  builder
@@ -198,7 +200,7 @@ GEM
198
200
  regexp_parser (2.11.3)
199
201
  retries (0.0.5)
200
202
  rexml (3.4.4)
201
- rubocop (1.81.7)
203
+ rubocop (1.82.0)
202
204
  json (~> 2.3)
203
205
  language_server-protocol (~> 3.17.0.2)
204
206
  lint_roller (~> 1.1.0)
@@ -206,7 +208,7 @@ GEM
206
208
  parser (>= 3.3.0.2)
207
209
  rainbow (>= 2.2.2, < 4.0)
208
210
  regexp_parser (>= 2.9.3, < 3.0)
209
- rubocop-ast (>= 1.47.1, < 2.0)
211
+ rubocop-ast (>= 1.48.0, < 2.0)
210
212
  ruby-progressbar (~> 1.7)
211
213
  unicode-display_width (>= 2.4.0, < 4.0)
212
214
  rubocop-ast (1.48.0)
@@ -278,7 +280,8 @@ PLATFORMS
278
280
 
279
281
  DEPENDENCIES
280
282
  fbe!
281
- minitest (~> 5.25)
283
+ minitest (~> 6.0)
284
+ minitest-mock (~> 5.27)
282
285
  minitest-reporters (~> 1.7)
283
286
  minitest-stub-const (~> 0.6)
284
287
  os (~> 1.1)
@@ -396,38 +396,49 @@ class Fbe::Graph
396
396
  # @param [Time] since The datetime from
397
397
  # @return [Hash] A hash with total commits and hocs
398
398
  def total_commits_pushed(owner, name, since)
399
- # @todo #1223:60min Missing pagination could cause performance issues or API failures. You need add
400
- # pagination for commit history, for more info see
401
- # https://github.com/zerocracy/fbe/pull/366#discussion_r2610751758
402
- result = query(
403
- <<~GRAPHQL
404
- {
405
- repository(owner: "#{owner}", name: "#{name}") {
406
- defaultBranchRef {
407
- target {
408
- ... on Commit {
409
- history(since: "#{since.utc.iso8601}") {
410
- totalCount
411
- nodes {
412
- oid
413
- parents {
414
- totalCount
399
+ cursor = nil
400
+ total = 0
401
+ hoc = 0
402
+ loop do
403
+ after = "after: \"#{cursor}\", " unless cursor.nil?
404
+ result = query(
405
+ <<~GRAPHQL
406
+ {
407
+ repository(owner: "#{owner}", name: "#{name}") {
408
+ defaultBranchRef {
409
+ target {
410
+ ... on Commit {
411
+ history(#{after}first: 100, since: "#{since.utc.iso8601}") {
412
+ totalCount
413
+ nodes {
414
+ oid
415
+ parents {
416
+ totalCount
417
+ }
418
+ additions
419
+ deletions
420
+ }
421
+ pageInfo {
422
+ endCursor
423
+ hasNextPage
415
424
  }
416
- additions
417
- deletions
418
425
  }
419
426
  }
420
427
  }
421
428
  }
422
429
  }
423
430
  }
424
- }
425
- GRAPHQL
426
- ).to_h
427
- commits = result.dig('repository', 'defaultBranchRef', 'target', 'history', 'nodes')
431
+ GRAPHQL
432
+ ).to_h
433
+ commits = result.dig('repository', 'defaultBranchRef', 'target', 'history', 'nodes')
434
+ hoc += commits.nil? ? 0 : commits.sum { (_1['additions'] || 0) + (_1['deletions'] || 0) }
435
+ total = result.dig('repository', 'defaultBranchRef', 'target', 'history', 'totalCount') || 0
436
+ break unless result.dig('repository', 'defaultBranchRef', 'target', 'history', 'pageInfo', 'hasNextPage')
437
+ cursor = result.dig('repository', 'defaultBranchRef', 'target', 'history', 'pageInfo', 'endCursor')
438
+ end
428
439
  {
429
- 'commits' => result.dig('repository', 'defaultBranchRef', 'target', 'history', 'totalCount') || 0,
430
- 'hoc' => commits.nil? ? 0 : commits.sum { (_1['additions'] || 0) + (_1['deletions'] || 0) }
440
+ 'commits' => total,
441
+ 'hoc' => hoc
431
442
  }
432
443
  end
433
444
 
@@ -462,6 +473,44 @@ class Fbe::Graph
462
473
  }
463
474
  end
464
475
 
476
+ # Get total count releases from the specified date
477
+ #
478
+ # @param [String] owner The repository owner (username or organization)
479
+ # @param [String] name The repository name
480
+ # @param [Time] since The datetime from
481
+ # @return [Hash] A hash with total releases
482
+ def total_releases_published(owner, name, since)
483
+ total = 0
484
+ cursor = nil
485
+ loop do
486
+ result = query(
487
+ <<~GRAPHQL
488
+ {
489
+ repository(owner: "#{owner}", name: "#{name}") {
490
+ releases(first: 25, after: "#{cursor}", orderBy: { field: CREATED_AT, direction: DESC }) {
491
+ nodes {
492
+ isDraft
493
+ publishedAt
494
+ }
495
+ pageInfo {
496
+ endCursor
497
+ hasNextPage
498
+ }
499
+ }
500
+ }
501
+ }
502
+ GRAPHQL
503
+ ).to_h
504
+ releases = result.dig('repository', 'releases', 'nodes')
505
+ break if releases.nil? || releases.empty?
506
+ total += releases.count { !_1['isDraft'] && _1['publishedAt'] && Time.parse(_1['publishedAt']) > since }
507
+ break if releases.all? { _1['publishedAt'] && Time.parse(_1['publishedAt']) < since }
508
+ break unless result.dig('repository', 'releases', 'pageInfo', 'hasNextPage')
509
+ cursor = result.dig('repository', 'releases', 'pageInfo', 'endCursor')
510
+ end
511
+ { 'releases' => total }
512
+ end
513
+
465
514
  private
466
515
 
467
516
  # Creates or returns a cached GraphQL client instance.
@@ -704,6 +753,10 @@ class Fbe::Graph
704
753
  }
705
754
  end
706
755
 
756
+ def total_releases_published(_owner, _name, _since)
757
+ { 'releases' => 7 }
758
+ end
759
+
707
760
  private
708
761
 
709
762
  # Generates mock conversation thread data.
data/lib/fbe.rb CHANGED
@@ -10,5 +10,5 @@
10
10
  # License:: MIT
11
11
  module Fbe
12
12
  # Current version of the gem (changed by +.rultor.yml+ on every release)
13
- VERSION = '0.47.0' unless const_defined?(:VERSION)
13
+ VERSION = '0.48.1' unless const_defined?(:VERSION)
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.0
4
+ version: 0.48.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko