gtdlint 0.4 → 0.5
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 +4 -4
- data/CONFIGURE.md +2 -2
- data/README.md +29 -27
- data/bin/gtdlint +23 -96
- data/lib/gtdlint.rb +60 -36
- data/lib/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 315a65dffec87f52addba4616dd267d1ed0eec9a
|
4
|
+
data.tar.gz: 58ba330a56b9ef105ff5d4c59d7cd37d0de308a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de669820eb48d62cdd820cc3ba25407f880552c821f43fb1b8b2888ca7fcd9949d07d06a64e2428797cb880883b773f6555a3fb38f10bb87f9d3789523ad81ef
|
7
|
+
data.tar.gz: 2eb9621f4f823809d21d173c96b274df3a55eabecf13e4d0efa526e60646e70c821eb4434c34e2a06d36b64248c4c5551982b04c3a1dae5590dc7db56b8675b2
|
data/CONFIGURE.md
CHANGED
@@ -15,7 +15,7 @@ Run `gtdlint -h` or `gtdlint --help` for a full list, or refer to the source cod
|
|
15
15
|
```
|
16
16
|
$ bin/gtdlint -h
|
17
17
|
Usage: gtdlint [options] [<files>|-]
|
18
|
-
-i, --ignore pattern Ignore file
|
18
|
+
-i, --ignore pattern Ignore file pattern (fnmatch)
|
19
19
|
-p, --gtd-pattern pattern Custom GTD pattern
|
20
20
|
-h, --help Print usage info
|
21
21
|
-v, --version Print version info
|
@@ -47,6 +47,6 @@ Samples:
|
|
47
47
|
|
48
48
|
# Built-in defaults
|
49
49
|
|
50
|
-
* `gtd_pattern`: `"\'todo\\|to do\\|to-do\\|pending\\|hack\'"`.
|
50
|
+
* `gtd_pattern`: `"\'todo\\|to do\\|to-do\\|pending\\|hack\\|fixme\'"`.
|
51
51
|
* `before_lines`: `0`
|
52
52
|
* `after_lines`: `0`
|
data/README.md
CHANGED
@@ -1,29 +1,6 @@
|
|
1
1
|
# gtdlint - search for TO-DO items to complete in large projects
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
https://github.com/mcandre/gtdlint
|
6
|
-
|
7
|
-
# RUBYGEMS
|
8
|
-
|
9
|
-
https://rubygems.org/gems/gtdlint
|
10
|
-
|
11
|
-
# ABOUT
|
12
|
-
|
13
|
-
Gtdlint is a command line program for finding TODO tasks in a project, such as `// TODO` code comments. By default, gtdlint is case-insensitve, and looks for:
|
14
|
-
|
15
|
-
* `todo`
|
16
|
-
* `pending`
|
17
|
-
* `hack`
|
18
|
-
|
19
|
-
gtdlint can be customized with a `-p` command line flag and/or a `.gtdlintrc.yml` configuration file. For example, gtdlint can be configured to look for `pte`/`hack` in Spanish projects.
|
20
|
-
|
21
|
-
gtdlint is a shell wrapper around the traditional GNU [grep](http://www.gnu.org/software/grep/) backend, presenting a frontend similar to modern linters like [Reek](https://github.com/troessner/reek/wiki) and [JSHint](http://jshint.com/).
|
22
|
-
|
23
|
-
* Recursive file search by default
|
24
|
-
* Optional ignore patterns
|
25
|
-
* Configuration via per-project and per-user [dotfiles](https://github.com/mcandre/gtdlint/blob/master/CONFIGURE.md#dotfiles)
|
26
|
-
* Install via a standard programming language package manager
|
3
|
+
`gtdlint` searches your projects for code comments indicating TODOs, FIXMEs, and other changes that need to be made.
|
27
4
|
|
28
5
|
# EXAMPLES
|
29
6
|
|
@@ -41,7 +18,7 @@ stdin:1:// TODO: Add copyright
|
|
41
18
|
stdin:6: // TODO: Add proper line ending
|
42
19
|
stdin:9: putc(10, stdout); // hack
|
43
20
|
|
44
|
-
$ gtdlint -i
|
21
|
+
$ gtdlint -i .gitignore '*.c' examples/
|
45
22
|
examples/spanish/phrases.txt:1:PTE: Agregar más frases.
|
46
23
|
examples/spec/int_spec.rb:3: pending('mathematical revolution')
|
47
24
|
|
@@ -50,7 +27,7 @@ examples/spanish/phrases.txt:1:PTE: Agregar más frases.
|
|
50
27
|
|
51
28
|
$ gtdlint -h
|
52
29
|
Usage: gtdlint [options] [<files>|-]
|
53
|
-
-i, --ignore pattern Ignore file
|
30
|
+
-i, --ignore pattern Ignore file pattern (fnmatch)
|
54
31
|
-p, --gtd-pattern pattern Custom GTD pattern
|
55
32
|
-B, --lines-before n Also show n lines before matching line
|
56
33
|
-A, --lines-after n Also show n lines after matching line
|
@@ -64,9 +41,34 @@ gtdlint can be combined with other programs. For example, check your most recent
|
|
64
41
|
$ git diff HEAD~1 | gtdlint
|
65
42
|
```
|
66
43
|
|
44
|
+
# HOMEPAGE
|
45
|
+
|
46
|
+
https://github.com/mcandre/gtdlint
|
47
|
+
|
48
|
+
# RUBYGEMS
|
49
|
+
|
50
|
+
https://rubygems.org/gems/gtdlint
|
51
|
+
|
52
|
+
# ABOUT
|
53
|
+
|
54
|
+
Gtdlint is a command line program for finding TODO tasks in a project, such as `// TODO` code comments. By default, gtdlint is case-insensitve, and looks for:
|
55
|
+
|
56
|
+
* `todo`
|
57
|
+
* `pending`
|
58
|
+
* `hack`
|
59
|
+
|
60
|
+
gtdlint can be customized with a `-p` command line flag and/or a `.gtdlintrc.yml` configuration file. For example, gtdlint can be configured to look for `pte`/`hack` in Spanish projects.
|
61
|
+
|
62
|
+
gtdlint is a shell wrapper around the traditional GNU [grep](http://www.gnu.org/software/grep/) backend, presenting a frontend similar to modern linters like [Reek](https://github.com/troessner/reek/wiki) and [JSHint](http://jshint.com/).
|
63
|
+
|
64
|
+
* Recursive file scanning, like `jshint .`
|
65
|
+
* Optional ignore patterns, like `.gitignore`
|
66
|
+
* Configuration via per-project and per-user [dotfiles](https://github.com/mcandre/gtdlint/blob/master/CONFIGURE.md#dotfiles)
|
67
|
+
* Install via a standard programming language package manager
|
68
|
+
|
67
69
|
# REQUIREMENTS
|
68
70
|
|
69
|
-
* [Ruby](https://www.ruby-lang.org/) 2+
|
71
|
+
* [Ruby](https://www.ruby-lang.org/) 2.0+
|
70
72
|
* [grep](http://www.gnu.org/software/grep/) (often built-in, or provided by [git](http://git-scm.com/))
|
71
73
|
|
72
74
|
E.g., Windows users can `chocolatey install git`.
|
data/bin/gtdlint
CHANGED
@@ -3,23 +3,19 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'find'
|
5
5
|
require 'optparse'
|
6
|
+
require 'dotsmack'
|
6
7
|
require 'yaml'
|
7
8
|
require 'gtdlint'
|
8
9
|
|
9
|
-
IGNORE_FILENAME = '.gtdlintignore'
|
10
|
-
CONFIGURATION_FILENAME = '.gtdlintrc.yml'
|
11
|
-
|
12
10
|
def main
|
13
11
|
ignores = DEFAULT_IGNORES
|
14
12
|
|
15
|
-
filenames = ['-']
|
16
|
-
|
17
13
|
configuration_flags = {}
|
18
14
|
|
19
15
|
option = OptionParser.new do |option|
|
20
16
|
option.banner = "Usage: gtdlint [options] [<files>|-]"
|
21
17
|
|
22
|
-
option.on('-i', '--ignore pattern', 'Ignore file
|
18
|
+
option.on('-i', '--ignore pattern', 'Ignore file pattern (fnmatch)') do |pattern|
|
23
19
|
ignores << pattern
|
24
20
|
end
|
25
21
|
|
@@ -27,11 +23,11 @@ def main
|
|
27
23
|
configuration_flags["gtd_pattern"] = pattern
|
28
24
|
end
|
29
25
|
|
30
|
-
option.on('-B', '--lines-before
|
26
|
+
option.on('-B', '--lines-before=n', 'Also show n lines before matching line') do |n|
|
31
27
|
configuration_flags["lines_before"] = n.to_i
|
32
28
|
end
|
33
29
|
|
34
|
-
option.on('-A', '--lines-after
|
30
|
+
option.on('-A', '--lines-after=n', 'Also show n lines after matching line') do |n|
|
35
31
|
configuration_flags["lines_after"] = n.to_i
|
36
32
|
end
|
37
33
|
|
@@ -48,100 +44,31 @@ def main
|
|
48
44
|
|
49
45
|
option.parse!
|
50
46
|
|
51
|
-
filenames =
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
pwd = Dir.pwd
|
57
|
-
|
58
|
-
dir = pwd
|
59
|
-
|
60
|
-
parent_of_home = File.expand_path("..", ENV["HOME"])
|
61
|
-
|
62
|
-
while dir != parent_of_home
|
63
|
-
ignore_file = dir + File::SEPARATOR + IGNORE_FILENAME
|
64
|
-
|
65
|
-
if File.exist?(ignore_file) then
|
66
|
-
ignores.concat(open(ignore_file).read.split("\n"))
|
67
|
-
end
|
68
|
-
|
69
|
-
dir = File.expand_path("..", dir)
|
47
|
+
filenames =
|
48
|
+
if ARGV == []
|
49
|
+
['-']
|
50
|
+
else
|
51
|
+
ARGV
|
70
52
|
end
|
71
53
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
while dir != parent_of_home
|
78
|
-
config_file = dir + File::SEPARATOR + CONFIGURATION_FILENAME
|
79
|
-
|
80
|
-
if File.exist?(config_file) then
|
81
|
-
configuration_dotfile = DEFAULT_CONFIGURATION.merge(YAML.load_file(config_file))
|
82
|
-
break
|
83
|
-
else
|
84
|
-
dir = File.expand_path("..", dir)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
# Command line flags override dotfile settings
|
89
|
-
configuration = configuration_dotfile.merge(configuration_flags)
|
90
|
-
|
91
|
-
check_stdin(configuration)
|
92
|
-
end
|
93
|
-
else
|
94
|
-
recursive_filenames = []
|
54
|
+
dotsmack = Dotsmack::Smacker.new(
|
55
|
+
dotignore = '.gtdlintignore',
|
56
|
+
additional_ignores = ignores,
|
57
|
+
dotconfig = '.gtdlintrc.yml'
|
58
|
+
)
|
95
59
|
|
96
|
-
|
97
|
-
|
98
|
-
|
60
|
+
dotsmack.enumerate(filenames).each do |filename, config|
|
61
|
+
config =
|
62
|
+
if config.nil?
|
63
|
+
DEFAULT_CONFIGURATION.merge(configuration_flags)
|
99
64
|
else
|
100
|
-
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
configuration_dotfile = DEFAULT_CONFIGURATION
|
105
|
-
|
106
|
-
recursive_filenames.each do |f|
|
107
|
-
dir = File.expand_path("..", f)
|
108
|
-
|
109
|
-
parent_of_home = File.expand_path("..", ENV["HOME"])
|
110
|
-
|
111
|
-
while dir != parent_of_home
|
112
|
-
ignore_file = dir + File::SEPARATOR + IGNORE_FILENAME
|
113
|
-
|
114
|
-
if File.exist?(ignore_file) then
|
115
|
-
ignores.concat(open(ignore_file).read.split("\n"))
|
116
|
-
end
|
117
|
-
|
118
|
-
dir = File.expand_path("..", dir)
|
65
|
+
YAML.load(config).merge(DEFAULT_CONFIGURATION).merge(configuration_flags)
|
119
66
|
end
|
120
67
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
while dir != parent_of_home
|
127
|
-
config_file = dir + File::SEPARATOR + CONFIGURATION_FILENAME
|
128
|
-
|
129
|
-
if File.exist?(config_file) then
|
130
|
-
configuration_dotfile = DEFAULT_CONFIGURATION.merge(YAML.load_file(config_file))
|
131
|
-
break
|
132
|
-
else
|
133
|
-
dir = File.expand_path("..", dir)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
# Hack to Reset configuration when changing directories
|
138
|
-
configuration_dotfile = DEFAULT_CONFIGURATION unless File.exist?(dir + File::SEPARATOR + CONFIGURATION_FILENAME)
|
139
|
-
|
140
|
-
# Command line flags override dotfile settings
|
141
|
-
configuration = configuration_dotfile.merge(configuration_flags)
|
142
|
-
|
143
|
-
check(f, configuration)
|
144
|
-
end
|
68
|
+
if filename == '-'
|
69
|
+
check_stdin(config)
|
70
|
+
else
|
71
|
+
check(filename, config)
|
145
72
|
end
|
146
73
|
end
|
147
74
|
end
|
data/lib/gtdlint.rb
CHANGED
@@ -1,34 +1,57 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'ptools'
|
3
2
|
require 'tempfile'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
require 'version'
|
4
|
+
require_relative 'version'
|
8
5
|
|
9
6
|
DEFAULT_IGNORES = %w(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
tmp
|
8
|
+
.hg
|
9
|
+
.svn
|
10
|
+
.git
|
11
|
+
.gtdlintignore
|
12
|
+
.gtdlintrc.yml
|
13
|
+
node_modules
|
14
|
+
bower_components
|
15
|
+
target
|
16
|
+
dist
|
17
|
+
.vagrant
|
17
18
|
Gemfile.lock
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
*.exe
|
20
|
+
*.bin
|
21
|
+
*.apk
|
22
|
+
*.ap_
|
23
|
+
res
|
24
|
+
*.class
|
25
|
+
*.zip
|
26
|
+
*.jar
|
27
|
+
*.war
|
28
|
+
*.xpi
|
29
|
+
*.dmg
|
30
|
+
*.pkg
|
31
|
+
*.app
|
32
|
+
*.xcodeproj
|
33
|
+
*.lproj
|
34
|
+
*.xcassets
|
35
|
+
*.pmdoc
|
36
|
+
*.dSYM
|
37
|
+
*.jad
|
38
|
+
*.cmo
|
39
|
+
*.cmi
|
40
|
+
*.png
|
41
|
+
*.gif
|
42
|
+
*.jpg
|
43
|
+
*.jpeg
|
44
|
+
*.tiff
|
45
|
+
*.ico
|
46
|
+
*.svg
|
47
|
+
*.dot
|
48
|
+
*.wav
|
49
|
+
*.mp3
|
50
|
+
*[.-]min.*
|
28
51
|
)
|
29
52
|
|
30
53
|
# Grep format, case insensitive
|
31
|
-
DEFAULT_GTD_PATTERN = "\'todo\\|to do\\|to-do\\|pending\\|hack\'"
|
54
|
+
DEFAULT_GTD_PATTERN = "\'todo\\|to do\\|to-do\\|pending\\|hack\\|fixme\'"
|
32
55
|
|
33
56
|
DEFAULT_LINES_BEFORE = 0
|
34
57
|
DEFAULT_LINES_AFTER = 0
|
@@ -69,27 +92,21 @@ class GTDThing
|
|
69
92
|
end
|
70
93
|
end
|
71
94
|
|
72
|
-
def self.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
File.binary?(f)
|
79
|
-
rescue Errno::ENOENT
|
80
|
-
true
|
95
|
+
def self.check_stdin(configuration = nil)
|
96
|
+
configuration =
|
97
|
+
if configuration.nil?
|
98
|
+
DEFAULT_CONFIGURATION
|
99
|
+
else
|
100
|
+
configuration
|
81
101
|
end
|
82
|
-
end
|
83
|
-
end
|
84
102
|
|
85
|
-
def self.check_stdin(configuration = DEFAULT_CONFIGURATION)
|
86
103
|
gtd_pattern = configuration['gtd_pattern']
|
87
104
|
lines_before = configuration['lines_before']
|
88
105
|
lines_after = configuration['lines_after']
|
89
106
|
|
90
107
|
contents = $stdin.read
|
91
108
|
|
92
|
-
t = Tempfile.new('
|
109
|
+
t = Tempfile.new('gtdlint')
|
93
110
|
t.write(contents)
|
94
111
|
t.close
|
95
112
|
|
@@ -111,7 +128,14 @@ def self.check_stdin(configuration = DEFAULT_CONFIGURATION)
|
|
111
128
|
gtd_things.each { |m| puts m }
|
112
129
|
end
|
113
130
|
|
114
|
-
def self.check(filename, configuration =
|
131
|
+
def self.check(filename, configuration = nil)
|
132
|
+
configuration =
|
133
|
+
if configuration.nil?
|
134
|
+
DEFAULT_CONFIGURATION
|
135
|
+
else
|
136
|
+
configuration
|
137
|
+
end
|
138
|
+
|
115
139
|
gtd_pattern = configuration['gtd_pattern']
|
116
140
|
lines_before = configuration['lines_before']
|
117
141
|
lines_after = configuration['lines_after']
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtdlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Pennebaker
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dotsmack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.3'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,7 +258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
244
258
|
requirements:
|
245
259
|
- - '>='
|
246
260
|
- !ruby/object:Gem::Version
|
247
|
-
version: '0'
|
261
|
+
version: '2.0'
|
248
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
263
|
requirements:
|
250
264
|
- - '>='
|
@@ -252,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
266
|
version: '0'
|
253
267
|
requirements: []
|
254
268
|
rubyforge_project:
|
255
|
-
rubygems_version: 2.
|
269
|
+
rubygems_version: 2.4.6
|
256
270
|
signing_key:
|
257
271
|
specification_version: 4
|
258
272
|
summary: search for TO-DO items to complete in large projects
|