fbe 0.48.4 → 0.48.5

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: 2d0089866ec9064d80a2061dc5219b7a6804d028ffefe8e685547e09a3847284
4
- data.tar.gz: c2720200173179080383889a4dbc7f8445729296c0ba53f2695b74b502f8ebd3
3
+ metadata.gz: e54b9ecd59fd5bf0087090ec4d320a09e4468fd1d30c943968255992d37af3a9
4
+ data.tar.gz: d309db436c5f4902e1bfb50f6c32fbc93a5aeed57aa47653d60828079cb5540e
5
5
  SHA512:
6
- metadata.gz: '09035a890d7e838df5820a4e2cafa6d5333f31b743087855351041f788d5bd0d5ec9c8a454e79ca3bf0fe69f1286e97d8a87e4a6d8554e79f3c465e4acfcb0fa'
7
- data.tar.gz: c5800d374a1b0245a9fc55849d1b3e8d576fb84607b200020b08b14da63fce8f302dde9cee7d17652effc1144a105f9f1436c126332da0ef50bef680ee0ac100
6
+ metadata.gz: c0131eae4897865be58003cda673768124456e990e74be4650d671bb2038fb71fcf58fec08d7f2c922c3e694875abfbfc52f2a9584a3a54e4a9ca7a5ef5c2076
7
+ data.tar.gz: c68253c55d621d3ce8d7da0721f7e330532fe4b8eec18ef641acb801b57098c884307782fa31c2d403781a5b38afbbcaddb5574505eb6da4ab8be6587614a1ca
@@ -15,7 +15,7 @@ jobs:
15
15
  - uses: actions/checkout@v6
16
16
  - uses: ruby/setup-ruby@v1
17
17
  with:
18
- ruby-version: 4.0.2
18
+ ruby-version: 4.0.3
19
19
  bundler-cache: true
20
20
  - run: bundle config set --global path "$(pwd)/vendor/bundle"
21
21
  - run: bundle install --no-color
@@ -20,4 +20,4 @@ jobs:
20
20
  runs-on: ubuntu-24.04
21
21
  steps:
22
22
  - uses: actions/checkout@v6
23
- - uses: DavidAnson/markdownlint-cli2-action@v23.0.0
23
+ - uses: DavidAnson/markdownlint-cli2-action@v23.2.0
@@ -16,6 +16,6 @@ jobs:
16
16
  runs-on: ubuntu-24.04
17
17
  steps:
18
18
  - uses: actions/checkout@v6
19
- - uses: crate-ci/typos@v1.45.1
19
+ - uses: crate-ci/typos@v1.46.0
20
20
  with:
21
21
  config: .github/.typos.toml
data/Gemfile.lock CHANGED
@@ -152,7 +152,7 @@ GEM
152
152
  loog (0.8.0)
153
153
  ellipsized
154
154
  logger (~> 1.0)
155
- minitest (6.0.4)
155
+ minitest (6.0.6)
156
156
  drb (~> 2.0)
157
157
  prism (~> 1.5)
158
158
  minitest-mock (5.27.0)
@@ -190,7 +190,7 @@ GEM
190
190
  date
191
191
  stringio
192
192
  public_suffix (7.0.5)
193
- qbash (0.8.2)
193
+ qbash (0.8.3)
194
194
  backtrace (> 0)
195
195
  elapsed (> 0)
196
196
  loog (> 0)
@@ -219,7 +219,7 @@ GEM
219
219
  rubocop-ast (1.49.1)
220
220
  parser (>= 3.3.7.2)
221
221
  prism (~> 1.7)
222
- rubocop-elegant (0.0.15)
222
+ rubocop-elegant (0.0.16)
223
223
  lint_roller (~> 1.1)
224
224
  rubocop (~> 1.75)
225
225
  rubocop-minitest (0.39.1)
@@ -274,7 +274,7 @@ GEM
274
274
  crack (>= 0.3.2)
275
275
  hashdiff (>= 0.4.0, < 2.0.0)
276
276
  yaml (0.4.0)
277
- yard (0.9.41)
277
+ yard (0.9.43)
278
278
 
279
279
  PLATFORMS
280
280
  arm64-darwin-22
data/README.md CHANGED
@@ -15,7 +15,7 @@ It's a collection of tools for
15
15
  You are not supposed to use it directly, but only in a combination
16
16
  with other tools of Zerocracy.
17
17
 
18
- The following tools runs a block:
18
+ The following tools run a block:
19
19
 
20
20
  * `Fbe.regularly` runs a block of code every X days.
21
21
  * `Fbe.conclude` runs a block on every fact from a query.
@@ -1,5 +1,5 @@
1
1
  (award
2
- (explain "If a branch has a name that doesn\\\'t obey the convention, a penalty is given to the author")
2
+ (explain "If a branch has a name that doesn\'t obey the convention, a penalty is given to the author")
3
3
  (aka
4
4
  (let fee {{ -6 | times: anger }})
5
5
  (give fee "as a basis")
data/lib/fbe/conclude.rb CHANGED
@@ -36,16 +36,16 @@ end
36
36
  # A concluding block.
37
37
  #
38
38
  # You may want to use this class when you want to go through a number
39
- # of facts in the factbase, applying certain algorithm to each of them
39
+ # of facts in the factbase, applying a certain algorithm to each of them
40
40
  # and possibly creating new facts from them.
41
41
  #
42
42
  # For example, you want to make a new +good+ fact for every +bad+ fact found:
43
43
  #
44
44
  # require 'fbe/conclude'
45
45
  # conclude do
46
- # on '(exist bad)'
46
+ # on '(exists bad)'
47
47
  # follow 'when'
48
- # draw on |n, b|
48
+ # draw do |n, b|
49
49
  # n.good = 'yes!'
50
50
  # end
51
51
  # end
@@ -132,9 +132,9 @@ class Fbe::Conclude
132
132
  #
133
133
  # require 'fbe/conclude'
134
134
  # conclude do
135
- # on '(exist win)'
135
+ # on '(exists win)'
136
136
  # follow 'win when'
137
- # draw on |n, w|
137
+ # draw do |n, w|
138
138
  # n.reward = 10
139
139
  # end
140
140
  # end
@@ -161,7 +161,7 @@ class Fbe::Conclude
161
161
  # require 'fbe/conclude'
162
162
  # conclude do
163
163
  # on '(always)'
164
- # consider on |f|
164
+ # consider do |f|
165
165
  # f.when = Time.new
166
166
  # end
167
167
  # end
@@ -208,7 +208,12 @@ class Fbe::Conclude
208
208
  )
209
209
  @fb.txn do |fbt|
210
210
  n = yield(fbt, a)
211
- @loog.info("#{n.what}: #{n.details}") unless n.nil?
211
+ unless n.nil?
212
+ props = n.all_properties
213
+ if props.include?('what') && props.include?('details')
214
+ @loog.info("#{n.what}: #{n.details}")
215
+ end
216
+ end
212
217
  end
213
218
  passed += 1
214
219
  end
@@ -287,11 +287,12 @@ class Fbe::Graph # rubocop:disable Metrics/ClassLength
287
287
  # cursor = json['next_cursor']
288
288
  # end
289
289
  def pull_requests_with_reviews(owner, name, since, cursor: nil)
290
+ after = "after: \"#{cursor}\", " unless cursor.nil?
290
291
  result = query(
291
292
  <<~GRAPHQL
292
293
  {
293
294
  repository(owner: "#{owner}", name: "#{name}") {
294
- pullRequests(first: 100, after: "#{cursor}") {
295
+ pullRequests(#{after}first: 100) {
295
296
  nodes {
296
297
  id
297
298
  number
@@ -310,16 +311,16 @@ class Fbe::Graph # rubocop:disable Metrics/ClassLength
310
311
  }
311
312
  GRAPHQL
312
313
  ).to_h
314
+ nodes = result.dig('repository', 'pullRequests', 'nodes')
315
+ raise(Fbe::Error, "Repository '#{owner}/#{name}' not found") if nodes.nil?
313
316
  {
314
- 'pulls_with_reviews' => result
315
- .dig('repository', 'pullRequests', 'nodes')
316
- .filter_map do |pull|
317
- next if pull.dig('timelineItems', 'nodes').empty?
318
- {
319
- 'id' => pull['id'],
320
- 'number' => pull['number']
321
- }
322
- end,
317
+ 'pulls_with_reviews' => nodes.filter_map do |pull|
318
+ next if pull.dig('timelineItems', 'nodes').empty?
319
+ {
320
+ 'id' => pull['id'],
321
+ 'number' => pull['number']
322
+ }
323
+ end,
323
324
  'has_next_page' => result.dig('repository', 'pullRequests', 'pageInfo', 'hasNextPage'),
324
325
  'next_cursor' => result.dig('repository', 'pullRequests', 'pageInfo', 'endCursor')
325
326
  }
@@ -349,11 +350,12 @@ class Fbe::Graph # rubocop:disable Metrics/ClassLength
349
350
  def pull_request_reviews(owner, name, pulls: [])
350
351
  requests =
351
352
  pulls.map do |number, cursor|
353
+ after = "after: \"#{cursor}\", " unless cursor.nil?
352
354
  <<~GRAPHQL
353
355
  pr_#{number}: pullRequest(number: #{number}) {
354
356
  id
355
357
  number
356
- reviews(first: 100, after: "#{cursor}") {
358
+ reviews(#{after}first: 100) {
357
359
  nodes {
358
360
  id
359
361
  submittedAt
data/lib/fbe/iterate.rb CHANGED
@@ -105,28 +105,27 @@ class Fbe::Iterate
105
105
  @timeout = true
106
106
  end
107
107
 
108
- # Makes the iterator aware of GitHub API quota limits.
108
+ # Makes the iterator unaware of GitHub API quota limits.
109
109
  #
110
- # When enabled, the iterator will check quota status before processing
111
- # each repository and gracefully stop when the quota is exhausted.
112
- # This prevents API errors and allows for resuming later.
110
+ # When disabled, the iterator will not check quota status before processing
111
+ # each repository and will not gracefully stop when the quota is exhausted.
113
112
  #
114
113
  # @return [nil] Nothing is returned
115
- # @example Enable quota awareness
116
- # iterator.quota_aware
117
- # iterator.over { |repo, item| ... } # Will stop if quota exhausted
114
+ # @example Disable quota awareness
115
+ # iterator.quota_unaware
116
+ # iterator.over { |repo, item| ... } # Will not stop on quota exhaustion
118
117
  def quota_unaware
119
118
  @quota = false
120
119
  end
121
120
 
122
- # Makes the iterator aware of lifetime limits.
121
+ # Makes the iterator unaware of lifetime limits.
123
122
  #
124
123
  # @return [nil] Nothing is returned
125
124
  def lifetime_unaware
126
125
  @lifetime = false
127
126
  end
128
127
 
129
- # Makes the iterator aware of timeout limits.
128
+ # Makes the iterator unaware of timeout limits.
130
129
  #
131
130
  # @return [nil] Nothing is returned
132
131
  def timeout_unaware
@@ -313,7 +312,13 @@ class Fbe::Iterate
313
312
  @since
314
313
  else
315
314
  @loog.debug("Next is ##{nxt}, starting from it")
316
- yield(repo, nxt)
315
+ begin
316
+ yield(repo, nxt)
317
+ rescue Fbe::OffQuota
318
+ raise
319
+ rescue StandardError => e
320
+ raise(e.class, "Failure in repository ##{repo} at ##{nxt}: #{e.message}")
321
+ end
317
322
  end
318
323
  unless before[repo].is_a?(Integer)
319
324
  raise(Fbe::Error, "Iterator must return an Integer, but #{before[repo].class} was returned")
@@ -39,6 +39,19 @@ require_relative '../../fbe/middleware'
39
39
  # Copyright:: Copyright (c) 2024-2026 Zerocracy
40
40
  # License:: MIT
41
41
  class Fbe::Middleware::Formatter < Faraday::Logging::Formatter
42
+ # Registers a filter that masks the credential portion of an
43
+ # `Authorization` header so live tokens never reach the log.
44
+ # Matches any auth scheme: `Authorization: "Bearer xxx"`,
45
+ # `Authorization: "Basic yyy"`, etc. The scheme is preserved,
46
+ # the credential is replaced with `[FILTERED]`.
47
+ #
48
+ # @param [Logger] logger The Faraday-supplied logger
49
+ # @param [Hash] options Faraday formatter options
50
+ def initialize(logger:, options:)
51
+ super
52
+ filter(/(Authorization:\s*"?\s*\S+\s+)[^"\s]+/i, '\1[FILTERED]')
53
+ end
54
+
42
55
  # Captures HTTP request details for later use in error logging.
43
56
  #
44
57
  # @param [Hash] http Request data including method, url, headers, and body
data/lib/fbe/regularly.rb CHANGED
@@ -55,7 +55,7 @@ def Fbe.regularly(area, p_every_days, p_since_days = nil, fb: Fbe.fb, judge: $ju
55
55
  f.what = judge
56
56
  f.when = Time.now
57
57
  unless p_since_days.nil?
58
- days = pmp.nil? ? 28 : pmp[p_since_days].first
58
+ days = pmp.nil? || pmp[p_since_days].nil? ? 28 : pmp[p_since_days].first
59
59
  since = Time.now - (days * 24 * 60 * 60)
60
60
  f.since = since
61
61
  end
data/lib/fbe.rb CHANGED
@@ -9,6 +9,6 @@
9
9
  # Copyright:: Copyright (c) 2024-2026 Zerocracy
10
10
  # License:: MIT
11
11
  module Fbe
12
- VERSION = '0.48.4' unless const_defined?(:VERSION)
12
+ VERSION = '0.48.5' unless const_defined?(:VERSION)
13
13
  class Error < StandardError; end
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.48.4
4
+ version: 0.48.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko