pippi 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +17 -0
- data/lib/pippi/check_set_mapper.rb +1 -1
- data/lib/pippi/version.rb +1 -1
- data/test/unit/assert_with_nil_test.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f1712f4957c4dc681c64b2031b42668a1965c26
|
4
|
+
data.tar.gz: 2e7795a1a90750cb9838dcfa37e6a83a5ea9d5d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8c0198da71b5bc8ae6ce92d432374c74f97249394bfbe75c13862137d47d5864f0c8f7b43ed66084756a4677ac73f0c7dcd660df343455690330eeb5a52b5c1
|
7
|
+
data.tar.gz: 399fd31a5f4cb6938f2368b586902cfe7ded570ec00975d13c76eacdf90f2400a19c5f1d9afabc1efec1f6c1aa49b798a0cfa94bb874b2ded25d6e044325ab69
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,23 @@ Pippi is a utility for finding suboptimal Ruby class API usage.
|
|
2
2
|
|
3
3
|
<a href="http://thomasleecopeland.com/2014/10/22/finding-suboptimal-api-usage.html">Here's a project overview</a>.
|
4
4
|
|
5
|
+
## Checksets
|
6
|
+
|
7
|
+
Pippi has the concept of "checksets" which are, well, sets of checks. The current checksets are listed below.
|
8
|
+
|
9
|
+
Maybe we should have a dedicated "test" checkset? Let me know what you think at https://twitter.com/tcopeland, thanks!
|
10
|
+
|
11
|
+
### Basic
|
12
|
+
|
13
|
+
* SelectFollowedByFirst
|
14
|
+
* SelectFollowedBySize
|
15
|
+
* ReverseFollowedByEach
|
16
|
+
|
17
|
+
### Buggy
|
18
|
+
|
19
|
+
* AssertWithNil
|
20
|
+
* MapFollowedByFlatten
|
21
|
+
|
5
22
|
## Checks
|
6
23
|
|
7
24
|
### AssertWithNil
|
data/lib/pippi/version.rb
CHANGED
@@ -10,6 +10,26 @@ class AssertWithNilTest < CheckTest
|
|
10
10
|
assert_no_problems "x = 42 ; assert_equal(42, x)", :include_rails_core_extensions => true, :subclass => "ActiveSupport::TestCase"
|
11
11
|
end
|
12
12
|
|
13
|
+
# Seems like there's some way to do this, but maybe not... anyhow, moving this rule to "buggy" for now
|
14
|
+
# pippi> $ echo "foo(nil)" | ruby --dump insns
|
15
|
+
# == disasm: <RubyVM::InstructionSequence:<main>@->=======================
|
16
|
+
# 0000 trace 1 ( 1)
|
17
|
+
# 0002 putself
|
18
|
+
# 0003 putnil
|
19
|
+
# 0004 opt_send_simple <callinfo!mid:foo, argc:1, FCALL|ARGS_SKIP>
|
20
|
+
# 0006 leave
|
21
|
+
# pippi> $ echo "foo(x)" | ruby --dump insns
|
22
|
+
# == disasm: <RubyVM::InstructionSequence:<main>@->=======================
|
23
|
+
# 0000 trace 1 ( 1)
|
24
|
+
# 0002 putself
|
25
|
+
# 0003 putself
|
26
|
+
# 0004 opt_send_simple <callinfo!mid:x, argc:0, FCALL|VCALL|ARGS_SKIP>
|
27
|
+
# 0006 opt_send_simple <callinfo!mid:foo, argc:1, FCALL|ARGS_SKIP>
|
28
|
+
# 0008 leave
|
29
|
+
def test_nil_reference_first_arg_doesnt_flag
|
30
|
+
assert_no_problems "x = 42 ; y = nil ; assert_equal(nil, x)", :include_rails_core_extensions => true, :subclass => "ActiveSupport::TestCase"
|
31
|
+
end
|
32
|
+
|
13
33
|
def test_three_arg_is_flagged
|
14
34
|
assert_problems "x = 42 ; assert_equal(nil, x, 'whatevs')", :include_rails_core_extensions => true, :subclass => "ActiveSupport::TestCase"
|
15
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pippi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Copeland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|