smart_todo 1.3.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/cla.yml +22 -0
- data/Gemfile.lock +1 -1
- data/LICENSE.txt +1 -1
- data/lib/smart_todo/version.rb +1 -1
- data/lib/smart_todo_cop.rb +24 -9
- data/service.yml +0 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b21d53a3957ea19430b3726fd82fefeceef262330ead8eb9ef1ef087acd29bb4
|
4
|
+
data.tar.gz: 3927e36c7c059e90613ceec82e8d00efc8c7e6ceceb6183d05a5cd59c466086c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f92dd70f82426b84d8a651a9963dffbf6b66017c484b25371b68c16495bf2cdb28faba9fdb31a0ab56ffbb5f848f1a877375379c4c94ca946bb16d9630d7d075
|
7
|
+
data.tar.gz: 69aa57c5583a6adba8320783171eeaef3814e9e758c81b3c81bbd455c3d238d72d145be44c5fa6732764d7561beac2c19181f8344462f209346572bb23f6bf3d
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Contributor License Agreement (CLA)
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request_target:
|
5
|
+
types: [opened, synchronize]
|
6
|
+
issue_comment:
|
7
|
+
types: [created]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
cla:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
if: |
|
13
|
+
(github.event.issue.pull_request
|
14
|
+
&& !github.event.issue.pull_request.merged_at
|
15
|
+
&& contains(github.event.comment.body, 'signed')
|
16
|
+
)
|
17
|
+
|| (github.event.pull_request && !github.event.pull_request.merged)
|
18
|
+
steps:
|
19
|
+
- uses: Shopify/shopify-cla-action@v1
|
20
|
+
with:
|
21
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
22
|
+
cla-token: ${{ secrets.CLA_TOKEN }}
|
data/Gemfile.lock
CHANGED
data/LICENSE.txt
CHANGED
data/lib/smart_todo/version.rb
CHANGED
data/lib/smart_todo_cop.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "smart_todo
|
3
|
+
require "smart_todo"
|
4
4
|
|
5
5
|
module RuboCop
|
6
6
|
module Cop
|
@@ -10,29 +10,44 @@ module RuboCop
|
|
10
10
|
#
|
11
11
|
# @see https://rubocop.readthedocs.io/en/latest/extensions/#loading-extensions
|
12
12
|
class SmartTodoCop < Cop
|
13
|
-
|
14
|
-
|
13
|
+
HELP = "For more info please look at https://github.com/Shopify/smart_todo/wiki/Syntax"
|
14
|
+
MSG = "Don't write regular TODO comments. Write SmartTodo compatible syntax comments. #{HELP}"
|
15
15
|
|
16
16
|
# @param processed_source [RuboCop::ProcessedSource]
|
17
17
|
# @return [void]
|
18
18
|
def investigate(processed_source)
|
19
19
|
processed_source.comments.each do |comment|
|
20
20
|
next unless /^#\sTODO/ =~ comment.text
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
metadata = metadata(comment.text)
|
22
|
+
if !smart_todo?(metadata)
|
23
|
+
add_offense(comment)
|
24
|
+
elsif (methods = invalid_event_methods(metadata.events)).any?
|
25
|
+
add_offense(comment, message: "Invalid event method(s): #{methods.join(", ")}. #{HELP}")
|
26
|
+
end
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
30
|
+
private
|
31
|
+
|
27
32
|
# @param comment [String]
|
28
|
-
# @return [
|
29
|
-
def
|
30
|
-
|
33
|
+
# @return [SmartTodo::Parser::Visitor]
|
34
|
+
def metadata(comment)
|
35
|
+
::SmartTodo::Parser::MetadataParser.parse(comment.gsub(/^#/, ""))
|
36
|
+
end
|
31
37
|
|
38
|
+
# @param metadata [SmartTodo::Parser::Visitor]
|
39
|
+
# @return [true, false]
|
40
|
+
def smart_todo?(metadata)
|
32
41
|
metadata.events.any? &&
|
33
42
|
metadata.events.all? { |event| event.is_a?(::SmartTodo::Parser::MethodNode) } &&
|
34
43
|
metadata.assignees.any?
|
35
44
|
end
|
45
|
+
|
46
|
+
# @param metadata [Array<SmartTodo::Parser::MethodNode>]
|
47
|
+
# @return [Array<String>]
|
48
|
+
def invalid_event_methods(events)
|
49
|
+
events.map(&:method_name).reject { |method| ::SmartTodo::Events.respond_to?(method) }
|
50
|
+
end
|
36
51
|
end
|
37
52
|
end
|
38
53
|
end
|
data/service.yml
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
classification: library
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_todo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rexml
|
@@ -92,6 +92,7 @@ extensions: []
|
|
92
92
|
extra_rdoc_files: []
|
93
93
|
files:
|
94
94
|
- ".github/workflows/build.yml"
|
95
|
+
- ".github/workflows/cla.yml"
|
95
96
|
- ".github/workflows/rubocop.yml"
|
96
97
|
- ".gitignore"
|
97
98
|
- ".rubocop.yml"
|
@@ -148,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
149
|
- !ruby/object:Gem::Version
|
149
150
|
version: '0'
|
150
151
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
152
|
+
rubygems_version: 3.3.3
|
152
153
|
signing_key:
|
153
154
|
specification_version: 4
|
154
155
|
summary: Enhance todo's comments in your codebase.
|