punchlist 1.3.0 → 1.3.2

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.
Files changed (82) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +132 -0
  3. data/.envrc +4 -0
  4. data/.git-hooks/pre_commit/circle_ci.rb +25 -0
  5. data/.git-hooks/pre_commit/punchlist.rb +51 -0
  6. data/.git-hooks/pre_commit/solargraph_typecheck.rb +64 -0
  7. data/.gitattributes +6 -0
  8. data/.gitignore +60 -0
  9. data/.markdownlint_style.rb +3 -0
  10. data/.mdlrc +1 -0
  11. data/.overcommit.yml +87 -0
  12. data/.pronto.yml +2 -0
  13. data/.rubocop.yml +148 -0
  14. data/.solargraph.yml +26 -0
  15. data/.yamllint.yml +8 -0
  16. data/CODE_OF_CONDUCT.md +133 -0
  17. data/CONTRIBUTING.rst +75 -0
  18. data/ChangeLog.md +8 -0
  19. data/DEVELOPMENT.md +31 -0
  20. data/Gemfile +26 -0
  21. data/Gemfile.lock +186 -0
  22. data/LICENSE +22 -0
  23. data/Makefile +104 -0
  24. data/README.md +27 -0
  25. data/Rakefile +2 -49
  26. data/bin/bump +29 -0
  27. data/bin/overcommit +29 -0
  28. data/bin/rake +29 -0
  29. data/bin/rubocop +27 -0
  30. data/bin/solargraph +27 -0
  31. data/bin/yard +27 -0
  32. data/config/env.1p +0 -0
  33. data/docs/.gitignore +3 -0
  34. data/docs/cookiecutter_input.json +16 -0
  35. data/feature/expected/mixed_types_of_source_files_results.txt +2 -0
  36. data/feature/expected/no_files_results.txt +0 -0
  37. data/feature/expected/non_source_file_with_pis_results.txt +0 -0
  38. data/feature/expected/one_source_file_with_cis_results.txt +1 -0
  39. data/feature/expected/scala_file_to_be_ignored_results.txt +1 -0
  40. data/feature/expected/source_file_with_no_items_results.txt +0 -0
  41. data/feature/feature_helper.rb +41 -0
  42. data/feature/pronto_punchlist_use_spec.rb +26 -0
  43. data/feature/punchlist_cli_spec.rb +63 -0
  44. data/feature/samples/mixed_types_of_source_files/lib/bar.scala +1 -0
  45. data/feature/samples/mixed_types_of_source_files/lib/foo.rb +4 -0
  46. data/feature/samples/no_files/.ignore +0 -0
  47. data/feature/samples/non_source_file_with_pis/foo.doc +5 -0
  48. data/feature/samples/one_source_file_with_cis/app/foo.rb +4 -0
  49. data/feature/samples/scala_file_to_be_ignored/lib/bar.scala +1 -0
  50. data/feature/samples/scala_file_to_be_ignored/lib/foo.rb +4 -0
  51. data/feature/samples/source_file_with_no_items/foo.rb +3 -0
  52. data/fix.sh +411 -0
  53. data/lib/punchlist/inspector.rb +27 -7
  54. data/lib/punchlist/version.rb +1 -1
  55. data/lib/punchlist.rb +1 -0
  56. data/metrics/brakeman_high_water_mark +1 -0
  57. data/metrics/flake8_high_water_mark +1 -0
  58. data/metrics/jscs_high_water_mark +1 -0
  59. data/metrics/punchlist_high_water_mark +1 -0
  60. data/metrics/pycodestyle_high_water_mark +1 -0
  61. data/metrics/rails_best_practices_high_water_mark +1 -0
  62. data/metrics/scalastyle_high_water_mark +1 -0
  63. data/metrics/shellcheck_high_water_mark +1 -0
  64. data/package.json +9 -0
  65. data/punchlist.gemspec +25 -31
  66. data/rakelib/citest.rake +4 -0
  67. data/rakelib/clear_metrics.rake +9 -0
  68. data/rakelib/console.rake +6 -0
  69. data/rakelib/default.rake +4 -0
  70. data/rakelib/doc.rake +6 -0
  71. data/rakelib/feature.rake +10 -0
  72. data/rakelib/gem_tasks.rake +3 -0
  73. data/rakelib/localtest.rake +4 -0
  74. data/rakelib/overcommit.rake +6 -0
  75. data/rakelib/quality.rake +4 -0
  76. data/rakelib/repl.rake +4 -0
  77. data/rakelib/spec.rake +9 -0
  78. data/rakelib/undercover.rake +8 -0
  79. data/requirements_dev.txt +2 -0
  80. metadata +88 -114
  81. data/License.txt +0 -20
  82. /data/{bin → exe}/punchlist +0 -0
data/bin/bump ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bump' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("bump", "bump")
data/bin/overcommit ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'overcommit' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("overcommit", "overcommit")
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/bin/rubocop ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("rubocop", "rubocop")
data/bin/solargraph ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'solargraph' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("solargraph", "solargraph")
data/bin/yard ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'yard' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("yard", "yard")
data/config/env.1p ADDED
File without changes
data/docs/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.html
2
+ /css
3
+ /js
@@ -0,0 +1,16 @@
1
+ {
2
+ "_checkout": null,
3
+ "_output_dir": "/Users/broz/src/punchlist/.git/cookiecutter",
4
+ "_repo_dir": "/Users/broz/src/cookiecutter-gem",
5
+ "_template": "https://github.com/apiology/cookiecutter-gem",
6
+ "email": "vince@broz.cc",
7
+ "full_name": "Vince Broz",
8
+ "github_username": "apiology",
9
+ "module_name": "Punchlist",
10
+ "open_source_license": "MIT license",
11
+ "project_name": "Punchlist",
12
+ "project_short_description": "Counts the number of 'todo' comments in your code",
13
+ "project_slug": "punchlist",
14
+ "type_of_github_repo": "public",
15
+ "version": "1.3.6"
16
+ }
@@ -0,0 +1,2 @@
1
+ lib/bar.scala:1: println('something') // TODO: mix styles
2
+ lib/foo.rb:3: # XXX: need to frob the lub
File without changes
@@ -0,0 +1 @@
1
+ app/foo.rb:4: puts 'foo' # XXX: change to bar
@@ -0,0 +1 @@
1
+ lib/foo.rb:3: # XXX: need to frob the lub
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+ require 'punchlist'
5
+ require 'rspec'
6
+
7
+ # Add the bin directory, to allow testing of gem executables as if the gem is
8
+ # already installed.
9
+ root_dir = RSpec::Core::RubyProject.root
10
+ exec_dir = File.join(File::SEPARATOR, root_dir, 'bin')
11
+ # @sg-ignore
12
+ ENV['PATH'] = [exec_dir, ENV.fetch('PATH')].join(File::PATH_SEPARATOR)
13
+
14
+ # Courtesy of:
15
+ # https://raw.github.com/cupakromer/tao-of-tdd/master/adder/spec/support/
16
+ # capture_exec.rb
17
+
18
+ # @sg-ignore
19
+ # @param cmd [Array<String>]
20
+ # @return [String]
21
+ def exec_io(*cmd)
22
+ cmd = cmd.flatten
23
+ # @sg-ignore
24
+ all_out, _exit_code = Open3.capture2e(*cmd)
25
+
26
+ all_out
27
+ end
28
+
29
+ RSpec.configure do |config|
30
+ config.run_all_when_everything_filtered = true
31
+ config.order = 'random'
32
+ config.alias_it_should_behave_like_to :has_behavior
33
+ config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
34
+ end
35
+
36
+ def let_double(*doubles)
37
+ doubles.each do |double_sym|
38
+ # @sg-ignore
39
+ let(double_sym) { double(double_sym.to_s) }
40
+ end
41
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'punchlist'
5
+ require 'punchlist/offense'
6
+
7
+ # Example use from https://github.com/apiology/pronto-punchlist
8
+
9
+ describe Punchlist do
10
+ subject(:offenses) do
11
+ ::Punchlist::Inspector.new(punchlist_line_regexp, path).run
12
+ end
13
+
14
+ let(:punchlist_line_regexp) do
15
+ Regexp.new(::Punchlist::Config.default_punchlist_line_regexp_string)
16
+ end
17
+ let(:path) { 'feature/samples/mixed_types_of_source_files/lib/bar.scala' }
18
+
19
+ it 'stays compatible with use by pronto-spec' do
20
+ expect(offenses.length).to eq(1)
21
+ offenses.each do |offense|
22
+ expect(offense.filename).to eq(path)
23
+ expect(offense.line_num).to eq(1)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'feature_helper'
4
+ require 'punchlist'
5
+
6
+ describe Punchlist do
7
+ # "pis" are "punchlist items"
8
+
9
+ %w[mixed_types_of_source_files
10
+ one_source_file_with_cis
11
+ no_files
12
+ source_file_with_no_items
13
+ non_source_file_with_pis].each do |type|
14
+ it "handles #{type} case" do
15
+ expect(exec_io("cd feature/samples/#{type} &&" \
16
+ 'RUBYLIB=`pwd`/../../lib:"$RUBYLIB" punchlist'))
17
+ .to eq(IO.read("feature/expected/#{type}_results.txt"))
18
+ end
19
+ end
20
+
21
+ %w[scala_file_to_be_ignored].each do |type|
22
+ it "handles #{type} case with a special glob" do
23
+ expect(exec_io("cd feature/samples/#{type} &&" \
24
+ 'RUBYLIB=`pwd`/../../lib:"$RUBYLIB" ' \
25
+ "punchlist --glob '{app,lib,test,spec,feature}/**/*." \
26
+ "{rb,swift,cpp,c,java,py}'"))
27
+ .to eq(IO.read("feature/expected/#{type}_results.txt"))
28
+ end
29
+ end
30
+
31
+ let(:expected_usage) do
32
+ "Usage: punchlist [options]\n"\
33
+ ' -g, --glob glob here ' \
34
+ 'Which files to parse - default is ' \
35
+ '{Dockerfile,Rakefile,{*,.*}.{c,clj,cljs,cpp,gemspec,groovy,html,java,' \
36
+ 'js,json,py,rake,rb,scala,sh,swift,yml},{app,config,db,feature,lib,spec,' \
37
+ 'src,test,tests,vars,www}/**/{*,.*}.{c,clj,cljs,cpp,gemspec,groovy,html,' \
38
+ 'java,js,json,py,rake,rb,scala,sh,swift,yml}}' \
39
+ "\n" \
40
+ ' -e, --exclude-glob glob here ' \
41
+ "Files to exclude - default is none\n" \
42
+ ' -r, --regexp r ' \
43
+ 'Regexp to trigger upon - default is ' \
44
+ "XXX|TODO|FIXME|OPTIMIZE|HACK|REVIEW|LATER|FIXIT\n"
45
+ end
46
+
47
+ it 'starts up with short help argument' do
48
+ expect(exec_io('punchlist -h'))
49
+ .to eq(expected_usage)
50
+ end
51
+
52
+ it 'starts up with long help argument' do
53
+ expect(exec_io('punchlist --help'))
54
+ .to eq(expected_usage)
55
+ end
56
+
57
+ it 'starts up with invalid argument' do
58
+ expect(exec_io('punchlist --blah'))
59
+ .to match(/invalid option/)
60
+ end
61
+
62
+ xit 'handles passing in different annotation comments'
63
+ end
@@ -0,0 +1 @@
1
+ println('something') // TODO: mix styles
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # XXX: need to frob the lub
4
+ puts 'hi'
File without changes
@@ -0,0 +1,5 @@
1
+ XXX
2
+ TODO
3
+ FUTURE
4
+ FIXIT
5
+ FIX
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ puts 'foo' # XXX: change to bar
@@ -0,0 +1 @@
1
+ println('something') // TODO: mix styles
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # XXX: need to frob the lub
4
+ puts 'hi'
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ puts 'hi'