smart_todo 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'net/http'
4
- require 'json'
3
+ require "net/http"
4
+ require "json"
5
5
 
6
6
  module SmartTodo
7
7
  # A simple client around the Slack API.
@@ -16,7 +16,7 @@ module SmartTodo
16
16
 
17
17
  # @param response_body [Hash] the parsed response body from Slack
18
18
  def initialize(response_body)
19
- @error_code = response_body['error']
19
+ @error_code = response_body["error"]
20
20
 
21
21
  super("Response body: #{response_body}")
22
22
  end
@@ -25,7 +25,7 @@ module SmartTodo
25
25
  # @param slack_token [String]
26
26
  def initialize(slack_token)
27
27
  @slack_token = slack_token
28
- @client = Net::HTTP.new('slack.com', Net::HTTP.https_default_port).tap do |client|
28
+ @client = Net::HTTP.new("slack.com", Net::HTTP.https_default_port).tap do |client|
29
29
  client.use_ssl = true
30
30
  client.read_timeout = 30
31
31
  client.ssl_timeout = 15
@@ -42,7 +42,7 @@ module SmartTodo
42
42
  #
43
43
  # @see https://api.slack.com/methods/users.lookupByEmail
44
44
  def lookup_user_by_email(email)
45
- headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
45
+ headers = { "Content-Type" => "application/x-www-form-urlencoded" }
46
46
 
47
47
  request(:get, "/api/users.lookupByEmail?email=#{email}", nil, headers)
48
48
  end
@@ -58,7 +58,7 @@ module SmartTodo
58
58
  #
59
59
  # @see https://api.slack.com/methods/chat.postMessage
60
60
  def post_message(channel, text)
61
- request(:post, '/api/chat.postMessage', JSON.dump(channel: channel, text: text))
61
+ request(:post, "/api/chat.postMessage", JSON.dump(channel: channel, text: text))
62
62
  end
63
63
 
64
64
  private
@@ -90,10 +90,10 @@ module SmartTodo
90
90
  # @raise [Net::HTTPError] in case the reques to Slack failed
91
91
  # @raise [SlackClient::Error] in case Slack returs a { ok: false } in the body
92
92
  def slack_response!(response)
93
- raise(Net::HTTPError.new('Request to slack failed', response)) unless response.code_type < Net::HTTPSuccess
93
+ raise(Net::HTTPError.new("Request to slack failed", response)) unless response.code_type < Net::HTTPSuccess
94
94
  body = JSON.parse(response.body)
95
95
 
96
- if body['ok']
96
+ if body["ok"]
97
97
  body
98
98
  else
99
99
  raise(Error, body)
@@ -105,8 +105,8 @@ module SmartTodo
105
105
  # @return [Hash]
106
106
  def default_headers
107
107
  {
108
- 'Content-Type' => 'application/json; charset=utf8',
109
- 'Authorization' => "Bearer #{@slack_token}",
108
+ "Content-Type" => "application/json; charset=utf8",
109
+ "Authorization" => "Bearer #{@slack_token}",
110
110
  }
111
111
  end
112
112
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmartTodo
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0"
5
5
  end
data/lib/smart_todo.rb CHANGED
@@ -4,25 +4,25 @@ require "smart_todo/version"
4
4
  require "smart_todo/events"
5
5
 
6
6
  module SmartTodo
7
- autoload :SlackClient, 'smart_todo/slack_client'
8
- autoload :CLI, 'smart_todo/cli'
7
+ autoload :SlackClient, "smart_todo/slack_client"
8
+ autoload :CLI, "smart_todo/cli"
9
9
 
10
10
  module Parser
11
- autoload :CommentParser, 'smart_todo/parser/comment_parser'
12
- autoload :TodoNode, 'smart_todo/parser/todo_node'
13
- autoload :MetadataParser, 'smart_todo/parser/metadata_parser'
11
+ autoload :CommentParser, "smart_todo/parser/comment_parser"
12
+ autoload :TodoNode, "smart_todo/parser/todo_node"
13
+ autoload :MetadataParser, "smart_todo/parser/metadata_parser"
14
14
  end
15
15
 
16
16
  module Events
17
- autoload :Date, 'smart_todo/events/date'
18
- autoload :GemBump, 'smart_todo/events/gem_bump'
19
- autoload :GemRelease, 'smart_todo/events/gem_release'
20
- autoload :IssueClose, 'smart_todo/events/issue_close'
17
+ autoload :Date, "smart_todo/events/date"
18
+ autoload :GemBump, "smart_todo/events/gem_bump"
19
+ autoload :GemRelease, "smart_todo/events/gem_release"
20
+ autoload :IssueClose, "smart_todo/events/issue_close"
21
21
  end
22
22
 
23
23
  module Dispatchers
24
- autoload :Base, 'smart_todo/dispatchers/base'
25
- autoload :Slack, 'smart_todo/dispatchers/slack'
26
- autoload :Output, 'smart_todo/dispatchers/output'
24
+ autoload :Base, "smart_todo/dispatchers/base"
25
+ autoload :Slack, "smart_todo/dispatchers/slack"
26
+ autoload :Output, "smart_todo/dispatchers/output"
27
27
  end
28
28
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'smart_todo/parser/metadata_parser'
3
+ require "smart_todo/parser/metadata_parser"
4
4
 
5
5
  module RuboCop
6
6
  module Cop
@@ -11,7 +11,7 @@ module RuboCop
11
11
  # @see https://rubocop.readthedocs.io/en/latest/extensions/#loading-extensions
12
12
  class SmartTodoCop < Cop
13
13
  MSG = "Don't write regular TODO comments. Write SmartTodo compatible syntax comments." \
14
- "For more info please look at https://github.com/shopify/smart_todo"
14
+ "For more info please look at https://github.com/shopify/smart_todo"
15
15
 
16
16
  # @param processed_source [RuboCop::ProcessedSource]
17
17
  # @return [void]
@@ -27,11 +27,11 @@ module RuboCop
27
27
  # @param comment [String]
28
28
  # @return [true, false]
29
29
  def smart_todo?(comment)
30
- metadata = ::SmartTodo::Parser::MetadataParser.parse(comment.gsub(/^#/, ''))
30
+ metadata = ::SmartTodo::Parser::MetadataParser.parse(comment.gsub(/^#/, ""))
31
31
 
32
32
  metadata.events.any? &&
33
33
  metadata.events.all? { |event| event.is_a?(::SmartTodo::Parser::MethodNode) } &&
34
- metadata.assignee
34
+ metadata.assignees.any?
35
35
  end
36
36
  end
37
37
  end
data/service.yml ADDED
@@ -0,0 +1 @@
1
+ classification: library
data/smart_todo.gemspec CHANGED
@@ -21,18 +21,19 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.metadata["homepage_uri"] = spec.homepage
23
23
  spec.metadata["source_code_uri"] = spec.homepage
24
- spec.metadata["changelog_uri"] = spec.homepage + "/blob/master/CHANGELOG.md"
24
+ spec.metadata["changelog_uri"] = spec.homepage + "/releases"
25
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
25
26
 
26
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
27
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
27
28
  %x(git ls-files -z).split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
29
  end
29
30
  spec.bindir = "exe"
30
- spec.executables = ['smart_todo']
31
+ spec.executables = ["smart_todo"]
31
32
  spec.require_paths = ["lib"]
32
33
 
33
- spec.add_development_dependency("bundler", "~> 1.17")
34
- spec.add_development_dependency("rake", "~> 10.0")
34
+ spec.add_runtime_dependency("rexml")
35
+ spec.add_development_dependency("bundler", ">= 1.17")
35
36
  spec.add_development_dependency("minitest", "~> 5.0")
37
+ spec.add_development_dependency("rake", ">= 10.0")
36
38
  spec.add_development_dependency("webmock")
37
- spec.add_development_dependency("rubocop")
38
39
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_todo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-25 00:00:00.000000000 Z
11
+ date: 2021-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: rexml
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.17'
20
- type: :development
19
+ version: '0'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.17'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '1.17'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '1.17'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,21 +53,21 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: webmock
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '10.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '10.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rubocop
70
+ name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -91,11 +91,10 @@ executables:
91
91
  extensions: []
92
92
  extra_rdoc_files: []
93
93
  files:
94
+ - ".github/workflows/build.yml"
95
+ - ".github/workflows/rubocop.yml"
94
96
  - ".gitignore"
95
- - ".rubocop-http---shopify-github-io-ruby-style-guide-rubocop-yml"
96
97
  - ".rubocop.yml"
97
- - ".travis.yml"
98
- - CHANGELOG.md
99
98
  - CODE_OF_CONDUCT.md
100
99
  - Gemfile
101
100
  - Gemfile.lock
@@ -123,6 +122,7 @@ files:
123
122
  - lib/smart_todo/slack_client.rb
124
123
  - lib/smart_todo/version.rb
125
124
  - lib/smart_todo_cop.rb
125
+ - service.yml
126
126
  - shipit.rubygems.yml
127
127
  - smart_todo.gemspec
128
128
  homepage: https://github.com/shopify/smart_todo
@@ -131,7 +131,8 @@ licenses:
131
131
  metadata:
132
132
  homepage_uri: https://github.com/shopify/smart_todo
133
133
  source_code_uri: https://github.com/shopify/smart_todo
134
- changelog_uri: https://github.com/shopify/smart_todo/blob/master/CHANGELOG.md
134
+ changelog_uri: https://github.com/shopify/smart_todo/releases
135
+ allowed_push_host: https://rubygems.org
135
136
  post_install_message:
136
137
  rdoc_options: []
137
138
  require_paths:
@@ -147,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
148
  - !ruby/object:Gem::Version
148
149
  version: '0'
149
150
  requirements: []
150
- rubygems_version: 3.0.3
151
+ rubygems_version: 3.2.20
151
152
  signing_key:
152
153
  specification_version: 4
153
154
  summary: Enhance todo's comments in your codebase.