mumukit-inspection 3.0.0 → 3.0.1
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/lib/mumukit/inspection/expectation.rb +13 -3
- data/lib/mumukit/inspection/version.rb +1 -1
- 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: 16b85e325229fb42120ae5e775e911c6b91dd905
|
|
4
|
+
data.tar.gz: 816a8a4a0eeeec7bbb559dad89bbc760c20b1625
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 00c21772792f17bd89c3cc3686f0f04021688d9b394b42d5fc1a394f1b40d41c739956d7ebb0f5322a7b5b92878eccdfaf02e65abae040153c9d9418bb42e2da
|
|
7
|
+
data.tar.gz: fcc93162cc048e4ab76a75a93aec934c31e8ed536f799af8e521101e2d2db0aeca6d200ed67a6f5df0b7916d91dbcf91f2955a9c666bfed96cd9eb96c37867ae
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
class Mumukit::Inspection::Expectation
|
|
2
|
+
|
|
3
|
+
SMELLS = %w(HasAssignmentReturn HasCodeDuplication HasMisspelledIdentifiers
|
|
4
|
+
HasRedundantBooleanComparison HasRedundantGuards HasRedundantIf
|
|
5
|
+
HasRedundantLambda HasRedundantLocalVariableReturn HasRedundantParameter
|
|
6
|
+
HasRedundantReduction HasTooShortIdentifiers HasWrongCaseIdentifiers)
|
|
7
|
+
|
|
2
8
|
attr_accessor :binding, :inspection
|
|
3
9
|
|
|
4
10
|
def initialize(binding, inspection)
|
|
@@ -20,23 +26,27 @@ class Mumukit::Inspection::Expectation
|
|
|
20
26
|
end
|
|
21
27
|
|
|
22
28
|
def self.guess_type(expectation)
|
|
23
|
-
if expectation[:inspection] =~ /(Not\:)?Has.*/
|
|
29
|
+
if expectation[:inspection] =~ /(Not\:)?Has.*/ && !has_smell?(expectation[:inspection])
|
|
24
30
|
V0
|
|
25
31
|
else
|
|
26
32
|
V2
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
|
|
36
|
+
def self.has_smell?(smell)
|
|
37
|
+
SMELLS.include? smell
|
|
38
|
+
end
|
|
39
|
+
|
|
30
40
|
def self.parse(expectation)
|
|
31
41
|
guess_type(expectation).new(
|
|
32
42
|
expectation[:binding],
|
|
33
|
-
Mumukit::Inspection.parse(expectation[:inspection]))
|
|
43
|
+
Mumukit::Inspection.parse(expectation[:inspection]))
|
|
34
44
|
end
|
|
35
45
|
|
|
36
46
|
class V0 < Mumukit::Inspection::Expectation
|
|
37
47
|
INSPECTIONS = %w(HasBinding HasTypeDeclaration HasTypeSignature HasVariable HasArity HasDirectRecursion
|
|
38
48
|
HasComposition HasComprehension HasForeach HasIf HasGuards HasConditional HasLambda HasRepeat HasWhile
|
|
39
|
-
HasUsage)
|
|
49
|
+
HasUsage HasAnonymousVariable HasNot HasForall HasFindall)
|
|
40
50
|
|
|
41
51
|
|
|
42
52
|
def binding?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mumukit-inspection
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Franco Leonardo Bulgarelli
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-08-
|
|
11
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mumukit-core
|