glyptodont 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -1
- data/.rubocop.yml +1 -2
- data/CHANGELOG.md +16 -2
- data/Gemfile +8 -7
- data/LICENSE.txt +1 -1
- data/README.md +7 -4
- data/glyptodont.gemspec +3 -2
- data/lib/glyptodont/checker.rb +11 -1
- data/lib/glyptodont/configuration.rb +4 -0
- data/lib/glyptodont/options.rb +11 -1
- data/lib/glyptodont/todo_researcher.rb +3 -11
- data/lib/glyptodont/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2da8dbfba96ec9503e38905a40127830fd2418ed24f047547c67d86dd11f3b56
|
4
|
+
data.tar.gz: cf21cce8ec2f2ba666217176318d6eda32598228a8d6cd5bf68106dfc411de2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05764bd33fd94ed756d475f4273e1369290e0513a222ae1b63a55ed962283bd3ceab321320dedaeb5bdccfa430953f299bdedc02edcf9fc3fe4c4858ef340bdc
|
7
|
+
data.tar.gz: 2efb6f3cf24915b5ad04b1d3450695e7818badb093eda713587e9a938f64ce2899a331334c2b528afa817234806f93eefe3e7253a13a72dfca2e944af5c5aee9
|
data/.github/workflows/main.yml
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -8,7 +8,21 @@ and this project adheres to
|
|
8
8
|
|
9
9
|
## [Unreleased]
|
10
10
|
|
11
|
-
[Unreleased]: https://github.com/johnsyweb/glyptodont/compare/v0.
|
11
|
+
[Unreleased]: https://github.com/johnsyweb/glyptodont/compare/v0.3.0..main
|
12
|
+
|
13
|
+
## [0.3.0] - 2022-03-23
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- `keywords` option and configuration for TODO synonyms [[#5]]
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
|
21
|
+
- Dropped support for Ruby version older than 2.5 [[#4]]
|
22
|
+
|
23
|
+
[#4]: https://github.com/johnsyweb/glyptodont/pull/4
|
24
|
+
[#5]: https://github.com/johnsyweb/glyptodont/pull/5
|
25
|
+
[Unreleased]: https://github.com/johnsyweb/glyptodont/compare/v0.2.0..v0.3.0
|
12
26
|
|
13
27
|
## [0.2.0] - 2021-03-28
|
14
28
|
|
@@ -29,7 +43,7 @@ and this project adheres to
|
|
29
43
|
[#2]: https://github.com/johnsyweb/glyptodont/pull/2
|
30
44
|
[#3]: https://github.com/johnsyweb/glyptodont/pull/3
|
31
45
|
|
32
|
-
[
|
46
|
+
[0.2.0]: https://github.com/johnsyweb/glyptodont/compare/v0.1.0..v0.2.0
|
33
47
|
|
34
48
|
## [0.1.0] - 2021-03-13
|
35
49
|
|
data/Gemfile
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
# Specify your gem's dependencies in glyptodont.gemspec
|
6
5
|
gemspec
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
gem "rspec"
|
11
|
-
gem "rspec-its"
|
12
|
-
|
13
|
-
gem "rubocop"
|
7
|
+
group :developement, :test do
|
8
|
+
gem "rake"
|
9
|
+
gem "rspec"
|
10
|
+
gem "rspec-its"
|
11
|
+
gem "rubocop"
|
12
|
+
gem "rubocop-rake"
|
13
|
+
gem "rubocop-rspec"
|
14
|
+
end
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Glyptodont
|
2
2
|
|
3
|
-
Use this gem if you
|
4
|
-
your to-dos.
|
3
|
+
Use this gem if you want to avoid deploying code to production without doing all
|
4
|
+
of your to-dos.
|
5
5
|
|
6
6
|
## Introduction
|
7
7
|
|
@@ -9,7 +9,7 @@ All of the glyptodonts have fossilised. This is a tool to ensure that your TODOs
|
|
9
9
|
are eradicated before this can happen to them.
|
10
10
|
|
11
11
|
If you've ever been caught out because a TODO in production code has not been
|
12
|
-
|
12
|
+
_done_, this gem is for ***you***!
|
13
13
|
|
14
14
|
## Development status [![Ruby](https://github.com/johnsyweb/glyptodont/actions/workflows/main.yml/badge.svg)](https://github.com/johnsyweb/glyptodont/actions/workflows/main.yml)
|
15
15
|
|
@@ -53,6 +53,7 @@ Usage: glyptodont [options]
|
|
53
53
|
-d, --directory DIRECTORY Git repository to search for TODOs (default '.')
|
54
54
|
-t, --threshold TODOS Maximum number of TODOs to allow (default 10)
|
55
55
|
-m, --max-age DAYS Maximum number of days to allow TODOs to stay (default 14)
|
56
|
+
-k, --keywords TODO,WORDS Keywords to treat as 'TODO' (default FIXME,HACK,TODO,XXX)
|
56
57
|
--version Show version
|
57
58
|
```
|
58
59
|
|
@@ -70,6 +71,8 @@ root of the directory being scanned.
|
|
70
71
|
- `ignore`: List of `file_name:line_number` pairs to ignore when researching
|
71
72
|
TODOs. This may be useful if you have, for example, Spanish language text in
|
72
73
|
your project or you talk about TODOs a lot :-)
|
74
|
+
- `keywords`: List of synonyms for TODO in your project. I've seen some
|
75
|
+
interesting alternatives over the years.
|
73
76
|
|
74
77
|
### _Exempli gratiā_
|
75
78
|
|
@@ -86,7 +89,7 @@ ignore:
|
|
86
89
|
|
87
90
|
## Requirements
|
88
91
|
|
89
|
-
- Ruby (tested against v2.
|
92
|
+
- Ruby (tested against v2.5 and above)
|
90
93
|
- Git
|
91
94
|
- CMake
|
92
95
|
|
data/glyptodont.gemspec
CHANGED
@@ -11,14 +11,15 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["paj+github@johnsy.com"]
|
12
12
|
|
13
13
|
spec.summary = "A bit like `git grep 'T0D0'`, but better." # .tr("0", "O")
|
14
|
-
spec.description = "Use this gem if you
|
14
|
+
spec.description = "Use this gem if you want to avoid deploying code to production without doing all of your to-dos"
|
15
15
|
spec.homepage = GITHUB_URL
|
16
16
|
spec.license = "MIT"
|
17
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5")
|
18
18
|
|
19
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
20
20
|
spec.metadata["source_code_uri"] = GITHUB_URL
|
21
21
|
spec.metadata["changelog_uri"] = "#{GITHUB_URL}blob/HEAD/CHANGELOG.md"
|
22
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
22
23
|
|
23
24
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
25
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
data/lib/glyptodont/checker.rb
CHANGED
@@ -14,6 +14,12 @@ module Glyptodont
|
|
14
14
|
class Checker
|
15
15
|
DEFAULT_THRESHOLD = 10
|
16
16
|
DEFAULT_MAX_AGE_IN_DAYS = 14
|
17
|
+
DEFAULT_KEYWORDS = %w[
|
18
|
+
FIXME
|
19
|
+
HACK
|
20
|
+
TODO
|
21
|
+
XXX
|
22
|
+
].freeze
|
17
23
|
|
18
24
|
def initialize(args)
|
19
25
|
@options = Options.new(args)
|
@@ -21,7 +27,7 @@ module Glyptodont
|
|
21
27
|
end
|
22
28
|
|
23
29
|
def check
|
24
|
-
todos = TodoResearcher.new(directory, ignore).research
|
30
|
+
todos = TodoResearcher.new(directory, ignore, keywords).research
|
25
31
|
|
26
32
|
checks = [
|
27
33
|
Checkers::Counter.new(todos: todos, threshold: threshold),
|
@@ -47,5 +53,9 @@ module Glyptodont
|
|
47
53
|
def max_age_in_days
|
48
54
|
options.max_age_in_days || configuration.max_age_in_days || DEFAULT_MAX_AGE_IN_DAYS
|
49
55
|
end
|
56
|
+
|
57
|
+
def keywords
|
58
|
+
options.keywords || configuration.keywords || DEFAULT_KEYWORDS
|
59
|
+
end
|
50
60
|
end
|
51
61
|
end
|
data/lib/glyptodont/options.rb
CHANGED
@@ -7,7 +7,7 @@ require "optparse"
|
|
7
7
|
module Glyptodont
|
8
8
|
# Command-line options for the tool
|
9
9
|
class Options
|
10
|
-
attr_reader :directory, :threshold, :max_age_in_days
|
10
|
+
attr_reader :directory, :threshold, :max_age_in_days, :keywords
|
11
11
|
|
12
12
|
def initialize(args)
|
13
13
|
@args = args
|
@@ -24,6 +24,7 @@ module Glyptodont
|
|
24
24
|
directory_option(opts)
|
25
25
|
threshold_option(opts)
|
26
26
|
max_age_in_days_option(opts)
|
27
|
+
keywords_option(opts)
|
27
28
|
version_option(opts)
|
28
29
|
end.parse!(@args)
|
29
30
|
end
|
@@ -46,6 +47,15 @@ module Glyptodont
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
50
|
+
def keywords_option(opts)
|
51
|
+
opts.on("-k",
|
52
|
+
"--keywords TODO,WORDS",
|
53
|
+
Array,
|
54
|
+
"Keywords to treat as 'TODO' (default FIXME,HACK,TODO,XXX)") do |k|
|
55
|
+
@keywords = k
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
49
59
|
def version_option(opts)
|
50
60
|
opts.on_tail("--version", "Show version") do
|
51
61
|
puts VERSION
|
@@ -6,9 +6,10 @@ require "rugged"
|
|
6
6
|
module Glyptodont
|
7
7
|
# Finds all the TODOs in a directory managed by Git, who last touched them and when.
|
8
8
|
class TodoResearcher
|
9
|
-
def initialize(directory, ignore)
|
9
|
+
def initialize(directory, ignore, keywords)
|
10
10
|
@directory = directory
|
11
11
|
@ignore = ignore
|
12
|
+
@keywords = Array(keywords)
|
12
13
|
@annotator = {}
|
13
14
|
end
|
14
15
|
|
@@ -18,7 +19,7 @@ module Glyptodont
|
|
18
19
|
|
19
20
|
private
|
20
21
|
|
21
|
-
attr_reader :directory, :ignore
|
22
|
+
attr_reader :directory, :ignore, :keywords
|
22
23
|
|
23
24
|
def git
|
24
25
|
Git.open(directory)
|
@@ -28,15 +29,6 @@ module Glyptodont
|
|
28
29
|
"\\b\\(#{keywords.join('\|')}\\)\\b"
|
29
30
|
end
|
30
31
|
|
31
|
-
def keywords
|
32
|
-
%w[
|
33
|
-
FIXME
|
34
|
-
HACK
|
35
|
-
TODO
|
36
|
-
XXX
|
37
|
-
]
|
38
|
-
end
|
39
|
-
|
40
32
|
def extract_details(todos)
|
41
33
|
todos.flat_map do |sha, matches|
|
42
34
|
file = sha.split(":", 2).last
|
data/lib/glyptodont/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glyptodont
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Johns
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -38,8 +38,8 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description: Use this gem if you
|
42
|
-
all of your to-dos
|
41
|
+
description: Use this gem if you want to avoid deploying code to production without
|
42
|
+
doing all of your to-dos
|
43
43
|
email:
|
44
44
|
- paj+github@johnsy.com
|
45
45
|
executables:
|
@@ -85,6 +85,7 @@ metadata:
|
|
85
85
|
homepage_uri: https://github.com/johnsyweb/glyptodont/
|
86
86
|
source_code_uri: https://github.com/johnsyweb/glyptodont/
|
87
87
|
changelog_uri: https://github.com/johnsyweb/glyptodont/blob/HEAD/CHANGELOG.md
|
88
|
+
rubygems_mfa_required: 'true'
|
88
89
|
post_install_message:
|
89
90
|
rdoc_options: []
|
90
91
|
require_paths:
|
@@ -93,14 +94,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
94
|
requirements:
|
94
95
|
- - ">="
|
95
96
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.
|
97
|
+
version: '2.5'
|
97
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
99
|
requirements:
|
99
100
|
- - ">="
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
103
|
requirements: []
|
103
|
-
rubygems_version: 3.2.
|
104
|
+
rubygems_version: 3.2.22
|
104
105
|
signing_key:
|
105
106
|
specification_version: 4
|
106
107
|
summary: A bit like `git grep 'T0D0'`, but better.
|