mumukit-inspection 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c632bc77c35c934230567976f4245f064863ebbf
4
- data.tar.gz: 1e0b8b17ccd0570c901b690a307a9b150022e52c
3
+ metadata.gz: 16b85e325229fb42120ae5e775e911c6b91dd905
4
+ data.tar.gz: 816a8a4a0eeeec7bbb559dad89bbc760c20b1625
5
5
  SHA512:
6
- metadata.gz: 76c04bcbe208ea5ab4a149e44936a64b0fd8e4d143afab62f400f6c580562894781601c103895355b974c8dcac6d30f43978866bbc6ef27499bdbf751c7a245a
7
- data.tar.gz: c0cb600d925edc37272a0431489f7d765a1d9b3be61f9fa377301fa963c8718a8e67ea92569b38a10a2cfaf80cbeeb95b90bbc8412e1a0af0938e3b2367e5c0c
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])).tap &:check!
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?
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  class Inspection
3
- VERSION = '3.0.0'
3
+ VERSION = '3.0.1'
4
4
  end
5
5
  end
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.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-14 00:00:00.000000000 Z
11
+ date: 2017-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit-core