checkoff 0.257.0 → 0.258.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: 1896715fc41d51e76c6c1381eed1a4b3cd72ee304a75b36d1a26bfe42d0ee158
4
- data.tar.gz: 07f5cc66320360ebc668d21adc062585fb6927b029872b99f0416f30b7986387
3
+ metadata.gz: cacf5e2fbe9fab040accd8cd51804fcf3f07cf0e6f050c93ecbe2da2c930bdc5
4
+ data.tar.gz: ebfe6f20e1be062a918afac5a4703df7a0d5205c69cb8d0479d5f6427c467767
5
5
  SHA512:
6
- metadata.gz: 161d6849b466f214b62ee2c04d2188bd672323560ff37fd99709166efb920aea03aec8f5255835b2b938ee6c0036c847e40d57a509ccaeded3f03b5bda98d603
7
- data.tar.gz: 16acaccaea9884fbfe513ac8dfe6f9bb30f72342deba8d88a335a3f391d8fb18fd61d8034731346b5e6015ef9c0fb125e3153599dfe2eeb76dfd4ed6ff0ccfe3
6
+ metadata.gz: cddee9806d41d98908eca0331b3b52ee84b45968e419aad7b8817003389418f65e9536b02c2db20b2368796b447046b7093819b094ba01dcd7c59875eb404562
7
+ data.tar.gz: 82b6db32f7d6ad50d287da1fba1a537468f94aa283d60358fcf4a03953df86c41dc00da2dd514cfdbd838bd5ce2209f11e97966f00814e27fe1640cf8ad41cb3
data/lib/checkoff/cli.rb CHANGED
@@ -192,7 +192,7 @@ module Checkoff
192
192
  elsif task_name.nil?
193
193
  run_on_section(workspace_name, project_name, section_name)
194
194
  else
195
- # @sg-ignore
195
+ # @sg-ignore task_name.nil? above isn't inferred as narrowing the task_name accessor's return
196
196
  run_on_task(workspace_name, project_name, section_name, task_name)
197
197
  end
198
198
  end
@@ -312,7 +312,7 @@ module Checkoff
312
312
  arg 'workspace'
313
313
  arg 'task_name'
314
314
  command :quickadd do |c|
315
- # @sg-ignore
315
+ # @sg-ignore GLI's DSL block methods (c.flag/c.action) aren't resolved
316
316
  c.action do |_global_options, _options, args|
317
317
  workspace_name = args.fetch(0)
318
318
  task_name = args.fetch(1)
@@ -327,7 +327,7 @@ module Checkoff
327
327
  arg 'section', :optional
328
328
  arg 'task_name', :optional
329
329
  command :view do |c|
330
- # @sg-ignore
330
+ # @sg-ignore GLI's DSL block methods (c.flag/c.action) aren't resolved
331
331
  c.action do |_global_options, _options, args|
332
332
  workspace_name = args.fetch(0)
333
333
  project_name = args.fetch(1)
@@ -342,37 +342,37 @@ module Checkoff
342
342
 
343
343
  # rubocop:disable Metrics/BlockLength
344
344
  command :mv do |c|
345
- # @sg-ignore
345
+ # @sg-ignore GLI's DSL block methods (c.flag/c.action) aren't resolved
346
346
  c.flag :from_workspace,
347
347
  type: String,
348
348
  default_value: :default_workspace,
349
349
  desc: 'Workspace to move tasks from'
350
- # @sg-ignore
350
+ # @sg-ignore GLI's DSL block methods (c.flag/c.action) aren't resolved
351
351
  c.flag :from_project,
352
352
  type: String,
353
353
  required: true,
354
354
  desc: 'Project to move tasks from'
355
- # @sg-ignore
355
+ # @sg-ignore GLI's DSL block methods (c.flag/c.action) aren't resolved
356
356
  c.flag :from_section,
357
357
  type: String,
358
358
  default_value: :all_sections,
359
359
  desc: 'Section to move tasks from'
360
- # @sg-ignore
360
+ # @sg-ignore GLI's DSL block methods (c.flag/c.action) aren't resolved
361
361
  c.flag :to_workspace,
362
362
  type: String,
363
363
  default_value: :source_workspace,
364
364
  desc: 'Workspace to move tasks to'
365
- # @sg-ignore
365
+ # @sg-ignore GLI's DSL block methods (c.flag/c.action) aren't resolved
366
366
  c.flag :to_project,
367
367
  type: String,
368
368
  default_value: :source_project,
369
369
  desc: 'Section to move tasks to'
370
- # @sg-ignore
370
+ # @sg-ignore GLI's DSL block methods (c.flag/c.action) aren't resolved
371
371
  c.flag :to_section,
372
372
  type: String,
373
373
  default_value: :source_section,
374
374
  desc: 'Section to move tasks to'
375
- # @sg-ignore
375
+ # @sg-ignore GLI's DSL block methods (c.flag/c.action) aren't resolved
376
376
  c.action do |_global_options, options, _args|
377
377
  from_workspace = options.fetch('from_workspace')
378
378
  from_project = options.fetch('from_project')
@@ -155,10 +155,8 @@ module Checkoff
155
155
  resource_subtype = custom_field.fetch('resource_subtype')
156
156
  case resource_subtype
157
157
  when 'enum'
158
- # @type [Array<Hash>]
159
158
  [custom_field.fetch('enum_value')]
160
159
  when 'multi_enum'
161
- # @type [Array<Hash>]
162
160
  custom_field.fetch('multi_enum_values')
163
161
  else
164
162
  raise "Teach me how to handle resource_subtype #{resource_subtype}"
@@ -143,8 +143,12 @@ module Checkoff
143
143
  return unless parent
144
144
 
145
145
  # @type [String]
146
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
147
+ # https://github.com/castwide/solargraph/pull/1228
146
148
  resource_type = parent.fetch('resource_type')
147
149
  # @type [String]
150
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
151
+ # https://github.com/castwide/solargraph/pull/1228
148
152
  gid = parent.fetch('gid')
149
153
  name, _resource_type = enrich_gid(gid, resource_type:)
150
154
  parent['checkoff:enriched:name'] = name if name
@@ -159,9 +163,13 @@ module Checkoff
159
163
  # @type [Hash{String => String}]
160
164
  resource = T.cast(asana_event['resource'], T::Hash[String, String])
161
165
  # @type [String]
166
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
167
+ # https://github.com/castwide/solargraph/pull/1228
162
168
  resource_type = resource.fetch('resource_type')
163
169
 
164
170
  # @type [String]
171
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
172
+ # https://github.com/castwide/solargraph/pull/1228
165
173
  gid = resource.fetch('gid')
166
174
 
167
175
  name, _resource_type = enrich_gid(gid, resource_type:)
@@ -122,6 +122,8 @@ module Checkoff
122
122
  # @type [Hash{String => String}]
123
123
  resource = asana_event.fetch('resource')
124
124
  # @type [String]
125
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
126
+ # https://github.com/castwide/solargraph/pull/1228
125
127
  resource_type = resource.fetch('resource_type')
126
128
  unless resource_type == 'task'
127
129
  raise "Teach me how to check #{key.inspect} on resource type #{resource_type.inspect}"
@@ -131,6 +133,8 @@ module Checkoff
131
133
  options = {
132
134
  fields:,
133
135
  }
136
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
137
+ # https://github.com/castwide/solargraph/pull/1228
134
138
  @client.tasks.find_by_id(task_gid, options:)
135
139
  rescue Asana::Errors::NotFound
136
140
  nil
@@ -59,19 +59,20 @@ module Checkoff
59
59
  # @param gid [String]
60
60
  # @param single_custom_field_params [Hash{String => Array<String>}]
61
61
  # @return [Array(Hash{String => String}, Array<Symbol, Array>)]
62
- # @sg-ignore
62
+ # @sg-ignore `unless variant_class.nil?` return value isn't inferred as the declared tuple type
63
63
  def convert_single_custom_field_params(gid, single_custom_field_params)
64
64
  variant_key = "custom_field_#{gid}.variant"
65
65
  variant = single_custom_field_params.fetch(variant_key)
66
66
  remaining_params = single_custom_field_params.reject { |k, _v| k == variant_key }
67
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
68
+ # https://github.com/castwide/solargraph/pull/1228
67
69
  raise "Teach me how to handle #{variant_key} = #{variant}" unless variant.length == 1
68
70
 
69
- # @sg-ignore
70
- # @type [Class<CustomFieldVariant>]
71
- # @sg-ignore
71
+ # @type [Class<CustomFieldVariant>, nil]
72
+ # @sg-ignore variant.length == 1 guard above isn't inferred as narrowing variant[0] to non-nil
72
73
  variant_class = VARIANTS[variant[0]]
73
74
  # @type [Array(Hash{String => String}, Array<Symbol, Array>)]
74
- # @sg-ignore
75
+ # @sg-ignore `unless variant_class.nil?` isn't inferred as narrowing the receiver in the same statement
75
76
  return variant_class.new(gid, remaining_params).convert unless variant_class.nil?
76
77
 
77
78
  raise "Teach me how to handle #{variant_key} = #{variant}"
@@ -79,9 +80,9 @@ module Checkoff
79
80
 
80
81
  # @param key [String]
81
82
  # @return [String]
82
- # @sg-ignore
83
+ # @sg-ignore split(...)[n]'s nilable Array indexing isn't inferred as the declared String return
83
84
  def gid_from_custom_field_key(key)
84
- # @sg-ignore
85
+ # @sg-ignore split(...)[n] is nilable Array indexing; key's shape guarantees enough parts here
85
86
  key.split('_')[2].split('.')[0]
86
87
  end
87
88
 
@@ -37,6 +37,8 @@ module Checkoff
37
37
  case remaining_params.keys
38
38
  when [param_name]
39
39
  # @type param_values [Array<String>]
40
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
41
+ # https://github.com/castwide/solargraph/pull/1228
40
42
  param_values = remaining_params.fetch(param_name)
41
43
  unless param_values.length == 1
42
44
  raise "Teach me how to handle these remaining keys for #{param_name}: #{remaining_params}"
@@ -15,7 +15,7 @@ module Checkoff
15
15
  end
16
16
 
17
17
  # @return [Array(Hash{String => String}, Array<Symbol, Array>)]
18
- # @sg-ignore
18
+ # @sg-ignore out can genuinely be nil if none of the 3 known prefixes matched; relies on the raise above it
19
19
  def convert
20
20
  return [{}, []] if date_url_params.empty?
21
21
 
@@ -129,15 +129,19 @@ module Checkoff
129
129
  end
130
130
 
131
131
  # @param param_key [String]
132
- # @sg-ignore
133
132
  # @return [String]
133
+ # @sg-ignore value.length == 1 guard above isn't inferred as narrowing value[0] to non-nil
134
134
  def get_single_param(param_key)
135
135
  raise "Expected #{param_key} to have at least one value" unless date_url_params.key? param_key
136
136
 
137
137
  value = date_url_params.fetch(param_key)
138
138
 
139
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
140
+ # https://github.com/castwide/solargraph/pull/1228
139
141
  raise "Expected #{param_key} to have one value" if value.length != 1
140
142
 
143
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
144
+ # https://github.com/castwide/solargraph/pull/1228
141
145
  value[0]
142
146
  end
143
147
 
@@ -154,6 +158,8 @@ module Checkoff
154
158
  def validate_unit_is_day!(prefix)
155
159
  unit = date_url_params.fetch("#{prefix}.unit").fetch(0)
156
160
 
161
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
162
+ # https://github.com/castwide/solargraph/pull/1228
157
163
  raise "Teach me how to handle other time units: #{unit}" unless unit == 'day'
158
164
  end
159
165
 
@@ -31,6 +31,16 @@ module Checkoff
31
31
  end
32
32
  end
33
33
 
34
+ public
35
+
36
+ # @return [Array<String>]
37
+ # @sg-ignore abstract method always raises; declared type documents the override contract, not this body
38
+ def convert
39
+ raise 'Implement me!'
40
+ end
41
+
42
+ private
43
+
34
44
  # @return [String]
35
45
  attr_reader :key
36
46
 
@@ -226,7 +236,6 @@ module Checkoff
226
236
  # @return [Hash{String => String}] the converted params
227
237
  def convert
228
238
  # @type [Array<Array(String, String)>]
229
- # @sg-ignore
230
239
  arr_of_tuples = simple_url_params.to_a.flat_map do |key, values|
231
240
  # @type
232
241
  entry = convert_arg(key, values).each_slice(2).to_a
@@ -265,14 +274,14 @@ module Checkoff
265
274
  # https://developers.asana.com/docs/search-tasks-in-a-workspace
266
275
  # @param key [String] the name of the search url param
267
276
  # @param values [Array<String>] the values of the search url param
268
- # @sg-ignore
269
- # @return [Hash{String => String}] the converted params
277
+ # @return [Array<String>] the converted params, as an alternating key/value flat array
270
278
  def convert_arg(key, values)
271
279
  # @type [Class<SimpleParam::SimpleParam>]
280
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
281
+ # https://github.com/castwide/solargraph/pull/1228
272
282
  clazz = ARGS.fetch(key)
273
283
  # @type [SimpleParam::SimpleParam]
274
284
  obj = clazz.new(key:, values:)
275
- # @sg-ignore
276
285
  obj.convert
277
286
  end
278
287
 
@@ -17,6 +17,9 @@ module Checkoff
17
17
  super()
18
18
  end
19
19
 
20
+ # @return [Checkoff::CustomFields]
21
+ attr_reader :custom_fields
22
+
20
23
  private
21
24
 
22
25
  # @return [Array(Symbol, Array), String]
@@ -105,12 +105,9 @@ module Checkoff
105
105
  # @param custom_field_name [String]
106
106
  # @return [String, nil]
107
107
  def evaluate(resource, custom_field_name)
108
- # @sg-ignore
109
- custom_field = @custom_fields.resource_custom_field_by_name(resource, custom_field_name)
110
- # @sg-ignore
108
+ custom_field = custom_fields.resource_custom_field_by_name(resource, custom_field_name)
111
109
  return nil if custom_field.nil?
112
110
 
113
- # @sg-ignore
114
111
  custom_field['display_value']
115
112
  end
116
113
  end
@@ -125,17 +122,13 @@ module Checkoff
125
122
  false
126
123
  end
127
124
 
128
- # @sg-ignore
129
125
  # @param resource [Asana::Resources::Task,Asana::Resources::Project]
130
- # @sg-ignore
131
126
  # @param custom_field_gid [String]
132
127
  # @return [String, nil]
133
- # @sg-ignore
134
128
  def evaluate(resource, custom_field_gid)
135
- # @sg-ignore
136
- custom_field = @custom_fields.resource_custom_field_by_gid_or_raise(resource, custom_field_gid)
137
- # @sg-ignore
138
- custom_field['display_value']
129
+ custom_field = custom_fields.resource_custom_field_by_gid_or_raise(resource, custom_field_gid)
130
+ display_value = custom_field['display_value']
131
+ display_value.nil? ? nil : T.cast(display_value, String)
139
132
  end
140
133
  end
141
134
 
@@ -152,17 +145,13 @@ module Checkoff
152
145
  end
153
146
 
154
147
  # @param resource [Asana::Resources::Task,Asana::Resources::Project]
155
- # @sg-ignore
156
148
  # @param custom_field_gid [String]
157
149
  # @param custom_field_values_gids [Array<String>]
158
150
  # @return [Boolean]
159
- # @sg-ignore
160
151
  def evaluate(resource, custom_field_gid, custom_field_values_gids)
161
- # @sg-ignore
162
- actual_custom_field_values_gids = @custom_fields.resource_custom_field_values_gids_or_raise(resource,
163
- custom_field_gid)
152
+ actual_custom_field_values_gids = custom_fields.resource_custom_field_values_gids_or_raise(resource,
153
+ custom_field_gid)
164
154
 
165
- # @sg-ignore
166
155
  actual_custom_field_values_gids.intersect?(custom_field_values_gids)
167
156
  end
168
157
  end
@@ -181,17 +170,13 @@ module Checkoff
181
170
 
182
171
  # @param resource [Asana::Resources::Task,Asana::Resources::Project]
183
172
  # @param custom_field_name [String]
184
- # @sg-ignore
185
173
  # @param custom_field_value_names [Array<String>]
186
- # @sg-ignore
187
174
  # @return [Boolean]
188
175
  def evaluate(resource, custom_field_name, custom_field_value_names)
189
176
  actual_custom_field_values_names =
190
- # @sg-ignore
191
- @custom_fields.resource_custom_field_values_names_by_name(resource,
192
- custom_field_name)
177
+ custom_fields.resource_custom_field_values_names_by_name(resource,
178
+ custom_field_name)
193
179
 
194
- # @sg-ignore
195
180
  actual_custom_field_values_names.intersect?(custom_field_value_names)
196
181
  end
197
182
  end
@@ -214,12 +199,10 @@ module Checkoff
214
199
  # @return [Boolean]
215
200
  def evaluate(resource, custom_field_gid, custom_field_values_gids)
216
201
  actual_custom_field_values_gids =
217
- # @sg-ignore
218
- @custom_fields.resource_custom_field_values_gids_or_raise(resource,
219
- custom_field_gid)
202
+ custom_fields.resource_custom_field_values_gids_or_raise(resource,
203
+ custom_field_gid)
220
204
 
221
205
  custom_field_values_gids.all? do |custom_field_value|
222
- # @sg-ignore
223
206
  actual_custom_field_values_gids.include?(custom_field_value)
224
207
  end
225
208
  end
@@ -255,9 +238,9 @@ module Checkoff
255
238
 
256
239
  # @param _resource [Asana::Resources::Task,Asana::Resources::Project]
257
240
  # @return [String]
258
- # @sg-ignore
241
+ # @sg-ignore selector is only String here per matches?'s is_a?(String) check, in another method
259
242
  def evaluate(_resource)
260
- T.cast(selector, String)
243
+ selector
261
244
  end
262
245
  end
263
246
  end
@@ -9,6 +9,17 @@ module Checkoff
9
9
  class FunctionEvaluator
10
10
  include Logging
11
11
 
12
+ # Concrete subclasses each declare their own initialize with their
13
+ # specific keyword args (and set @selector themselves before calling
14
+ # super()); this signature exists only so Solargraph can resolve
15
+ # `evaluator_class.new(selector:, **kwargs)` call sites that hold a
16
+ # `Class<FunctionEvaluator>` reference rather than a concrete subclass -
17
+ # deliberately a no-op so a bare `super()` call from those subclasses
18
+ # can't clobber the @selector they already set.
19
+ # @param selector [Symbol, Array, String, nil]
20
+ # @param _kwargs [Hash]
21
+ def initialize(selector: nil, **_kwargs); end
22
+
12
23
  # @param _index [Integer]
13
24
  def evaluate_arg?(_index)
14
25
  true
@@ -25,6 +25,15 @@ module Checkoff
25
25
  super()
26
26
  end
27
27
 
28
+ # @return [Checkoff::Projects]
29
+ attr_reader :projects
30
+
31
+ # @return [Checkoff::Portfolios]
32
+ attr_reader :portfolios
33
+
34
+ # @return [Checkoff::Workspaces]
35
+ attr_reader :workspaces
36
+
28
37
  private
29
38
 
30
39
  # @return [Array(Symbol, Array)]
@@ -17,7 +17,7 @@ module Checkoff
17
17
 
18
18
  # @param resource [Asana::Resources::Project]
19
19
  # @return [String, nil]
20
- # @sg-ignore
20
+ # @sg-ignore nilable return from an @!parse-declared method isn't inferred
21
21
  def evaluate(resource)
22
22
  resource.due_date
23
23
  end
@@ -33,11 +33,9 @@ module Checkoff
33
33
 
34
34
  # @param project [Asana::Resources::Project]
35
35
  # @param period [Symbol] - :now_or_before or :this_week
36
- # @sg-ignore
37
36
  # @return [Boolean]
38
37
  def evaluate(project, period = :now_or_before)
39
- # @sg-ignore
40
- @projects.project_ready?(project, period:)
38
+ projects.project_ready?(project, period:)
41
39
  end
42
40
  end
43
41
 
@@ -53,19 +51,14 @@ module Checkoff
53
51
  # @param portfolio_name [String]
54
52
  # @param workspace_name [String, nil]
55
53
  # @param extra_project_fields [Array<String>]
56
- # @sg-ignore
57
54
  #
58
- # @sg-ignore
59
55
  # @return [Boolean]
60
56
  def evaluate(project, portfolio_name, workspace_name: nil, extra_project_fields: [])
61
57
  workspace_name ||= project.workspace&.name
62
- # @sg-ignore
63
- workspace_name ||= @workspaces.default_workspace.name
64
- # @sg-ignore
65
- projects = @portfolios.projects_in_portfolio(workspace_name, portfolio_name,
66
- extra_project_fields:)
67
- # @sg-ignore
68
- projects.any? { |p| p.name == project.name }
58
+ workspace_name ||= workspaces.default_workspace.name
59
+ matching_projects = portfolios.projects_in_portfolio(T.must(workspace_name), portfolio_name,
60
+ extra_project_fields:)
61
+ matching_projects.any? { |p| p.name == project.name }
69
62
  end
70
63
  end
71
64
  end
@@ -22,13 +22,16 @@ module Checkoff
22
22
  super()
23
23
  end
24
24
 
25
+ # @return [Checkoff::Sections]
26
+ attr_reader :sections
27
+
28
+ # @return [Asana::Client]
29
+ attr_reader :client
30
+
25
31
  private
26
32
 
27
33
  # @return [Array(Symbol, Array)]
28
34
  attr_reader :selector
29
-
30
- # @return [Asana::Client]
31
- attr_reader :client
32
35
  end
33
36
  end
34
37
  end
@@ -18,7 +18,7 @@ module Checkoff
18
18
  # @param section [Asana::Resources::Section]
19
19
  #
20
20
  # @return [Boolean]
21
- # @sg-ignore
21
+ # @sg-ignore String, nil safe-nav chain isn't inferred as returning Boolean
22
22
  def evaluate(section)
23
23
  tasks = client.tasks.get_tasks(section: section.gid,
24
24
  per_page: 100,
@@ -37,11 +37,9 @@ module Checkoff
37
37
 
38
38
  # @param section [Asana::Resources::Section]
39
39
  #
40
- # @sg-ignore
41
40
  # @return [Boolean]
42
41
  def evaluate(section)
43
- # @sg-ignore
44
- @sections.tasks_by_section_gid(section.gid).any?
42
+ sections.tasks_by_section_gid(section.gid).any?
45
43
  end
46
44
  end
47
45
  end
@@ -24,8 +24,12 @@ module Checkoff
24
24
  # @type [Hash{'unwrapped' => Hash}]
25
25
  task_data = tasks.task_to_h(task)
26
26
  # @type [Hash{'membership_by_project_name' => Hash}]
27
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
28
+ # https://github.com/castwide/solargraph/pull/1228
27
29
  unwrapped = task_data.fetch('unwrapped')
28
30
  # @type [Array]
31
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
32
+ # https://github.com/castwide/solargraph/pull/1228
29
33
  projects = unwrapped.fetch('membership_by_project_name').keys
30
34
  !(projects - [:my_tasks]).empty?
31
35
  end
@@ -45,10 +49,18 @@ module Checkoff
45
49
  # @param task [Asana::Resources::Task]
46
50
  # @param section_name_prefix [String]
47
51
  # @return [Boolean]
48
- # @sg-ignore
49
52
  def evaluate(task, section_name_prefix)
53
+ # @type [Hash{'unwrapped' => Hash}]
50
54
  task_data = tasks.task_to_h(task)
51
- task_data.fetch('unwrapped').fetch('membership_by_section_name').keys.any? do |section_name|
55
+ # @type [Hash{'membership_by_section_name' => Hash}]
56
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
57
+ # https://github.com/castwide/solargraph/pull/1228
58
+ unwrapped = task_data.fetch('unwrapped')
59
+ # @type [Array]
60
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
61
+ # https://github.com/castwide/solargraph/pull/1228
62
+ section_names = unwrapped.fetch('membership_by_section_name').keys
63
+ section_names.any? do |section_name|
52
64
  String(section_name).start_with?(section_name_prefix)
53
65
  end
54
66
  end
@@ -65,13 +77,21 @@ module Checkoff
65
77
  false
66
78
  end
67
79
 
68
- # @sg-ignore
69
80
  # @param task [Asana::Resources::Task]
70
81
  # @param section_name [String]
71
82
  # @return [Boolean]
72
83
  def evaluate(task, section_name)
84
+ # @type [Hash{'unwrapped' => Hash}]
73
85
  task_data = tasks.task_to_h(task)
74
- task_data.fetch('unwrapped').fetch('membership_by_section_name').keys.any?(section_name)
86
+ # @type [Hash{'membership_by_section_name' => Hash}]
87
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
88
+ # https://github.com/castwide/solargraph/pull/1228
89
+ unwrapped = task_data.fetch('unwrapped')
90
+ # @type [Array]
91
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
92
+ # https://github.com/castwide/solargraph/pull/1228
93
+ section_names = unwrapped.fetch('membership_by_section_name').keys
94
+ section_names.any?(section_name)
75
95
  end
76
96
  end
77
97
 
@@ -89,13 +109,15 @@ module Checkoff
89
109
  # @param task [Asana::Resources::Task]
90
110
  # @param project_name [String]
91
111
  # @return [Boolean]
92
- # @sg-ignore
112
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
113
+ # https://github.com/castwide/solargraph/pull/1228
93
114
  def evaluate(task, project_name)
94
115
  project_names = task.memberships.map do |membership|
95
- m = T.cast(membership, T::Hash[String, T.untyped])
96
- T.cast(m.fetch('project'), T::Hash[String, T.untyped]).fetch('name')
116
+ # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
117
+ # https://github.com/castwide/solargraph/pull/1228
118
+ membership.fetch('project').fetch('name')
97
119
  end
98
- T.cast(project_names.include?(project_name), T::Boolean)
120
+ project_names.include?(project_name)
99
121
  end
100
122
  end
101
123
 
@@ -132,9 +154,11 @@ module Checkoff
132
154
  # @param task [Asana::Resources::Task]
133
155
  # @param tag_name [String]
134
156
  # @return [Boolean]
135
- # @sg-ignore
136
157
  def evaluate(task, tag_name)
137
- task.tags.map(&:name).include? tag_name
158
+ # @type [Array<Asana::Resources::Tag>]
159
+ tags = task.tags.to_a
160
+ tag_names = tags.map(&:name)
161
+ tag_names.include?(tag_name)
138
162
  end
139
163
  end
140
164
 
@@ -235,13 +259,13 @@ module Checkoff
235
259
 
236
260
  # @type [Array<Asana::Resources::Story>]
237
261
  stories = task.stories(per_page: 100).to_a.reject do |story|
238
- # @sg-ignore
262
+ # @sg-ignore story's inferred block param type regressed on rbs >= 4.1.0, fix in progress upstream
263
+ # https://github.com/castwide/solargraph/pull/1228
239
264
  excluding_resource_subtypes.include? story.resource_subtype
240
265
  end
241
266
  return true if stories.empty? # no stories == infinitely old!
242
267
 
243
- last_story = stories.last
244
- # @sg-ignore
268
+ last_story = T.must(stories.last)
245
269
  last_story_created_at = Time.parse(last_story.created_at)
246
270
  n_days_ago = Time.at(Time.now.to_i - (num_days * 86_400))
247
271
  last_story_created_at < n_days_ago
@@ -365,9 +389,10 @@ module Checkoff
365
389
  # @sg-ignore Checkoff::SelectorClasses::Task::MilestonePFunctionEvaluator#evaluate
366
390
  # return type could not be inferred
367
391
  def evaluate(task)
368
- raise 'Please add resource_subtype to extra_fields' if task.resource_subtype.nil?
392
+ resource_subtype = task.resource_subtype
393
+ raise 'Please add resource_subtype to extra_fields' if resource_subtype.nil?
369
394
 
370
- task.resource_subtype == 'milestone'
395
+ resource_subtype == 'milestone'
371
396
  end
372
397
  end
373
398