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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +108 -39
- data/bin/pippi +2 -2
- data/doc/docs.md +38 -20
- data/lib/pippi.rb +2 -1
- data/lib/pippi/auto_runner.rb +3 -7
- data/lib/pippi/check_loader.rb +2 -5
- data/lib/pippi/check_set_mapper.rb +2 -3
- data/lib/pippi/checks/assert_with_nil.rb +5 -6
- data/lib/pippi/checks/check.rb +10 -8
- data/lib/pippi/checks/debug_check.rb +1 -4
- data/lib/pippi/checks/map_followed_by_flatten.rb +7 -9
- data/lib/pippi/checks/reverse_followed_by_each.rb +6 -8
- data/lib/pippi/checks/select_followed_by_empty.rb +55 -0
- data/lib/pippi/checks/select_followed_by_first.rb +7 -9
- data/lib/pippi/checks/select_followed_by_size.rb +6 -12
- data/lib/pippi/context.rb +3 -7
- data/lib/pippi/exec_runner.rb +12 -7
- data/lib/pippi/problem.rb +0 -1
- data/lib/pippi/report.rb +2 -6
- data/lib/pippi/tasks.rb +11 -13
- data/lib/pippi/version.rb +2 -2
- metadata +4 -37
- data/.gitignore +0 -6
- data/.ruby-version +0 -1
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -24
- data/Rakefile +0 -11
- data/pippi.gemspec +0 -23
- data/sample/map_followed_by_flatten.rb +0 -6
- data/test/check_test.rb +0 -41
- data/test/rails_core_extensions.rb +0 -13
- data/test/test_helper.rb +0 -7
- data/test/unit/assert_with_nil_test.rb +0 -50
- data/test/unit/check_set_mapper_test.rb +0 -17
- data/test/unit/map_followed_by_flatten_test.rb +0 -38
- data/test/unit/problem_test.rb +0 -23
- data/test/unit/report_test.rb +0 -25
- data/test/unit/reverse_followed_by_each_test.rb +0 -29
- data/test/unit/select_followed_by_first_test.rb +0 -33
- data/test/unit/select_followed_by_size_test.rb +0 -47
- data/vendor/cache/byebug-2.7.0.gem +0 -0
- data/vendor/cache/columnize-0.8.9.gem +0 -0
- data/vendor/cache/debugger-linecache-1.2.0.gem +0 -0
- data/vendor/cache/minitest-5.4.2.gem +0 -0
- 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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|