pronto-punchlist 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rubocop.yml +73 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +24 -0
  6. data/CODE_OF_CONDUCT.md +75 -0
  7. data/Gemfile +10 -0
  8. data/Gemfile.lock +221 -0
  9. data/LICENSE.txt +21 -0
  10. data/Makefile +13 -0
  11. data/README.md +66 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +15 -0
  14. data/bin/setup +8 -0
  15. data/coverage/.last_run.json +5 -0
  16. data/feature/feature_helper.rb +38 -0
  17. data/feature/pronto/punchlist_cli_spec.rb +88 -0
  18. data/lib/pronto/punchlist.rb +42 -0
  19. data/lib/pronto/punchlist/driver.rb +21 -0
  20. data/lib/pronto/punchlist/file_classifier.rb +20 -0
  21. data/lib/pronto/punchlist/message_creator.rb +18 -0
  22. data/lib/pronto/punchlist/offense_matcher.rb +31 -0
  23. data/lib/pronto/punchlist/patch_inspector.rb +31 -0
  24. data/lib/pronto/punchlist/patch_validator.rb +23 -0
  25. data/lib/pronto/punchlist/version.rb +7 -0
  26. data/metrics/bigfiles_high_water_mark +1 -0
  27. data/metrics/brakeman_high_water_mark +1 -0
  28. data/metrics/bundle-audit_high_water_mark +1 -0
  29. data/metrics/cane_high_water_mark +1 -0
  30. data/metrics/eslint_high_water_mark +1 -0
  31. data/metrics/flake8_high_water_mark +1 -0
  32. data/metrics/flay_high_water_mark +1 -0
  33. data/metrics/flog_high_water_mark +1 -0
  34. data/metrics/jscs_high_water_mark +1 -0
  35. data/metrics/mdl_high_water_mark +1 -0
  36. data/metrics/punchlist_high_water_mark +1 -0
  37. data/metrics/pycodestyle_high_water_mark +1 -0
  38. data/metrics/rails_best_practices_high_water_mark +1 -0
  39. data/metrics/rubocop_high_water_mark +1 -0
  40. data/metrics/scalastyle_high_water_mark +1 -0
  41. data/metrics/shellcheck_high_water_mark +1 -0
  42. data/pronto-punchlist.gemspec +49 -0
  43. data/rakelib/ci.rake +3 -0
  44. data/rakelib/clear_metrics.rake +7 -0
  45. data/rakelib/default.rake +3 -0
  46. data/rakelib/feature.rake +9 -0
  47. data/rakelib/localtest.rake +3 -0
  48. data/rakelib/quality.rake +19 -0
  49. data/rakelib/spec.rake +9 -0
  50. metadata +196 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e44ce72ea1916778cde6145c88eb5aca6678daec
4
+ data.tar.gz: f24deba1648c9440d8560ac5876626d4f0f02de7
5
+ SHA512:
6
+ metadata.gz: 50067449b97dc9b36e1d22dadc948d077c46ac1ea78c69b8f094f95da672deed8c631fa526da4d31a7de4f387347e9b3eaf484ac663e1ad8969a4985c19abb59
7
+ data.tar.gz: 309d89d05ab6b0e3d1035633530833ef0acd7f83f55d0558b1822f72e220029f951952324d8874c0d89574b64e305b4af4987d8713b2c98fdcd283fa91933852
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /doc/
5
+ /pkg/
6
+ /spec/reports/
7
+ /tmp/
8
+ /coverage/.resultset.json
9
+ /coverage/.resultset.json.lock
10
+ /coverage/assets/
11
+ /coverage/index.html
12
+ /pkg
@@ -0,0 +1,73 @@
1
+ # I like trailing commas in hashes. They let me insert new elements and
2
+ # see them as one line in a diff, not two.
3
+ Style/TrailingCommaInHashLiteral:
4
+ EnforcedStyleForMultiline: comma
5
+
6
+ Style/TrailingCommaInArrayLiteral:
7
+ EnforcedStyleForMultiline: comma
8
+
9
+ # I use keyword arguments for a poor man's dependency injection to cut
10
+ # down on the magic in my tests.
11
+ Metrics/ParameterLists:
12
+ CountKeywordArgs: false
13
+
14
+ # If i'm using one function name and returning the contents of an
15
+ # attribute, that's OK. The alternative would be this, which I find
16
+ # confusing and often not really what I mean:
17
+ #
18
+ # attr_reader :something_else
19
+ # alias_method :something, :something_else
20
+ Style/TrivialAccessors:
21
+ ExactNameMatch: true
22
+
23
+ #
24
+ # Add 'XX X' to the standard list
25
+ #
26
+ Style/CommentAnnotation:
27
+ Keywords:
28
+ - "TOD\
29
+ O"
30
+ - "FIXM\
31
+ E"
32
+ - "OPTIMIZ\
33
+ E"
34
+ - "HAC\
35
+ K"
36
+ - "REVIE\
37
+ W"
38
+ - "XX\
39
+ X"
40
+
41
+ # https://stackoverflow.com/questions/40934345/rubocop-25-line-block-size-and-rspec-tests
42
+ Metrics/BlockLength:
43
+ # Exclude DSLs
44
+ Exclude:
45
+ - 'Rakefile'
46
+ - '*.gemspec'
47
+ - '**/*.rake'
48
+ - 'spec/**/*.rb'
49
+ - 'feature/**/*.rb'
50
+
51
+ # http://www.betterspecs.org/#single
52
+ #
53
+ # > in tests that are not isolated (e.g. ones that integrate with a
54
+ # > DB, an external webservice, or end-to-end-tests), you take a
55
+ # > massive performance hit to do the same setup over and over again,
56
+ # > just to set a different expectation in each test. In these sorts
57
+ # > of slower tests, I think it's fine to specify more than one
58
+ # > isolated behavior.
59
+ RSpec/MultipleExpectations:
60
+ Exclude:
61
+ - 'feature/**/*.rb'
62
+
63
+ Style/StringLiterals:
64
+ EnforcedStyle: single_quotes
65
+ SupportedStyles:
66
+ - single_quotes
67
+ - double_quotes
68
+ ConsistentQuotesInMultiline: true
69
+
70
+ AllCops:
71
+ TargetRubyVersion: 2.4
72
+
73
+ require: rubocop-rspec
@@ -0,0 +1 @@
1
+ ruby-2.4.9
@@ -0,0 +1,24 @@
1
+ language: ruby
2
+ before_install:
3
+ # https://bundler.io/blog/2019/05/14/
4
+ # solutions-for-cant-find-gem-bundler-with-executable-bundle.html
5
+ - gem update --system
6
+ - gem install bundler
7
+ rvm:
8
+ - ruby-2.4
9
+ - ruby-2.5
10
+ - ruby-2.6
11
+ - ruby-2.7
12
+
13
+ # deprecation warnings blocking quality output counts
14
+ # https://travis-ci.com/apiology/pronto-punchlist/jobs/264907930
15
+ # - ruby-2.7.0-preview3
16
+
17
+ # JRuby error with native code build - possibly can be overcome?
18
+ # checking for main() in -lstdc++... RuntimeError: The compiler failed to generate
19
+ # https://travis-ci.com/apiology/pronto-punchlist/jobs/264907931
20
+ # - jruby-head
21
+
22
+ # deprecation warnings blocking quality output counts
23
+ # https://travis-ci.com/apiology/pronto-punchlist/jobs/264907932
24
+ # - ruby-head
@@ -0,0 +1,75 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual
26
+ attention or advances
27
+ * Trolling, insulting/derogatory comments, and personal or political
28
+ attacks
29
+ * Public or private harassment
30
+ * Publishing others' private information, such as a physical or electronic
31
+ address, without explicit permission
32
+ * Other conduct which could reasonably be considered inappropriate in a
33
+ professional setting
34
+
35
+ ## Our Responsibilities
36
+
37
+ Project maintainers are responsible for clarifying the standards of acceptable
38
+ behavior and are expected to take appropriate and fair corrective action in
39
+ response to any instances of unacceptable behavior.
40
+
41
+ Project maintainers have the right and responsibility to remove, edit, or
42
+ reject comments, commits, code, wiki edits, issues, and other contributions
43
+ that are not aligned to this Code of Conduct, or to ban temporarily or
44
+ permanently any contributor for other behaviors that they deem inappropriate,
45
+ threatening, offensive, or harmful.
46
+
47
+ ## Scope
48
+
49
+ This Code of Conduct applies both within project spaces and in public spaces
50
+ when an individual is representing the project or its community. Examples of
51
+ representing a project or community include using an official project e-mail
52
+ address, posting via an official social media account, or acting as an appointed
53
+ representative at an online or offline event. Representation of a project may be
54
+ further defined and clarified by project maintainers.
55
+
56
+ ## Enforcement
57
+
58
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
59
+ reported by contacting the project team at vince.broz@bluelabs.com. All
60
+ complaints will be reviewed and investigated and will result in a response that
61
+ is deemed necessary and appropriate to the circumstances. The project team is
62
+ obligated to maintain confidentiality with regard to the reporter of an incident.
63
+ Further details of specific enforcement policies may be posted separately.
64
+
65
+ Project maintainers who do not follow or enforce the Code of Conduct in good
66
+ faith may face temporary or permanent repercussions as determined by other
67
+ members of the project's leadership.
68
+
69
+ ## Attribution
70
+
71
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
72
+ version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
73
+
74
+ [homepage]: http://contributor-covenant.org
75
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in pronto-punchlist.gemspec
6
+ gemspec
7
+
8
+ gem 'source_finder'
9
+
10
+ # gem 'punchlist', path: '/Users/broz/src/punchlist'
@@ -0,0 +1,221 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pronto-punchlist (0.1.0)
5
+ pronto
6
+ punchlist (>= 1.3.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (5.2.4.1)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 0.7, < 2)
14
+ minitest (~> 5.1)
15
+ tzinfo (~> 1.1)
16
+ addressable (2.7.0)
17
+ public_suffix (>= 2.0.2, < 5.0)
18
+ ast (2.4.0)
19
+ axiom-types (0.1.1)
20
+ descendants_tracker (~> 0.0.4)
21
+ ice_nine (~> 0.11.0)
22
+ thread_safe (~> 0.3, >= 0.3.1)
23
+ bigfiles (0.1.3)
24
+ source_finder (>= 2)
25
+ brakeman (4.7.2)
26
+ bundler-audit (0.6.1)
27
+ bundler (>= 1.2.0, < 3)
28
+ thor (~> 0.18)
29
+ cane (3.0.0)
30
+ parallel
31
+ charlock_holmes (0.7.7)
32
+ code_analyzer (0.4.8)
33
+ sexp_processor
34
+ codeclimate-engine-rb (0.4.1)
35
+ virtus (~> 1.0)
36
+ coercible (1.0.0)
37
+ descendants_tracker (~> 0.0.1)
38
+ concurrent-ruby (1.1.5)
39
+ descendants_tracker (0.0.4)
40
+ thread_safe (~> 0.3, >= 0.3.1)
41
+ diff-lcs (1.3)
42
+ docile (1.3.2)
43
+ domain_name (0.5.20190701)
44
+ unf (>= 0.0.5, < 1.0.0)
45
+ equalizer (0.0.11)
46
+ erubis (2.7.0)
47
+ escape_utils (1.2.1)
48
+ faraday (0.17.1)
49
+ multipart-post (>= 1.2, < 3)
50
+ flay (2.12.1)
51
+ erubis (~> 2.7.0)
52
+ path_expander (~> 1.0)
53
+ ruby_parser (~> 3.0)
54
+ sexp_processor (~> 4.0)
55
+ flog (4.6.4)
56
+ path_expander (~> 1.0)
57
+ ruby_parser (~> 3.1, > 3.1.0)
58
+ sexp_processor (~> 4.8)
59
+ github-linguist (7.7.0)
60
+ charlock_holmes (~> 0.7.6)
61
+ escape_utils (~> 1.2.0)
62
+ mini_mime (~> 1.0)
63
+ rugged (>= 0.25.1)
64
+ gitlab (4.13.1)
65
+ httparty (~> 0.14, >= 0.14.0)
66
+ terminal-table (~> 1.5, >= 1.5.1)
67
+ http-accept (1.7.0)
68
+ http-cookie (1.0.3)
69
+ domain_name (~> 0.5)
70
+ httparty (0.17.3)
71
+ mime-types (~> 3.0)
72
+ multi_xml (>= 0.5.2)
73
+ i18n (1.7.0)
74
+ concurrent-ruby (~> 1.0)
75
+ ice_nine (0.11.2)
76
+ jaro_winkler (1.5.4)
77
+ json (2.3.0)
78
+ kramdown (2.1.0)
79
+ kramdown-parser-gfm (1.1.0)
80
+ kramdown (~> 2.0)
81
+ kwalify (0.7.2)
82
+ mdl (0.8.0)
83
+ kramdown (~> 2.0)
84
+ kramdown-parser-gfm (~> 1.0)
85
+ mixlib-cli (~> 2.1, >= 2.1.1)
86
+ mixlib-config (>= 2.2.1, < 4)
87
+ mime-types (3.3)
88
+ mime-types-data (~> 3.2015)
89
+ mime-types-data (3.2019.1009)
90
+ mini_mime (1.0.2)
91
+ minitest (5.13.0)
92
+ mixlib-cli (2.1.5)
93
+ mixlib-config (3.0.5)
94
+ tomlrb
95
+ multi_xml (0.6.0)
96
+ multipart-post (2.1.1)
97
+ netrc (0.11.0)
98
+ octokit (4.14.0)
99
+ sawyer (~> 0.8.0, >= 0.5.3)
100
+ parallel (1.19.1)
101
+ parser (2.6.5.0)
102
+ ast (~> 2.4.0)
103
+ path_expander (1.1.0)
104
+ pronto (0.10.0)
105
+ gitlab (~> 4.0, >= 4.0.0)
106
+ httparty (>= 0.13.7)
107
+ octokit (~> 4.7, >= 4.7.0)
108
+ rainbow (>= 2.2, < 4.0)
109
+ rugged (~> 0.24, >= 0.23.0)
110
+ thor (~> 0.20.0)
111
+ psych (3.1.0)
112
+ public_suffix (4.0.1)
113
+ punchlist (1.3.0)
114
+ source_finder (>= 2)
115
+ quality (36.0.0)
116
+ activesupport
117
+ bigfiles (>= 0.1)
118
+ brakeman
119
+ bundler-audit
120
+ cane (>= 2.6)
121
+ flay (>= 2.4, != 2.6.0)
122
+ flog (>= 4.1.1)
123
+ github-linguist
124
+ json
125
+ mdl
126
+ punchlist (>= 1.1)
127
+ rails_best_practices
128
+ reek (>= 1.3.4)
129
+ rest-client (>= 1.8.0)
130
+ rubocop (~> 0.78.0)
131
+ rubocop-rspec (>= 1.19.0)
132
+ ruby_parser (>= 3.2.2, != 3.6.6)
133
+ rails_best_practices (1.19.4)
134
+ activesupport
135
+ code_analyzer (>= 0.4.8)
136
+ erubis
137
+ i18n
138
+ json
139
+ require_all (~> 2.0)
140
+ ruby-progressbar
141
+ rainbow (3.0.0)
142
+ rake (10.5.0)
143
+ reek (5.5.0)
144
+ codeclimate-engine-rb (~> 0.4.0)
145
+ kwalify (~> 0.7.0)
146
+ parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
147
+ psych (~> 3.1.0)
148
+ rainbow (>= 2.0, < 4.0)
149
+ require_all (2.0.0)
150
+ rest-client (2.1.0)
151
+ http-accept (>= 1.7.0, < 2.0)
152
+ http-cookie (>= 1.0.2, < 2.0)
153
+ mime-types (>= 1.16, < 4.0)
154
+ netrc (~> 0.8)
155
+ rspec (3.9.0)
156
+ rspec-core (~> 3.9.0)
157
+ rspec-expectations (~> 3.9.0)
158
+ rspec-mocks (~> 3.9.0)
159
+ rspec-core (3.9.0)
160
+ rspec-support (~> 3.9.0)
161
+ rspec-expectations (3.9.0)
162
+ diff-lcs (>= 1.2.0, < 2.0)
163
+ rspec-support (~> 3.9.0)
164
+ rspec-mocks (3.9.0)
165
+ diff-lcs (>= 1.2.0, < 2.0)
166
+ rspec-support (~> 3.9.0)
167
+ rspec-support (3.9.0)
168
+ rubocop (0.78.0)
169
+ jaro_winkler (~> 1.5.1)
170
+ parallel (~> 1.10)
171
+ parser (>= 2.6)
172
+ rainbow (>= 2.2.2, < 4.0)
173
+ ruby-progressbar (~> 1.7)
174
+ unicode-display_width (>= 1.4.0, < 1.7)
175
+ rubocop-rspec (1.37.1)
176
+ rubocop (>= 0.68.1)
177
+ ruby-progressbar (1.10.1)
178
+ ruby_parser (3.14.1)
179
+ sexp_processor (~> 4.9)
180
+ rugged (0.28.4.1)
181
+ sawyer (0.8.2)
182
+ addressable (>= 2.3.5)
183
+ faraday (> 0.8, < 2.0)
184
+ sexp_processor (4.13.0)
185
+ simplecov (0.17.1)
186
+ docile (~> 1.1)
187
+ json (>= 1.8, < 3)
188
+ simplecov-html (~> 0.10.0)
189
+ simplecov-html (0.10.2)
190
+ source_finder (3.2.1)
191
+ terminal-table (1.8.0)
192
+ unicode-display_width (~> 1.1, >= 1.1.1)
193
+ thor (0.20.3)
194
+ thread_safe (0.3.6)
195
+ tomlrb (1.2.9)
196
+ tzinfo (1.2.6)
197
+ thread_safe (~> 0.1)
198
+ unf (0.1.4)
199
+ unf_ext
200
+ unf_ext (0.0.7.6)
201
+ unicode-display_width (1.6.0)
202
+ virtus (1.0.5)
203
+ axiom-types (~> 0.1)
204
+ coercible (~> 1.0)
205
+ descendants_tracker (~> 0.0, >= 0.0.3)
206
+ equalizer (~> 0.0, >= 0.0.9)
207
+
208
+ PLATFORMS
209
+ ruby
210
+
211
+ DEPENDENCIES
212
+ bundler (~> 2.0)
213
+ pronto-punchlist!
214
+ quality (~> 36)
215
+ rake (~> 10.0)
216
+ rspec
217
+ simplecov
218
+ source_finder
219
+
220
+ BUNDLED WITH
221
+ 2.1.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Vince Broz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ .PHONY: spec feature
2
+
3
+ all:
4
+ @bundle exec rake localtest
5
+
6
+ feature:
7
+ @bundle exec rake feature
8
+
9
+ spec:
10
+ @bundle exec rake spec
11
+
12
+ rubocop:
13
+ @bundle exec rake rubocop
@@ -0,0 +1,66 @@
1
+ # Pronto::Punchlist
2
+
3
+ [![Build Status](https://travis-ci.org/apiology/pronto-punchlist.svg?branch=master)](https://travis-ci.org/apiology/pronto-punchlist)
4
+
5
+ Performs incremental quality reporting for the punchlist gem.
6
+ Punchlist reports on any 'TOD O'-style comments in code; this gem plugs
7
+ in with the 'pronto' gem, which does incremental reporting using a
8
+ variety of quality tools.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'pronto-punchlist'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ ```sh
21
+ bundle
22
+ ```
23
+
24
+ Or install it yourself as:
25
+
26
+ ```sh
27
+ gem install pronto-punchlist
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ This is typically used either as part a custom
33
+ [pronto](https://github.com/prontolabs/pronto) rigging, sometimes as
34
+ part of general use of the
35
+ [quality](https://github.com/apiology/quality) gem.
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install
40
+ dependencies. You can also run `bin/console` for an interactive prompt
41
+ that will allow you to experiment.
42
+
43
+ To install this gem onto your local machine, run `bundle exec rake
44
+ install`. To release a new version, update the version number in
45
+ `version.rb`, and then run `bundle exec rake release`, which will
46
+ create a git tag for the version, push git commits and tags, and push
47
+ the `.gem` file to [rubygems.org](https://rubygems.org).
48
+
49
+ ## Contributing
50
+
51
+ Bug reports and pull requests are welcome on
52
+ [GitHub](https://github.com/apiology/pronto-punchlist). This project
53
+ is intended to be a safe, welcoming space for collaboration, and
54
+ contributors are expected to adhere to the
55
+ [Contributor Covenant](http://contributor-covenant.org) code of conduct.
56
+
57
+ ## License
58
+
59
+ The gem is available as open source under the terms of the
60
+ [MIT License](https://opensource.org/licenses/MIT).
61
+
62
+ ## Code of Conduct
63
+
64
+ Everyone interacting in the Pronto::Punchlist project’s codebases,
65
+ issue trackers, chat rooms and mailing lists is expected to follow the
66
+ [code of conduct](https://github.com/[USERNAME]/pronto-punchlist/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+
5
+ desc 'Default: Run specs and check quality.'
6
+ task default: [:localtest]
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'pronto/punchlist'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ {
2
+ "result": {
3
+ "covered_percent": 100.0
4
+ }
5
+ }
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+
5
+ # Add the bin directory, to allow testing of gem executables as if the gem is
6
+ # already installed.
7
+ root_dir = RSpec::Core::RubyProject.root
8
+ exec_dir = File.join(File::SEPARATOR, root_dir, 'bin')
9
+ ENV['PATH'] = [exec_dir, ENV['PATH']].join(File::PATH_SEPARATOR)
10
+
11
+ # Courtesy of:
12
+ # https://raw.github.com/cupakromer/tao-of-tdd/master/adder/spec/support/
13
+ # capture_exec.rb
14
+ def exec_io(*cmd)
15
+ cmd = cmd.flatten
16
+ env = {
17
+ # Avoid spurious deprecation warnings in things which are out of
18
+ # our control
19
+ 'RUBYOPT' => '-W0',
20
+ }
21
+ all_out, _exit_code = Open3.capture2e(env, *cmd)
22
+
23
+ all_out
24
+ end
25
+
26
+ RSpec.configure do |config|
27
+ config.filter_run_excluding :wip
28
+ config.run_all_when_everything_filtered = true
29
+ config.order = 'random'
30
+ config.alias_it_should_behave_like_to :has_behavior
31
+ config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
32
+ end
33
+
34
+ def let_double(*doubles)
35
+ doubles.each do |double_sym|
36
+ let(double_sym) { double(double_sym.to_s) }
37
+ end
38
+ end
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../feature_helper'
4
+ require 'pronto/punchlist'
5
+ require 'tmpdir'
6
+
7
+ describe Pronto::Punchlist do
8
+ let(:env) do
9
+ {
10
+ # Avoid spurious deprecation warnings in things which are out of
11
+ # our control
12
+ 'RUBYOPT' => '-W0',
13
+ }
14
+ end
15
+
16
+ describe 'bundle exec pronto list' do
17
+ let(:expected_output) do
18
+ <<~OUTPUT
19
+ punchlist
20
+ OUTPUT
21
+ end
22
+
23
+ it 'lists this as a runner' do
24
+ out, exit_code = Open3.capture2e(env, 'bundle exec pronto list')
25
+ expect(out).to eq(expected_output)
26
+ expect(exit_code).to eq(0)
27
+ end
28
+ end
29
+
30
+ describe 'bundle exec pronto run --staged -r punchlist -f text' do
31
+ let(:pronto_command) do
32
+ 'bundle exec pronto run --staged -r punchlist -f text'
33
+ end
34
+
35
+ around do |example|
36
+ Dir.mktmpdir do |dir|
37
+ Dir.chdir(dir) do
38
+ system('git init')
39
+ File.write('README.md', 'Initial commit contents')
40
+ system('git add .')
41
+ system('git commit -m "First commit"')
42
+ example_files.each do |filename, contents|
43
+ File.write(filename, contents)
44
+ end
45
+ system('git add .')
46
+ example.run
47
+ end
48
+ end
49
+ end
50
+
51
+ context 'with no annotation comments' do
52
+ let(:example_files) do
53
+ {
54
+ 'boring.rb' => 'puts "hello world"',
55
+ }
56
+ end
57
+ let(:expected_output) { '' }
58
+
59
+ it 'runs and finds no files' do
60
+ out, exit_code = Open3.capture2e(env, pronto_command)
61
+ expect(out).to eq(expected_output)
62
+ expect(exit_code).to eq(0)
63
+ end
64
+ end
65
+
66
+ context 'with annotation comments' do
67
+ let(:example_files) do
68
+ {
69
+ 'more_interesting.rb' =>
70
+ "puts 'hello world'\n# TOD" \
71
+ "O: Write more code",
72
+ }
73
+ end
74
+
75
+ let(:expected_output) do
76
+ "more_interesting.rb:2 W: " \
77
+ "Uncompleted punchlist item detected--consider resolving or " \
78
+ "moving this to your issue tracker\n"
79
+ end
80
+
81
+ it 'runs and finds files to run' do
82
+ out, exit_code = Open3.capture2e(env, pronto_command)
83
+ expect(out).to end_with(expected_output)
84
+ expect(exit_code).to eq(0)
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pronto/punchlist/version'
4
+ require 'pronto/punchlist/patch_inspector'
5
+ require 'pronto/punchlist/driver'
6
+ require 'pronto/punchlist/patch_validator'
7
+ require 'pronto'
8
+
9
+ module Pronto
10
+ # Performs incremental quality reporting for the punchlist gem
11
+ class Punchlist < Runner
12
+ def initialize(patches, commit = nil,
13
+ regexp_string: ::Punchlist::Config
14
+ .default_punchlist_line_regexp_string,
15
+ punchlist_regexp: Regexp.new(regexp_string),
16
+ punchlist_driver: PunchlistDriver.new(punchlist_regexp),
17
+ patch_inspector: PatchInspector.new(punchlist_driver:
18
+ punchlist_driver),
19
+ patch_validator: PatchValidator.new)
20
+ super(patches, commit)
21
+ @patch_inspector = patch_inspector
22
+ @patch_validator = patch_validator
23
+ end
24
+
25
+ class Error < StandardError; end
26
+ def run
27
+ @patches.flat_map { |patch| inspect_patch(patch) }
28
+ end
29
+
30
+ def valid_patch?(patch)
31
+ @patch_validator.valid_patch?(patch)
32
+ end
33
+
34
+ def inspect_patch(patch)
35
+ if valid_patch?(patch)
36
+ @patch_inspector.inspect_patch(patch)
37
+ else
38
+ []
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pronto'
4
+ require 'punchlist'
5
+
6
+ module Pronto
7
+ class Punchlist < Runner
8
+ # Adapts the Punchlist gem for use
9
+ class PunchlistDriver
10
+ def initialize(punchlist_line_regexp,
11
+ inspector_class: ::Punchlist::Inspector)
12
+ @punchlist_line_regexp = punchlist_line_regexp
13
+ @inspector_class = inspector_class
14
+ end
15
+
16
+ def inspect_filename(path)
17
+ @inspector_class.new(@punchlist_line_regexp, path).run
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pronto
4
+ class Punchlist < Runner
5
+ # Classify whether files are relevant to punchlist
6
+ class FileClassifier
7
+ def initialize(source_file_globber: SourceFinder::SourceFileGlobber.new)
8
+ @source_file_globber = source_file_globber
9
+ end
10
+
11
+ def non_binary?(path)
12
+ # https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch
13
+ # EXTGLOB enables ',' as part of glob language
14
+ File.fnmatch?(@source_file_globber.source_and_doc_files_glob,
15
+ path,
16
+ File::FNM_EXTGLOB)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pronto'
4
+
5
+ module Pronto
6
+ class Punchlist < Runner
7
+ # Creates Pronto messages
8
+ class MessageCreator
9
+ MESSAGE = 'Uncompleted punchlist item detected--' \
10
+ 'consider resolving or moving this to ' \
11
+ 'your issue tracker'
12
+
13
+ def create(path, line)
14
+ Message.new(path, line, :warning, MESSAGE, nil, Pronto::Punchlist)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pronto'
4
+ require_relative 'message_creator'
5
+
6
+ module Pronto
7
+ class Punchlist < Runner
8
+ # Matches up the given offense with potentially matching lines
9
+ class OffenseMatcher
10
+ def initialize(offense,
11
+ message_creator: ::Pronto::Punchlist::MessageCreator.new)
12
+ @offense = offense
13
+ @message_creator = message_creator
14
+ end
15
+
16
+ def inspect_patch(patch)
17
+ patch.added_lines.each do |line|
18
+ message = inspect_line(line)
19
+ return message unless message.nil?
20
+ end
21
+ nil
22
+ end
23
+
24
+ def inspect_line(line)
25
+ return nil unless line.new_lineno == @offense.line_num
26
+
27
+ @message_creator.create(@offense.filename, line)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pronto'
4
+ require_relative 'offense_matcher'
5
+
6
+ module Pronto
7
+ class Punchlist < Runner
8
+ # Inspects a patch and reports any relevant offenses
9
+ class PatchInspector
10
+ def initialize(punchlist_driver:,
11
+ offense_matcher_class: OffenseMatcher)
12
+ @punchlist_driver = punchlist_driver
13
+ @offense_matcher_class = offense_matcher_class
14
+ end
15
+
16
+ def inspect_patch(patch)
17
+ path = patch.new_file_full_path
18
+
19
+ offenses = @punchlist_driver.inspect_filename(path)
20
+
21
+ messages = []
22
+ offenses.each do |offense|
23
+ offense_matcher = @offense_matcher_class.new(offense)
24
+ message = offense_matcher.inspect_patch(patch)
25
+ messages << message unless message.nil?
26
+ end
27
+ messages
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pronto'
4
+ require_relative 'file_classifier'
5
+
6
+ module Pronto
7
+ class Punchlist < Runner
8
+ # Determine if a patch contains analyzable files
9
+ class PatchValidator
10
+ def initialize(file_classifier: FileClassifier.new)
11
+ @file_classifier = file_classifier
12
+ end
13
+
14
+ def valid_patch?(patch)
15
+ return false if patch.additions < 1
16
+
17
+ path = patch.new_file_full_path
18
+
19
+ @file_classifier.non_binary?(path)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pronto
4
+ module PunchlistVersion
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ 300
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'pronto/punchlist/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'pronto-punchlist'
9
+ spec.version = Pronto::PunchlistVersion::VERSION
10
+ spec.authors = ['Vince Broz']
11
+ spec.email = ['vince@broz.cc']
12
+
13
+ spec.summary = 'Pronto plugin for the punchlist gem'
14
+ spec.description = <<~DESCRIPTION
15
+ Performs incremental quality reporting for the punchlist gem.
16
+ Punchlist reports on comments in code indicating short-term work
17
+ hasn't been done; this gem plugs in with the 'pronto' gem, which does
18
+ incremental reporting using a variety of quality tools}
19
+ DESCRIPTION
20
+ spec.homepage = 'https://github.com/apiology/pronto-punchlist'
21
+ spec.license = 'MIT'
22
+
23
+ spec.metadata['homepage_uri'] = spec.homepage
24
+ spec.metadata['source_code_uri'] =
25
+ 'https://github.com/apiology/pronto-punchlist'
26
+
27
+ # Specify which files should be added to the gem when it is
28
+ # released. The `git ls-files -z` loads the files in the RubyGem
29
+ # that have been added into git.
30
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
31
+ `git ls-files -z`.split("\x0").reject do |f|
32
+ f.match(%r{^(test|spec|features)/})
33
+ end
34
+ end
35
+ spec.bindir = 'exe'
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ['lib']
38
+
39
+ spec.add_dependency 'pronto'
40
+ # Punchlist internals were refactored in version 1.3.0 and a
41
+ # reasonable API exposed:
42
+ spec.add_dependency 'punchlist', '>= 1.3.0'
43
+
44
+ spec.add_development_dependency 'bundler', '~> 2.0'
45
+ spec.add_development_dependency 'quality', '~> 36'
46
+ spec.add_development_dependency 'rake', '~> 10.0'
47
+ spec.add_development_dependency 'rspec'
48
+ spec.add_development_dependency 'simplecov'
49
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ task ci: :localtest
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ task :clear_metrics do |_t|
4
+ ret =
5
+ system('git checkout coverage/.last_run.json metrics/*_high_water_mark')
6
+ raise unless ret
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ task default: :localtest
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Run features'
6
+ RSpec::Core::RakeTask.new(:feature) do |task|
7
+ task.pattern = 'feature/**/*_spec.rb'
8
+ task.rspec_opts = '--format doc'
9
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ task localtest: %i[clear_metrics spec feature quality]
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quality/rake/task'
4
+
5
+ Quality::Rake::Task.new do |task|
6
+ task.exclude_files = ['Gemfile.lock']
7
+ task.skip_tools = %w[reek cane]
8
+ task.output_dir = 'metrics'
9
+ task.punchlist_regexp = 'XX' \
10
+ 'X|TOD' \
11
+ 'O|FIXM' \
12
+ 'E|OPTIMIZ' \
13
+ 'E|HAC' \
14
+ 'K|REVIE' \
15
+ 'W|LATE' \
16
+ 'R|FIXI' \
17
+ 'T|xi' \
18
+ 't '
19
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Run specs'
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.pattern = 'spec/**/*_spec.rb'
8
+ task.rspec_opts = '--format doc'
9
+ end
metadata ADDED
@@ -0,0 +1,196 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pronto-punchlist
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vince Broz
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-12-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pronto
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: punchlist
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: quality
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '36'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '36'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: |
112
+ Performs incremental quality reporting for the punchlist gem.
113
+ Punchlist reports on comments in code indicating short-term work
114
+ hasn't been done; this gem plugs in with the 'pronto' gem, which does
115
+ incremental reporting using a variety of quality tools}
116
+ email:
117
+ - vince@broz.cc
118
+ executables: []
119
+ extensions: []
120
+ extra_rdoc_files: []
121
+ files:
122
+ - ".gitignore"
123
+ - ".rubocop.yml"
124
+ - ".ruby-version"
125
+ - ".travis.yml"
126
+ - CODE_OF_CONDUCT.md
127
+ - Gemfile
128
+ - Gemfile.lock
129
+ - LICENSE.txt
130
+ - Makefile
131
+ - README.md
132
+ - Rakefile
133
+ - bin/console
134
+ - bin/setup
135
+ - coverage/.last_run.json
136
+ - feature/feature_helper.rb
137
+ - feature/pronto/punchlist_cli_spec.rb
138
+ - lib/pronto/punchlist.rb
139
+ - lib/pronto/punchlist/driver.rb
140
+ - lib/pronto/punchlist/file_classifier.rb
141
+ - lib/pronto/punchlist/message_creator.rb
142
+ - lib/pronto/punchlist/offense_matcher.rb
143
+ - lib/pronto/punchlist/patch_inspector.rb
144
+ - lib/pronto/punchlist/patch_validator.rb
145
+ - lib/pronto/punchlist/version.rb
146
+ - metrics/bigfiles_high_water_mark
147
+ - metrics/brakeman_high_water_mark
148
+ - metrics/bundle-audit_high_water_mark
149
+ - metrics/cane_high_water_mark
150
+ - metrics/eslint_high_water_mark
151
+ - metrics/flake8_high_water_mark
152
+ - metrics/flay_high_water_mark
153
+ - metrics/flog_high_water_mark
154
+ - metrics/jscs_high_water_mark
155
+ - metrics/mdl_high_water_mark
156
+ - metrics/punchlist_high_water_mark
157
+ - metrics/pycodestyle_high_water_mark
158
+ - metrics/rails_best_practices_high_water_mark
159
+ - metrics/rubocop_high_water_mark
160
+ - metrics/scalastyle_high_water_mark
161
+ - metrics/shellcheck_high_water_mark
162
+ - pronto-punchlist.gemspec
163
+ - rakelib/ci.rake
164
+ - rakelib/clear_metrics.rake
165
+ - rakelib/default.rake
166
+ - rakelib/feature.rake
167
+ - rakelib/localtest.rake
168
+ - rakelib/quality.rake
169
+ - rakelib/spec.rake
170
+ homepage: https://github.com/apiology/pronto-punchlist
171
+ licenses:
172
+ - MIT
173
+ metadata:
174
+ homepage_uri: https://github.com/apiology/pronto-punchlist
175
+ source_code_uri: https://github.com/apiology/pronto-punchlist
176
+ post_install_message:
177
+ rdoc_options: []
178
+ require_paths:
179
+ - lib
180
+ required_ruby_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ requirements: []
191
+ rubyforge_project:
192
+ rubygems_version: 2.6.14.4
193
+ signing_key:
194
+ specification_version: 4
195
+ summary: Pronto plugin for the punchlist gem
196
+ test_files: []