pippi 0.0.4 → 0.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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/README.md +108 -39
  4. data/bin/pippi +2 -2
  5. data/doc/docs.md +38 -20
  6. data/lib/pippi.rb +2 -1
  7. data/lib/pippi/auto_runner.rb +3 -7
  8. data/lib/pippi/check_loader.rb +2 -5
  9. data/lib/pippi/check_set_mapper.rb +2 -3
  10. data/lib/pippi/checks/assert_with_nil.rb +5 -6
  11. data/lib/pippi/checks/check.rb +10 -8
  12. data/lib/pippi/checks/debug_check.rb +1 -4
  13. data/lib/pippi/checks/map_followed_by_flatten.rb +7 -9
  14. data/lib/pippi/checks/reverse_followed_by_each.rb +6 -8
  15. data/lib/pippi/checks/select_followed_by_empty.rb +55 -0
  16. data/lib/pippi/checks/select_followed_by_first.rb +7 -9
  17. data/lib/pippi/checks/select_followed_by_size.rb +6 -12
  18. data/lib/pippi/context.rb +3 -7
  19. data/lib/pippi/exec_runner.rb +12 -7
  20. data/lib/pippi/problem.rb +0 -1
  21. data/lib/pippi/report.rb +2 -6
  22. data/lib/pippi/tasks.rb +11 -13
  23. data/lib/pippi/version.rb +2 -2
  24. metadata +4 -37
  25. data/.gitignore +0 -6
  26. data/.ruby-version +0 -1
  27. data/Gemfile +0 -3
  28. data/Gemfile.lock +0 -24
  29. data/Rakefile +0 -11
  30. data/pippi.gemspec +0 -23
  31. data/sample/map_followed_by_flatten.rb +0 -6
  32. data/test/check_test.rb +0 -41
  33. data/test/rails_core_extensions.rb +0 -13
  34. data/test/test_helper.rb +0 -7
  35. data/test/unit/assert_with_nil_test.rb +0 -50
  36. data/test/unit/check_set_mapper_test.rb +0 -17
  37. data/test/unit/map_followed_by_flatten_test.rb +0 -38
  38. data/test/unit/problem_test.rb +0 -23
  39. data/test/unit/report_test.rb +0 -25
  40. data/test/unit/reverse_followed_by_each_test.rb +0 -29
  41. data/test/unit/select_followed_by_first_test.rb +0 -33
  42. data/test/unit/select_followed_by_size_test.rb +0 -47
  43. data/vendor/cache/byebug-2.7.0.gem +0 -0
  44. data/vendor/cache/columnize-0.8.9.gem +0 -0
  45. data/vendor/cache/debugger-linecache-1.2.0.gem +0 -0
  46. data/vendor/cache/minitest-5.4.2.gem +0 -0
  47. data/vendor/cache/rake-10.1.0.gem +0 -0
@@ -1,33 +0,0 @@
1
- require "test_helper"
2
-
3
- class SelectFollowedByFirstTest < CheckTest
4
-
5
- def test_canonical_case_is_found
6
- assert_problems "[1,2,3].select {|x| x > 1 }.first"
7
- end
8
-
9
- def test_requires_first_call_be_to_select
10
- assert_no_problems "[1,2,3].map {|x| x > 1 }.first"
11
- end
12
-
13
- def test_requires_last_call_be_to_first
14
- assert_no_problems "[1,2,3].select {|x| x > 1 }.sort"
15
- end
16
-
17
- def test_works_across_statements
18
- assert_problems "tmp = [1,2,3].select {|x| x > 1 } ; tmp.first"
19
- end
20
-
21
- def test_will_not_flag_if_theres_an_intervening_method
22
- assert_no_problems "[1,2,3].select {|x| x > 1 }.map {|x| x+1 }.first"
23
- end
24
-
25
- def test_will_not_flag_if_other_method_invoked_on_select_result
26
- assert_no_problems "tmp = [1,2,3].select {|x| x > 1 } ; tmp.reject! {|x| x } ; tmp.first"
27
- end
28
-
29
- def test_will_not_flag_if_arg_passed
30
- assert_no_problems "[1,2,3].select {|x| x > 1 }.first(1)"
31
- end
32
-
33
- end
@@ -1,47 +0,0 @@
1
- require "test_helper"
2
-
3
- class SelectFollowedBySizeTest < CheckTest
4
-
5
- def test_canonical_case_is_found
6
- assert_problems "[1,2,3].select {|x| x > 1 }.size"
7
- end
8
-
9
- def test_requires_first_call_be_to_select
10
- assert_no_problems "[1,2,3].map {|x| x > 1 }.size"
11
- end
12
-
13
- def test_requires_last_call_be_to_size
14
- assert_no_problems "[1,2,3].select {|x| x > 1 }.sort"
15
- end
16
-
17
- def test_works_across_statements
18
- assert_problems "tmp = [1,2,3].select {|x| x > 1 } ; tmp.size"
19
- end
20
-
21
- def test_will_not_flag_if_theres_an_intervening_method
22
- assert_no_problems "[1,2,3].select {|x| x > 1 }.map {|x| x+1 }.size"
23
- end
24
-
25
- def test_will_not_flag_if_other_method_invoked_on_select_result
26
- assert_no_problems "tmp = [1,2,3].select {|x| x > 1 } ; tmp.reject! {|x| x } ; tmp.size"
27
- end
28
-
29
- def test_will_not_flag_if_method_subsequently_invoked
30
- assert_no_problems "tmp = [1,2,3].select {|x| x > 1 } ; tmp.size ; y = tmp.sort!"
31
- end
32
-
33
- def test_clear_fault_proc_should_not_cause_errors_by_failing_to_return_result_of_method_invocations
34
- str = <<-EOS
35
- tmp = [1,2,3].select {|x| x > 4 }
36
- tmp.size
37
- tmp = tmp.reject{|l| l.nil? }
38
- tmp.map {|x| 1 }
39
- EOS
40
- assert_problems str
41
- end
42
-
43
- def test_clear_fault_proc_doesnt_try_to_remove_singleton_method_twice
44
- assert_no_problems "tmp = [1,2,3].select {|x| x > 1 } ; y = tmp.sort! ; y = tmp.sort!"
45
- end
46
-
47
- end
Binary file