checkoff 0.35.1 → 0.36.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c79edf8ed438b9acb826f0ea58bf1e64bd08b336597c19a717a7be021dcdf51
4
- data.tar.gz: c5d70772832ea533e37a5413f8682aff31dd6d78420492129313979e0d70e138
3
+ metadata.gz: 35f3eede428605d10e3c90de0dc50b5a586175314977a6a54e8187f5b22b9226
4
+ data.tar.gz: '0086906e61829987635d676c9c595dd7665473adf033c10f05a9de1b613b2502'
5
5
  SHA512:
6
- metadata.gz: 8606bf6119854a6e69d079374692a27b9a0b5e3fdaaf1fdecbdea9b2c8f77155dcd94c62d925c38e4a745f205129d59af05d690feb06814746cb10f78454bb4e
7
- data.tar.gz: '07873de0c336f8f15ddfa68e4c809f4f9b1bb4d7511b8769415ef5a9b74dd25aeaadbb7660265539bab18d945a2106d0db692fbb8da33b73151d84bf03a9937c'
6
+ metadata.gz: 620f38dbfdfe18677e6d821dc2fe9b04a298b35ff7fb305eee2aed2deb079b2ba216b8490a505f6a24300d204afe58c9ae516d7f18d6f29c47c151a01513bd65
7
+ data.tar.gz: 32cbc3c60d7971916609ddeb3f494a7a8cd0a0ef54f6a9760462e4ef14d2f34a82aaec4462e866ca8fb8108c7aff5a37b30fdb551c649f9d1586f86be4bce4a6
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'overcommit'
4
+ require 'overcommit/hook/pre_commit/base'
5
+
3
6
  module Overcommit
4
7
  module Hook
5
8
  module PreCommit
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'overcommit'
4
+ require 'overcommit/hook/pre_commit/base'
5
+
6
+ # Overcommit configuration
7
+ module Overcommit
8
+ module Hook
9
+ module PreCommit
10
+ # Runs `punchlist` against any modified Ruby files.
11
+ class Punchlist < Base
12
+ # @param stdout [String]
13
+ # @return [Array<Overcommit::Hook::Message]
14
+ def parse_output(stdout)
15
+ stdout.split("\n").map do |line|
16
+ # @sg-ignore
17
+ file, line_no, _message = line.split(':', 3)
18
+ Overcommit::Hook::Message.new(:warning, file, line_no.to_i, line)
19
+ end
20
+ end
21
+
22
+ def files_glob
23
+ "{" \
24
+ "#{applicable_files.join(',')}" \
25
+ "}"
26
+ end
27
+
28
+ def run
29
+ # @sg-ignore
30
+ # @type [Overcommit::Subprocess::Result]
31
+ result = execute([*command, '-g', files_glob])
32
+
33
+ warn result.stderr
34
+
35
+ # If the command exited with a non-zero status or produced any output, treat it as a failure
36
+ if result.status.nonzero? || !result.stdout.empty? || !result.stderr.empty?
37
+ # Parse the output to create Message objects
38
+ stdout = result.stdout
39
+ messages = parse_output(stdout)
40
+
41
+ return messages
42
+ end
43
+
44
+ :pass
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'overcommit'
4
+ require 'overcommit/hook/pre_commit/base'
5
+
6
+ # @!override Overcommit::Hook::Base#execute
7
+ # @return [Overcommit::Subprocess::Result]
8
+
9
+ module Overcommit
10
+ module Hook
11
+ module PreCommit
12
+ # Runs `solargraph typecheck` against any modified Ruby files.
13
+ class SolargraphTypecheck < Base
14
+ def run
15
+ errors = []
16
+
17
+ applicable_files.each do |file|
18
+ generate_errors_for_file(file, errors)
19
+ end
20
+
21
+ # output message to stderr
22
+ errors
23
+ end
24
+
25
+ private
26
+
27
+ def generate_errors_for_file(file, errors)
28
+ result = execute(['bundle', 'exec', 'solargraph', 'typecheck', '--level', 'strict', file])
29
+ return if result.success?
30
+
31
+ # @type [String]
32
+ stdout = result.stdout
33
+
34
+ stdout.split("\n").each do |error|
35
+ error = parse_error(file, error)
36
+ errors << error unless error.nil?
37
+ end
38
+ end
39
+
40
+ def parse_error(file, error)
41
+ # Parse the result for the line number # @type [MatchData]
42
+ match = error.match(/^(.+?):(\d+)/)
43
+ return nil unless match
44
+
45
+ # @!override MatchData.captures
46
+ # @return [Array]
47
+ # @sg-ignore
48
+ file_path, lineno = match.captures
49
+ message = error.sub("#{file_path}:#{lineno} - ",
50
+ "#{file_path}:#{lineno}: ")
51
+ # Emit the errors in the specified format
52
+ Overcommit::Hook::Message.new(:error, file, lineno, message)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
data/.overcommit.yml CHANGED
@@ -17,15 +17,12 @@
17
17
  # Uncomment the following lines to make the configuration take effect.
18
18
 
19
19
  PreCommit:
20
- # Extend default config at https://github.com/sds/overcommit/blob/master/config/default.yml
20
+ # Extend default config at
21
+ # https://github.com/sds/overcommit/blob/master/config/default.yml
21
22
  BrokenSymlinks:
22
23
  enabled: true
23
24
  description: 'Check for broken symlinks'
24
25
  quiet: true
25
- exclude:
26
- # This is a symlink to sibling checkout of vincelifedaily, used
27
- # only in local development
28
- - config/env.1p
29
26
  RuboCop:
30
27
  enabled: true
31
28
  on_warn: fail # Treat all warnings as failures
@@ -38,7 +35,7 @@ PreCommit:
38
35
  - '**/Gemfile'
39
36
  - '**/Rakefile'
40
37
  - 'bin/*'
41
- - 'script/*'
38
+ - 'exe/*'
42
39
  exclude:
43
40
  - db/migrate/*.rb
44
41
  - db/schema.rb
@@ -53,6 +50,7 @@ PreCommit:
53
50
  - '**/*.sh'
54
51
  YamlLint:
55
52
  enabled: true
53
+ flags: ['-c', '.yamllint.yml']
56
54
  on_warn: fail
57
55
  CircleCi:
58
56
  required_executable: 'circleci'
@@ -60,12 +58,19 @@ PreCommit:
60
58
  include:
61
59
  - '.circleci/config.yml'
62
60
  enabled: true
61
+ SolargraphTypecheck:
62
+ enabled: true
63
+ on_warn: fail
64
+ include:
65
+ - '**/*.rb'
66
+ Punchlist:
67
+ on_warn: fail
68
+ command: ['bundle', 'exec', 'punchlist']
69
+ enabled: true
63
70
 
64
71
  PrePush:
65
72
  Minitest:
66
73
  command: ['ruby', '-Ilib:test/unit:lib/checkoff', '-rbundler/setup', '-rminitest', "-e 'exit! Minitest.run'"]
67
- include:
68
- - 'test/unit/**/test*.rb'
69
74
  enabled: true
70
75
 
71
76
  #PostCheckout:
data/.solargraph.yml ADDED
@@ -0,0 +1,25 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ - ".git-hooks/**/*.rb"
5
+ exclude:
6
+ - spec/**/*
7
+ - test/**/*
8
+ - vendor/**/*
9
+ - ".bundle/**/*"
10
+ require: []
11
+ domains: []
12
+ reporters:
13
+ - rubocop
14
+ - require_not_found
15
+ - typecheck:strict
16
+ - update_errors
17
+ formatter:
18
+ rubocop:
19
+ cops: safe
20
+ except: []
21
+ only: []
22
+ extra_args: []
23
+ require_paths: []
24
+ plugins: []
25
+ max_files: 5000
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.35.1)
15
+ checkoff (0.36.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -134,10 +134,13 @@ GEM
134
134
  coderay (~> 1.1)
135
135
  method_source (~> 1.0)
136
136
  public_suffix (5.0.0)
137
+ punchlist (1.3.0)
138
+ source_finder (>= 2)
137
139
  racc (1.6.2)
138
140
  rack (3.0.6.1)
139
141
  rainbow (3.1.1)
140
142
  rake (13.0.3)
143
+ rbs (3.1.0)
141
144
  regexp_parser (2.6.0)
142
145
  reverse_markdown (2.1.1)
143
146
  nokogiri
@@ -196,6 +199,7 @@ GEM
196
199
  thor (~> 1.0)
197
200
  tilt (~> 2.0)
198
201
  yard (~> 0.9, >= 0.9.24)
202
+ source_finder (3.2.1)
199
203
  thor (1.2.1)
200
204
  tilt (2.1.0)
201
205
  tomlrb (2.0.3)
@@ -232,7 +236,9 @@ DEPENDENCIES
232
236
  mocha (~> 2.0.0.alpha.1)
233
237
  overcommit (>= 0.60.0, < 0.61.0)
234
238
  pry
239
+ punchlist
235
240
  rake (~> 13.0)
241
+ rbs (> 3.0.3)
236
242
  rspec (>= 3.4)
237
243
  rubocop (~> 1.36, < 1.44)
238
244
  rubocop-minitest
data/Makefile CHANGED
@@ -78,6 +78,7 @@ cicoverage: coverage ## check code coverage
78
78
 
79
79
  update_from_cookiecutter: ## Bring in changes from template project used to create this repo
80
80
  bundle exec overcommit --uninstall
81
+ cookiecutter_project_upgrader --help >/dev/null
81
82
  IN_COOKIECUTTER_PROJECT_UPGRADER=1 cookiecutter_project_upgrader || true
82
83
  git checkout cookiecutter-template && git push && git checkout main
83
84
  git checkout main && git pull && git checkout -b update-from-cookiecutter-$$(date +%Y-%m-%d-%H%M)
data/bin/solargraph ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'solargraph' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("solargraph", "solargraph")
data/bin/yard ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'yard' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("yard", "yard")
data/checkoff.gemspec CHANGED
@@ -42,7 +42,10 @@ Gem::Specification.new do |spec|
42
42
  # so let's favor the more recent version...
43
43
  spec.add_development_dependency 'overcommit', ['>=0.60.0', '<0.61.0']
44
44
  spec.add_development_dependency 'pry'
45
+ spec.add_development_dependency 'punchlist'
45
46
  spec.add_development_dependency 'rake', '~> 13.0'
47
+ # ensure recent definitions
48
+ spec.add_development_dependency 'rbs', ['>3.0.3']
46
49
  spec.add_development_dependency 'rspec', '>=3.4'
47
50
  # I haven't adapted things to Gemspec/DevelopmentDependencies yet,
48
51
  # which arrives in 1.44
data/fix.sh CHANGED
@@ -124,18 +124,8 @@ ensure_ruby_versions() {
124
124
 
125
125
  for ver in $ruby_versions
126
126
  do
127
- # These CFLAGS can be retired once 2.6.7 is no longer needed :
128
- #
129
- # https://github.com/rbenv/ruby-build/issues/1747
130
- # https://github.com/rbenv/ruby-build/issues/1489
131
- # https://bugs.ruby-lang.org/issues/17777
132
- if [ "${ver}" == 2.6.7 ]
133
- then
134
- CFLAGS="-Wno-error=implicit-function-declaration" rbenv install -s "${ver}"
135
- else
136
- rbenv install -s "${ver}"
137
- hash -r # ensure we are seeing latest bundler etc
138
- fi
127
+ rbenv install -s "${ver}"
128
+ hash -r # ensure we are seeing latest bundler etc
139
129
  done
140
130
  }
141
131
 
@@ -24,6 +24,7 @@ module Checkoff
24
24
  @asana_client_class = asana_client_class
25
25
  end
26
26
 
27
+ # @return [Asana::Client]
27
28
  def client
28
29
  @client ||= @asana_client_class.new do |c|
29
30
  c.authentication :access_token, @config.fetch(:personal_access_token)
@@ -56,6 +56,7 @@ module Checkoff
56
56
  end
57
57
  cache_method :project, LONG_CACHE_TIME
58
58
 
59
+ # @return [Asana::Project]
59
60
  def project_or_raise(workspace_name, project_name)
60
61
  project = project(workspace_name, project_name)
61
62
  raise "Could not find project #{project_name} under workspace #{workspace_name}." if project.nil?
data/lib/checkoff/tags.rb CHANGED
@@ -30,6 +30,7 @@ module Checkoff
30
30
  @client = client
31
31
  end
32
32
 
33
+ # @return [Array<Asana::Resources::Task>]
33
34
  def tasks(workspace_name, tag_name,
34
35
  only_uncompleted: true,
35
36
  extra_fields: [])
@@ -14,7 +14,7 @@ require 'asana/resource_includes/response_helper'
14
14
 
15
15
  require 'checkoff/internal/search_url'
16
16
 
17
- # https://developers.asana.com/docs/task-searches
17
+ # https://developers.asana.com/reference/searchtasksforworkspace
18
18
  module Checkoff
19
19
  # Run task searches against the Asana API
20
20
  class TaskSearches
@@ -43,6 +43,10 @@ module Checkoff
43
43
  @asana_resources_collection_class = asana_resources_collection_class
44
44
  end
45
45
 
46
+ # @param [String] workspace_name
47
+ # @param [String] url
48
+ # @param [Array<String>] extra_fields
49
+ # @return [Array<Asana::Resources::Task>]
46
50
  def task_search(workspace_name, url, extra_fields: [])
47
51
  workspace = workspaces.workspace_or_raise(workspace_name)
48
52
  api_params, task_selector = @search_url_parser.convert_params(url)
@@ -7,12 +7,14 @@ require 'cache_method'
7
7
  require 'json'
8
8
  require_relative 'internal/config_loader'
9
9
  require_relative 'internal/task_selector_evaluator'
10
+ require_relative 'tasks'
10
11
 
11
12
  # https://developers.asana.com/docs/task-selectors
12
13
 
13
14
  module Checkoff
14
15
  # Filter lists of tasks using declarative selectors.
15
16
  class TaskSelectors
17
+ # @type [Integer]
16
18
  MINUTE = 60
17
19
  HOUR = MINUTE * 60
18
20
  DAY = 24 * HOUR
@@ -42,14 +44,17 @@ module Checkoff
42
44
  # bundle exec ./task_selectors.rb
43
45
  # :nocov:
44
46
  class << self
47
+ # @return [String]
45
48
  def project_name
46
49
  ARGV[1] || raise('Please pass project name to pull tasks from as first argument')
47
50
  end
48
51
 
52
+ # @return [String]
49
53
  def workspace_name
50
54
  ARGV[0] || raise('Please pass workspace name as first argument')
51
55
  end
52
56
 
57
+ # @return [Array]
53
58
  def task_selector
54
59
  task_selector_json = ARGV[2] || raise('Please pass task_selector in JSON form as third argument')
55
60
  JSON.parse(task_selector_json)
@@ -3,5 +3,5 @@
3
3
  # Command-line and gem client for Asana (unofficial)
4
4
  module Checkoff
5
5
  # Version of library
6
- VERSION = '0.35.1'
6
+ VERSION = '0.36.0'
7
7
  end
data/lib/checkoff.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'checkoff/version'
4
+ require 'checkoff/clients'
4
5
  require 'checkoff/workspaces'
5
6
  require 'checkoff/projects'
6
7
  require 'checkoff/sections'
data/package.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "remarkConfig": {
3
+ "settings": {
4
+ "bullet": "*",
5
+ "listItemIndent": "one"
6
+ },
7
+ "plugins": []
8
+ }
9
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.1
4
+ version: 0.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-03 00:00:00.000000000 Z
11
+ date: 2023-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -212,6 +212,20 @@ dependencies:
212
212
  - - ">="
213
213
  - !ruby/object:Gem::Version
214
214
  version: '0'
215
+ - !ruby/object:Gem::Dependency
216
+ name: punchlist
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ type: :development
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - ">="
227
+ - !ruby/object:Gem::Version
228
+ version: '0'
215
229
  - !ruby/object:Gem::Dependency
216
230
  name: rake
217
231
  requirement: !ruby/object:Gem::Requirement
@@ -226,6 +240,20 @@ dependencies:
226
240
  - - "~>"
227
241
  - !ruby/object:Gem::Version
228
242
  version: '13.0'
243
+ - !ruby/object:Gem::Dependency
244
+ name: rbs
245
+ requirement: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - ">"
248
+ - !ruby/object:Gem::Version
249
+ version: 3.0.3
250
+ type: :development
251
+ prerelease: false
252
+ version_requirements: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - ">"
255
+ - !ruby/object:Gem::Version
256
+ version: 3.0.3
229
257
  - !ruby/object:Gem::Dependency
230
258
  name: rspec
231
259
  requirement: !ruby/object:Gem::Requirement
@@ -368,12 +396,15 @@ extra_rdoc_files: []
368
396
  files:
369
397
  - ".circleci/config.yml"
370
398
  - ".git-hooks/pre_commit/circle_ci.rb"
399
+ - ".git-hooks/pre_commit/punchlist.rb"
400
+ - ".git-hooks/pre_commit/solargraph_typecheck.rb"
371
401
  - ".gitattributes"
372
402
  - ".gitignore"
373
403
  - ".markdownlint_style.rb"
374
404
  - ".mdlrc"
375
405
  - ".overcommit.yml"
376
406
  - ".rubocop.yml"
407
+ - ".solargraph.yml"
377
408
  - ".yamllint.yml"
378
409
  - CODE_OF_CONDUCT.md
379
410
  - CONTRIBUTING.rst
@@ -391,6 +422,8 @@ files:
391
422
  - bin/rake
392
423
  - bin/rubocop
393
424
  - bin/setup
425
+ - bin/solargraph
426
+ - bin/yard
394
427
  - checkoff.gemspec
395
428
  - docs/cookiecutter_input.json
396
429
  - docs/example_project.png
@@ -436,6 +469,7 @@ files:
436
469
  - metrics/rubocop_high_water_mark
437
470
  - metrics/scalastyle_high_water_mark
438
471
  - metrics/shellcheck_high_water_mark
472
+ - package.json
439
473
  - rakelib/citest.rake
440
474
  - rakelib/clear_metrics.rake
441
475
  - rakelib/console.rake