mumukit-inspection 1.0.0 → 2.0.0

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: 37ba721a6cd491b18b1f0ec7924890f7f6936206
4
- data.tar.gz: b4051e47c4cabbc716b1f6fb3af7114b43ff649e
3
+ metadata.gz: 862d0aaea9f5338ca16507bc3f564870f093ecf4
4
+ data.tar.gz: bb8724791a6303e935aaef57cfa6fe1ba79ee589
5
5
  SHA512:
6
- metadata.gz: 69cd4dc30948d74cc61617a6e395982bbd4e86698b645a45e2552c29bbe3b7e25057095c0fa6b6f792842f23a44b3d6513f190111d226c50807a2cfa0ceee31b
7
- data.tar.gz: 48cb12f074367c4647f01a3a63c29ac42aba9869165f8dd114f950f4de1bbc83838de751a2cb9265e9ef273e6dd94d1e1138c60b8bde1d01e104f6a5d713e490
6
+ metadata.gz: 2c47373f1be4e7b0b4324d0c5e0f9b50a861b9b3e825fcb0422276744fec26a8a40d8b9ef076ace3ad5654019a847fa75b85df289760e6365c875f2d8faa76bd
7
+ data.tar.gz: 5db7fe22cbf62ce8a682de124b213362456e67b79081927863d69396961ad4beb4ac105a0aeeec189cfc718350e06d790ca5c374c15f9f6fb7be33024658e9db
@@ -1,27 +1,108 @@
1
1
  ---
2
2
  en:
3
- expectation_DoesTypeTest: '%{binding} has redundant string comparisons'
4
- expectation_HasArity: '%{binding} %{must} have %{target} parameters'
5
- expectation_HasBinding: '%{binding} %{must} be defined'
6
- expectation_HasComposition: '%{binding} %{must} use composition'
7
- expectation_HasComprehension: '%{binding} %{must} use list comprehensions'
8
- expectation_HasConditional: '%{binding} %{must} use conditionals'
9
- expectation_HasDirectRecursion: '%{binding} %{must} use recursion'
10
- expectation_HasForeach: '%{binding} %{must} use an indexed repetition (<i>foreach</i> statement)'
11
- expectation_HasGuards: '%{binding} %{must} use guards'
12
- expectation_HasIf: '%{binding} %{must} use if'
13
- expectation_HasLambda: '%{binding} %{must} use lambda expressions'
14
- expectation_HasRedundantBooleanComparison: '%{binding} has redundant boolean comparisons'
15
- expectation_HasRedundantGuards: '%{binding} has redundant guards'
16
- expectation_HasRedundantIf: '%{binding} has redundant ifs'
17
- expectation_HasRedundantLambda: '%{binding} has redundant lambdas'
18
- expectation_HasRedundantParameter: '%{binding} has redundant parameters - you may avoid them using point-free'
19
- expectation_HasRepeat: '%{binding} %{must} use a simple repetition (<i>repeat</i> statement)'
20
- expectation_HasRepeatOf: '%{binding} %{must} use a simple repetition (<i>repeat</i> sentence) of %{target}'
21
- expectation_HasTypeDeclaration: type %{binding} %{must} be defined
22
- expectation_HasTypeSignature: Signature for %{binding} %{must} be declared
23
- expectation_HasUsage: '%{binding} %{must} use %{target}'
24
- expectation_HasVariable: '%{binding} %{must} use variables'
25
- expectation_HasWhile: '%{binding} %{must} use conditional repetition (<i>while</i> statement)'
3
+ expectation_Declares: '%{binding} %{must} contain declarations'
4
+ expectation_Declares_except: '%{binding} %{must} contain declarations distinct from %{target}'
5
+ expectation_Declares_like: '%{binding} %{must} declare an identifier similar to %{target}'
6
+ expectation_Declares_named: '%{binding} %{must} declare %{target}'
7
+ expectation_DeclaresAttribute: '%{binding} %{must} declare attributes'
8
+ expectation_DeclaresAttribute_except: '%{binding} %{must} declare attributes distinct from %{target}'
9
+ expectation_DeclaresAttribute_like: '%{binding} %{must} declare an attribute similar to %{target}'
10
+ expectation_DeclaresAttribute_named: '%{binding} %{must} declare an attribute %{target}'
11
+ expectation_DeclaresClass: '%{binding} %{must} declare classes'
12
+ expectation_DeclaresClass_except: '%{binding} %{must} declare classes distinct from %{target}'
13
+ expectation_DeclaresClass_like: '%{binding} %{must} declare a class similar to %{target}'
14
+ expectation_DeclaresClass_named: '%{binding} %{must} declare a class %{target}'
15
+ expectation_DeclaresComputation: '%{binding} %{must} declare computations'
16
+ expectation_DeclaresComputation_except: '%{binding} %{must} declare computations distinct from %{target}'
17
+ expectation_DeclaresComputation_like: '%{binding} %{must} declare a computation similar to %{target}'
18
+ expectation_DeclaresComputation_named: '%{binding} %{must} declare a computation %{target}'
19
+ expectation_DeclaresComputationWithArity0_named: '%{target} %{must} have zero parameters'
20
+ expectation_DeclaresComputationWithArity1_named: '%{target} %{must} have one parameter'
21
+ expectation_DeclaresComputationWithArity2_named: '%{target} %{must} have 2 parameters'
22
+ expectation_DeclaresComputationWithArity3_named: '%{target} %{must} have 3 parameters'
23
+ expectation_DeclaresComputationWithArity4_named: '%{target} %{must} have 4 parameters'
24
+ expectation_DeclaresComputationWithArity5_named: '%{target} %{must} have 5 parameters'
25
+ expectation_DeclaresEntryPoint: '%{binding} %{must} declare an entry point'
26
+ expectation_DeclaresFact: '%{binding} %{must} declare facts'
27
+ expectation_DeclaresFact_except: '%{binding} %{must} declare facts distinct from %{target}'
28
+ expectation_DeclaresFact_like: '%{binding} %{must} declare a fact similar to %{target}'
29
+ expectation_DeclaresFact_named: '%{binding} %{must} declare a fact %{target}'
30
+ expectation_DeclaresFunction: '%{binding} %{must} debe declare functions'
31
+ expectation_DeclaresFunction_except: '%{binding} %{must} declare functions distinct from %{target}'
32
+ expectation_DeclaresFunction_like: '%{binding} %{must} declare a function similar to %{target}'
33
+ expectation_DeclaresFunction_named: '%{binding} %{must} declare a function %{target}'
34
+ expectation_DeclaresMethod: '%{binding} %{must} declare methods'
35
+ expectation_DeclaresMethod_except: '%{binding} %{must} declare methods distinct from %{target}'
36
+ expectation_DeclaresMethod_like: '%{binding} %{must} declare a method similar to %{target}'
37
+ expectation_DeclaresMethod_named: '%{binding} %{must} declare a method %{target}'
38
+ expectation_DeclaresObject: '%{binding} %{must} declare objects'
39
+ expectation_DeclaresObject_except: '%{binding} %{must} declare objects distinct from %{target}'
40
+ expectation_DeclaresObject_like: '%{binding} %{must} declare an object similar to %{target}'
41
+ expectation_DeclaresObject_named: '%{binding} %{must} declare an object %{target}'
42
+ expectation_DeclaresPredicate: '%{binding} %{must} declare predicates'
43
+ expectation_DeclaresPredicate_except: '%{binding} %{must} declare a predicate distinct from %{target}'
44
+ expectation_DeclaresPredicate_like: '%{binding} %{must} declare a predicate similar to %{target}'
45
+ expectation_DeclaresPredicate_named: '%{binding} %{must} declare predicates %{target}'
46
+ expectation_DeclaresProcedure: '%{binding} %{must} declare procedures'
47
+ expectation_DeclaresProcedure_except: '%{binding} %{must} declare procedures distinct from %{target}'
48
+ expectation_DeclaresProcedure_like: '%{binding} %{must} declare a procedure similar to %{target}'
49
+ expectation_DeclaresProcedure_named: '%{binding} %{must} declare a procedure %{target}'
50
+ expectation_DeclaresRecursively_named: '%{target} %{must} declared recursively'
51
+ expectation_DeclaresRule: '%{binding} %{must} debe declare rules'
52
+ expectation_DeclaresRule_except: '%{binding} %{must} declare rules distinct from %{target}'
53
+ expectation_DeclaresRule_like: '%{binding} %{must} declare a rule similar to %{target}'
54
+ expectation_DeclaresRule_named: '%{binding} %{must} declare a rule %{target}'
55
+ expectation_DeclaresTypeAlias: '%{binding} %{must} declare type aliases'
56
+ expectation_DeclaresTypeAlias_except: '%{binding} %{must} declare type aliases distinct from %{target}'
57
+ expectation_DeclaresTypeAlias_like: '%{binding} %{must} declare a type alias similar to %{target}'
58
+ expectation_DeclaresTypeAlias_named: '%{binding} %{must} declare a type alias %{target}'
59
+ expectation_DeclaresTypeSignature: '%{binding} %{must} decarar type signatures'
60
+ expectation_DeclaresTypeSignature_except: '%{binding} %{must} declare a type signature distinct from %{target}'
61
+ expectation_DeclaresTypeSignature_like: '%{binding} %{must} declare a type signature for something like %{target}'
62
+ expectation_DeclaresTypeSignature_named: '%{binding} %{must} declare a type signature %{target}'
63
+ expectation_DeclaresVariable: '%{binding} %{must} debe declare variables'
64
+ expectation_DeclaresVariable_except: '%{binding} %{must} declare variables distinct from %{target}'
65
+ expectation_DeclaresVariable_like: '%{binding} %{must} declare a variable similar to %{target}'
66
+ expectation_DeclaresVariable_named: '%{binding} %{must} declare a variable %{target}'
67
+ expectation_DoesNullTest: '%{binding} does null tests'
68
+ expectation_DoesTypeTest: '%{binding} string type tests'
69
+ expectation_HasAssignmentReturn: '%{binding} returns the result of an assignment'
70
+ expectation_HasCodeDuplication: '%{binding} has code duplication'
71
+ expectation_HasMisspelledBindings: '%{binding} is misspelled'
72
+ expectation_HasRedundantBooleanComparison: '%{binding} makes unnecesary boolean comparisons'
73
+ expectation_HasRedundantGuards: '%{binding} has unnecessary guards'
74
+ expectation_HasRedundantIf: '%{binding} has unnecessary ifs'
75
+ expectation_HasRedundantLambda: '%{binding} has unnecessary lambdas'
76
+ expectation_HasRedundantLocalVariableReturn: '%{binding} has unnecesary local variables; please try returning the expression directly'
77
+ expectation_HasRedundantParameter: '%{binding} has unnecessary parameters, that can be removed using point-free'
78
+ expectation_HasRedundantReduction: '%{binding} uses <i>is</i>, but it does not artihmetic.'
79
+ expectation_HasTooShortBindings: '%{binding} is a too short identifier'
80
+ expectation_HasWrongCaseBindings: '%{binding} does not honor case conventions'
81
+ expectation_IsLongCode: '%{binding} is too long'
26
82
  expectation_must: must
27
83
  expectation_must_not: must not
84
+ expectation_ReturnsNull: '%{binding} retuns null, which is a bad practice'
85
+ expectation_solution: solution
86
+ expectation_Uses: '%{binding} %{must} delegate'
87
+ expectation_Uses_except: '%{binding} %{must} delegate to something distinct from %{target}'
88
+ expectation_Uses_like: '%{binding} %{must} delegate to something similar to %{target}'
89
+ expectation_Uses_named: '%{binding} %{must} use %{target}'
90
+ expectation_UsesAnonymousVariable: '%{binding} %{must} use an annonymous variable'
91
+ expectation_UsesComposition: '%{binding} %{must} use composition'
92
+ expectation_UsesComprehension: '%{binding} %{must} use comprehensions'
93
+ expectation_UsesConditional: '%{binding} %{must} use conditionals'
94
+ expectation_UsesCut: '%{binding} uses <i>!</li> operator, which is a bad practice'
95
+ expectation_UsesFail: '%{binding} uses <i>fail</li>, which is a bad practice'
96
+ expectation_UsesFindall: '%{binding} %{must} use findall'
97
+ expectation_UsesForall: '%{binding} %{must} use forall'
98
+ expectation_UsesForeach: '%{binding} %{must} use foreach'
99
+ expectation_UsesGuards: '%{binding} %{must} use guards'
100
+ expectation_UsesIf: '%{binding} %{must} use if'
101
+ expectation_UsesLambda: '%{binding} %{must} use lambda expressions'
102
+ expectation_UsesNot: '%{binding} %{must} use not'
103
+ expectation_UsesPatternMatching: '%{binding} %{must} use pattern matching'
104
+ expectation_UsesRepeat: '%{binding} %{must} use repeat'
105
+ expectation_UsesRepeatOf: '%{binding} %{must} use repeat'
106
+ expectation_UsesSwitch: '%{binding} %{must} use a switch'
107
+ expectation_UsesUnificationOperator: '%{binding} uses the unification operator (=)'
108
+ expectation_UsesWhile: '%{binding} %{must} use while'
@@ -1,27 +1,108 @@
1
1
  ---
2
2
  es:
3
- expectation_DoesTypeTest: '%{binding} hace comparaciones de strings innecesarias'
4
- expectation_HasArity: '%{binding} %{must} tener %{target} parámetros'
5
- expectation_HasBinding: '%{binding} %{must} estar definido'
6
- expectation_HasComposition: '%{binding} %{must} usar composición'
7
- expectation_HasComprehension: '%{binding} %{must} emplear listas por comprensión'
8
- expectation_HasConditional: '%{binding} %{must} utilizar condicionales (guardas/if)'
9
- expectation_HasDirectRecursion: '%{binding} %{must} emplear recursión'
10
- expectation_HasForeach: '%{binding} %{must} usar una repetición indexada (sentencia <i>foreach</i>)'
11
- expectation_HasGuards: '%{binding} %{must} usar guardas'
12
- expectation_HasIf: '%{binding} %{must} usar if'
13
- expectation_HasLambda: '%{binding} %{must} emplear expresiones lambda'
3
+ expectation_Declares: '%{binding} %{must} contener declaraciones'
4
+ expectation_Declares_except: '%{binding} %{must} contener declaraciones distintas a %{target}'
5
+ expectation_Declares_like: '%{binding} %{must} declarar un identificador parecido a %{target}'
6
+ expectation_Declares_named: '%{binding} %{must} declarar %{target}'
7
+ expectation_DeclaresAttribute: '%{binding} %{must} declarar atributos'
8
+ expectation_DeclaresAttribute_except: '%{binding} %{must} declarar atributos diferentes a %{target}'
9
+ expectation_DeclaresAttribute_like: '%{binding} %{must} declarar un atributo parecido a %{target}'
10
+ expectation_DeclaresAttribute_named: '%{binding} %{must} declarar un atributo %{target}'
11
+ expectation_DeclaresClass: '%{binding} %{must} declarar clases'
12
+ expectation_DeclaresClass_except: '%{binding} %{must} declarar clases diferentes a %{target}'
13
+ expectation_DeclaresClass_like: '%{binding} %{must} declarar una clase parecida a %{target}'
14
+ expectation_DeclaresClass_named: '%{binding} %{must} declarar una clase %{target}'
15
+ expectation_DeclaresComputation: '%{binding} %{must} declarar computaciones'
16
+ expectation_DeclaresComputation_except: '%{binding} %{must} declarar computaciones diferentes a %{target}'
17
+ expectation_DeclaresComputation_like: '%{binding} %{must} declarar una computación parecida a %{target}'
18
+ expectation_DeclaresComputation_named: '%{binding} %{must} declarar una computación %{target}'
19
+ expectation_DeclaresComputationWithArity0_named: '%{target} %{must} declarar cero parametros'
20
+ expectation_DeclaresComputationWithArity1_named: '%{target} %{must} tener un parámetro'
21
+ expectation_DeclaresComputationWithArity2_named: '%{target} %{must} tener dos parámetros'
22
+ expectation_DeclaresComputationWithArity3_named: '%{target} %{must} tener tres parámetros'
23
+ expectation_DeclaresComputationWithArity4_named: '%{target} %{must} tener cuatro parámetros'
24
+ expectation_DeclaresComputationWithArity5_named: '%{target} %{must} tener cinco parámetros'
25
+ expectation_DeclaresEntryPoint: '%{binding} %{must} declarar un punto de entrada'
26
+ expectation_DeclaresFact: '%{binding} %{must} declarar hechos'
27
+ expectation_DeclaresFact_except: '%{binding} %{must} declarar hechos diferentes a %{target}'
28
+ expectation_DeclaresFact_like: '%{binding} %{must} declarar un hecho parecido a %{target}'
29
+ expectation_DeclaresFact_named: '%{binding} %{must} declarar un hecho %{target}'
30
+ expectation_DeclaresFunction: '%{binding} %{must} debe declarar funciones'
31
+ expectation_DeclaresFunction_except: '%{binding} %{must} declarar funciones diferentes a %{target}'
32
+ expectation_DeclaresFunction_like: '%{binding} %{must} declarar una función parecida a %{target}'
33
+ expectation_DeclaresFunction_named: '%{binding} %{must} declarar una función %{target}'
34
+ expectation_DeclaresMethod: '%{binding} %{must} declarar métodos'
35
+ expectation_DeclaresMethod_except: '%{binding} %{must} declarar métodos diferentes a %{target}'
36
+ expectation_DeclaresMethod_like: '%{binding} %{must} declarar un método parecido a %{target}'
37
+ expectation_DeclaresMethod_named: '%{binding} %{must} declarar un método %{target}'
38
+ expectation_DeclaresObject: '%{binding} %{must} declarar objetos'
39
+ expectation_DeclaresObject_except: '%{binding} %{must} declarar objetos diferentes a %{target}'
40
+ expectation_DeclaresObject_like: '%{binding} %{must} declarar un objeto parecido a%{target}'
41
+ expectation_DeclaresObject_named: '%{binding} %{must} declarar un objeto %{target}'
42
+ expectation_DeclaresPredicate: '%{binding} %{must} declarar predicados'
43
+ expectation_DeclaresPredicate_except: '%{binding} %{must} declarar predicados diferentes a %{target}'
44
+ expectation_DeclaresPredicate_like: '%{binding} %{must} declarar un predicados parecido a %{target}'
45
+ expectation_DeclaresPredicate_named: '%{binding} %{must} declarar un predicados %{target}'
46
+ expectation_DeclaresProcedure: '%{binding} %{must} declarar procedimientos'
47
+ expectation_DeclaresProcedure_except: '%{binding} %{must} declarar procedimientos diferentes a %{target}'
48
+ expectation_DeclaresProcedure_like: '%{binding} %{must} declarar un procedimiento parecido a %{target}'
49
+ expectation_DeclaresProcedure_named: '%{binding} %{must} declarar un procedimiento %{target}'
50
+ expectation_DeclaresRecursively_named: '%{target} %{must} estar declarado recursivamente'
51
+ expectation_DeclaresRule: '%{binding} %{must} debe declarar reglas'
52
+ expectation_DeclaresRule_except: '%{binding} %{must} declarar reglas diferentes a %{target}'
53
+ expectation_DeclaresRule_like: '%{binding} %{must} declarar una regla parecida a %{target}'
54
+ expectation_DeclaresRule_named: '%{binding} %{must} declarar una regla %{target}'
55
+ expectation_DeclaresTypeAlias: '%{binding} %{must} declarar sinónimos de tipo'
56
+ expectation_DeclaresTypeAlias_except: '%{binding} %{must} declarar sinónimos de tipo diferentes a %{target}'
57
+ expectation_DeclaresTypeAlias_like: '%{binding} %{must} declarar un sinónimo de tipo parecido a %{target}'
58
+ expectation_DeclaresTypeAlias_named: '%{binding} %{must} declarar un sinónimo de tipo %{target}'
59
+ expectation_DeclaresTypeSignature: '%{binding} %{must} decarar firmas de tipos'
60
+ expectation_DeclaresTypeSignature_except: '%{binding} %{must} declarar firmas de tipos diferentes a %{target}'
61
+ expectation_DeclaresTypeSignature_like: '%{binding} %{must} declarar una firma para algo parecido %{target}'
62
+ expectation_DeclaresTypeSignature_named: '%{binding} %{must} declarar una firma %{target}'
63
+ expectation_DeclaresVariable: '%{binding} %{must} debe declarar variables'
64
+ expectation_DeclaresVariable_except: '%{binding} %{must} declarar variables diferentes a %{target}'
65
+ expectation_DeclaresVariable_like: '%{binding} %{must} declarar una variable parecida a %{target}'
66
+ expectation_DeclaresVariable_named: '%{binding} %{must} declarar una variable %{target}'
67
+ expectation_DoesNullTest: '%{binding} hace comparaciones contra null'
68
+ expectation_DoesTypeTest: '%{binding} hace comparaciones contra strings'
69
+ expectation_HasAssignmentReturn: '%{binding} devuelve el resultado de una asignación'
70
+ expectation_HasCodeDuplication: '%{binding} tiene código repetido'
71
+ expectation_HasMisspelledBindings: '%{binding} está mal escrito'
14
72
  expectation_HasRedundantBooleanComparison: '%{binding} hace comparaciones booleanas innecesarias'
15
73
  expectation_HasRedundantGuards: '%{binding} tiene guardas innecesarias'
16
74
  expectation_HasRedundantIf: '%{binding} tiene ifs innecesarios'
17
75
  expectation_HasRedundantLambda: '%{binding} tiene lambdas innecesarias'
76
+ expectation_HasRedundantLocalVariableReturn: '%{binding} usa variables locales innecesarias; podés retornar directamente la expresión'
18
77
  expectation_HasRedundantParameter: '%{binding} tiene parámetros innecesarios (se pueden eliminar mediante point-free)'
19
- expectation_HasRepeat: '%{binding} %{must} usar una repetición simple (sentencia <i>repeat</i>)'
20
- expectation_HasRepeatOf: '%{binding} %{must} usar una repetición simple (sentencia <i>repeat</i>) de %{target}'
21
- expectation_HasTypeDeclaration: '%{must} existir una declaración para el sinónimo de tipo %{binding}'
22
- expectation_HasTypeSignature: La firma para %{binding} %{must} ser declarada
23
- expectation_HasUsage: '%{binding} %{must} utilizar %{target}'
24
- expectation_HasVariable: '%{binding} %{must} utilizar variables'
25
- expectation_HasWhile: '%{binding} %{must} utilizar repetición condicional (sentencia <i>while</i>)'
78
+ expectation_HasRedundantReduction: '%{binding} usa <i>is</i>, pero no realiza cálculos.'
79
+ expectation_HasTooShortBindings: '%{binding} es un identificador muy corto'
80
+ expectation_HasWrongCaseBindings: '%{binding} no respeta la convención de nombres'
81
+ expectation_IsLongCode: '%{binding} es muy largo. Tratá de delegar más'
26
82
  expectation_must: debe
27
83
  expectation_must_not: no debe
84
+ expectation_ReturnsNull: '%{binding} retorna null, lo cual es una mala práctica'
85
+ expectation_solution: la solución
86
+ expectation_Uses: '%{binding} %{must} delegar'
87
+ expectation_Uses_except: '%{binding} %{must} delegar en algo diferente a %{target}'
88
+ expectation_Uses_like: '%{binding} %{must} delegar en algo parecido a %{target}'
89
+ expectation_Uses_named: '%{binding} %{must} utilizar %{target}'
90
+ expectation_UsesAnonymousVariable: '%{binding} %{must} utilizar una variable anónima'
91
+ expectation_UsesComposition: '%{binding} %{must} usar composición'
92
+ expectation_UsesComprehension: '%{binding} %{must} emplear listas por comprensión'
93
+ expectation_UsesConditional: '%{binding} %{must} utilizar condicionales'
94
+ expectation_UsesCut: '%{binding} usa el operador !, lo cual es una mala práctica'
95
+ expectation_UsesFail: '%{binding} usa <i>fail</li>, lo cual es una mala práctica'
96
+ expectation_UsesFindall: '%{binding} %{must} utilizar findall'
97
+ expectation_UsesForall: '%{binding} %{must} utilizar forall'
98
+ expectation_UsesForeach: '%{binding} %{must} usar una repetición indexada (sentencia <i>foreach</i>)'
99
+ expectation_UsesGuards: '%{binding} %{must} usar guardas'
100
+ expectation_UsesIf: '%{binding} %{must} usar if'
101
+ expectation_UsesLambda: '%{binding} %{must} emplear expresiones lambda'
102
+ expectation_UsesNot: '%{binding} %{must} utilizar not'
103
+ expectation_UsesPatternMatching: '%{binding} %{must} utilizar pattern matching'
104
+ expectation_UsesRepeat: '%{binding} %{must} usar una repetición simple (sentencia <i>repeat</i>)'
105
+ expectation_UsesRepeatOf: '%{binding} %{must} usar una repetición simple (sentencia <i>repeat</i>) de %{target}'
106
+ expectation_UsesSwitch: '%{binding} %{must} utilizar un switch'
107
+ expectation_UsesUnificationOperator: '%{binding} usa el operador de unificación (=)'
108
+ expectation_UsesWhile: '%{binding} %{must} utilizar repetición condicional (sentencia <i>while</i>)'
@@ -5,78 +5,43 @@ I18n.load_translations_path File.join(__dir__, '..', 'locales', '*.yml')
5
5
  require_relative '../mumukit/inspection/version'
6
6
 
7
7
  module Mumukit
8
- module Inspection
9
- def self.parse(s)
10
- not_match = s.match /^Not:(.*)$/
11
- if not_match
12
- NegatedInspection.new(parse_base_inspection(not_match[1]))
13
- else
14
- parse_base_inspection(s)
15
- end
8
+ class Inspection
9
+ attr_accessor :type, :target, :negated
10
+ alias negated? negated
11
+
12
+ def initialize(type, target, negated=false)
13
+ @type = type
14
+ @target = target
15
+ @negated = negated
16
16
  end
17
17
 
18
- private
19
-
20
- def self.parse_base_inspection(s)
21
- target_match = s.match /^(.*):(.*)$/
22
- if target_match
23
- TargetedInspection.new(target_match[1], target_match[2])
24
- else
25
- PlainInspection.new(s)
26
- end
18
+ def to_s
19
+ "#{negated_to_s}#{type}#{target_to_s}"
27
20
  end
28
21
 
29
- class BaseInspection
30
- def to_h
31
- {negated: negated?, type: type, target: target}
32
- end
22
+ def negated_to_s
23
+ negated ? 'Not:' : nil
33
24
  end
34
25
 
35
- class PositiveInspection < BaseInspection
36
- attr_accessor :type
37
-
38
- def negated?
39
- false
40
- end
41
- end
42
-
43
- class PlainInspection < PositiveInspection
44
- def initialize(type)
45
- @type = type
46
- end
47
-
48
- def target
49
- nil
50
- end
26
+ def target_to_s
27
+ target ? ":#{target.to_s}" : nil
51
28
  end
52
29
 
53
- class TargetedInspection < PositiveInspection
54
- attr_accessor :target
55
-
56
- def initialize(type, target)
57
- @type = type
58
- @target = target
30
+ def self.parse_binding_name(binding_s)
31
+ if binding_s.start_with? 'Intransitive:'
32
+ binding_s[13..-1]
33
+ else
34
+ binding_s
59
35
  end
60
36
  end
61
37
 
62
- class NegatedInspection < BaseInspection
63
- def initialize(inspection)
64
- @inspection = inspection
65
- end
66
-
67
- def negated?
68
- true
69
- end
70
-
71
- def target
72
- @inspection.target
73
- end
74
-
75
- def type
76
- @inspection.type
77
- end
38
+ def self.parse(insepection_s)
39
+ raise "Invalid inspection #{insepection_s}" unless insepection_s =~ /^(Not\:)?([^\:]+)\:?(.+)?$/
40
+ Inspection.new($2, Mumukit::Inspection::Target.parse($3), $1.present?)
78
41
  end
79
42
  end
80
43
  end
81
44
 
45
+ require_relative '../mumukit/inspection/target'
46
+ require_relative '../mumukit/inspection/expectation'
82
47
  require_relative '../mumukit/inspection/i18n'
@@ -0,0 +1,93 @@
1
+ class Mumukit::Inspection::Expectation
2
+ attr_accessor :binding, :inspection
3
+
4
+ def initialize(binding, inspection)
5
+ @binding = binding
6
+ @inspection = inspection
7
+ end
8
+
9
+ def check!
10
+ raise "Wrong binding #{binding}" unless binding?
11
+ raise "Wrong inspection #{inspection}" unless inspection?
12
+ end
13
+
14
+ def translate
15
+ Mumukit::Inspection::I18n.translate self
16
+ end
17
+
18
+ def to_h
19
+ {binding: binding, inspection: inspection.to_s}
20
+ end
21
+
22
+ def self.guess_type(expectation)
23
+ if expectation[:inspection] =~ /(Not\:)?Has.*/
24
+ V0
25
+ else
26
+ V2
27
+ end
28
+ end
29
+
30
+ def self.parse(expectation)
31
+ guess_type(expectation).new(
32
+ expectation[:binding],
33
+ Mumukit::Inspection.parse(expectation[:inspection])).tap &:check!
34
+ end
35
+
36
+ class V0 < Mumukit::Inspection::Expectation
37
+ INSPECTIONS = %w(HasBinding HasTypeDeclaration HasTypeSignature HasVariable HasArity HasDirectRecursion
38
+ HasComposition HasComprehension HasForeach HasIf HasGuards HasConditional HasLambda HasRepeat HasWhile
39
+ HasUsage)
40
+
41
+
42
+ def binding?
43
+ binding.present?
44
+ end
45
+
46
+ def inspection?
47
+ inspection.present? && INSPECTIONS.include?(inspection.type)
48
+ end
49
+
50
+ def as_v2
51
+ if has? 'Binding' then as_v2_declare ''
52
+ elsif has? 'TypeDeclaration' then as_v2_declare 'TypeAlias'
53
+ elsif has? 'TypeSignature' then as_v2_declare 'TypeSignature'
54
+ elsif has? 'Variable' then as_v2_declare 'Variable'
55
+ elsif has? 'Arity' then as_v2_declare "ComputationWithArity#{inspection.target.value}"
56
+ elsif has? 'DirectRecursion' then as_v2_declare "Recursively"
57
+ elsif has? 'Usage'
58
+ V2.new binding, new_inspection('Uses', Mumukit::Inspection::Target.named(inspection.target.value))
59
+ else as_v2_use
60
+ end
61
+ end
62
+
63
+ def has?(simple_type)
64
+ inspection.type == "Has#{simple_type}"
65
+ end
66
+
67
+ def as_v2_use
68
+ V2.new binding, new_inspection(inspection.type.gsub('Has', 'Uses'), Mumukit::Inspection::Target.anyone)
69
+ end
70
+
71
+ def as_v2_declare(simple_type)
72
+ V2.new '', new_inspection("Declares#{simple_type}", Mumukit::Inspection::Target.named(binding))
73
+ end
74
+
75
+ def new_inspection(type, target)
76
+ Mumukit::Inspection.new(type, target, inspection.negated?)
77
+ end
78
+ end
79
+
80
+ class V2 < Mumukit::Inspection::Expectation
81
+ def binding?
82
+ true
83
+ end
84
+
85
+ def inspection?
86
+ true
87
+ end
88
+
89
+ def as_v2
90
+ self
91
+ end
92
+ end
93
+ end
@@ -1,38 +1,34 @@
1
- module Mumukit::Inspection
2
-
3
- class Mumukit::Inspection::NegatedInspection
4
- def must
5
- 'must_not'
1
+ module Mumukit::Inspection::I18n
2
+ class << self
3
+ def translate(e)
4
+ e = e.as_v2
5
+ key = key_for e.binding, e.inspection
6
+ ::I18n.t key,
7
+ binding: t_binding(e.binding),
8
+ target: t_target(e.inspection),
9
+ must: t_must(e.inspection)
10
+ rescue
11
+ '<unknown expectation>'
6
12
  end
7
- end
8
13
 
9
- class Mumukit::Inspection::PositiveInspection
10
- def must
11
- 'must'
12
- end
13
- end
14
+ alias t translate
14
15
 
15
- module I18n
16
- class << self
17
- def translate(expectation)
18
- binding = expectation[:binding]
19
- inspection = Mumukit::Inspection.parse expectation[:inspection]
16
+ private
20
17
 
21
- ::I18n.t "expectation_#{inspection.type}",
22
- binding: "<strong>#{binding}</strong>",
23
- target: "<strong>#{inspection.target}</strong>",
24
- must: t_must(inspection)
25
- rescue
26
- '<unknown expectation>'
27
- end
18
+ def key_for(binding, inspection)
19
+ "expectation_#{inspection.type}#{inspection.target ? inspection.target.i18n_suffix : nil }"
20
+ end
28
21
 
29
- alias t translate
22
+ def t_binding(binding)
23
+ binding.present? ? "<strong>#{Mumukit::Inspection.parse_binding_name binding}</strong>" : ::I18n.t("expectation_solution")
24
+ end
30
25
 
31
- private
26
+ def t_must(parsed)
27
+ ::I18n.t("expectation_#{parsed.negated? ? 'must_not' : 'must' }")
28
+ end
32
29
 
33
- def t_must(parsed)
34
- ::I18n.t("expectation_#{parsed.must}")
35
- end
30
+ def t_target(parsed)
31
+ "<strong>#{parsed.target.value}</strong>" if parsed.target
36
32
  end
37
33
  end
38
- end
34
+ end
@@ -0,0 +1,68 @@
1
+ class Mumukit::Inspection::Target
2
+ attr_accessor :type, :value
3
+
4
+ def initialize(type, value=nil)
5
+ @type = type
6
+ @value = value
7
+ end
8
+
9
+ def self.parse(target_s)
10
+ if target_s.blank?
11
+ nil
12
+ elsif target_s == '*'
13
+ anyone
14
+ elsif target_s.start_with? '^'
15
+ new :except, target_tail(target_s)
16
+ elsif target_s.start_with? '~'
17
+ new :like, target_tail(target_s)
18
+ elsif target_s.start_with? '='
19
+ named target_tail(target_s)
20
+ else
21
+ unknown target_s
22
+ end
23
+ end
24
+
25
+ def to_s
26
+ case type
27
+ when :anyone
28
+ '*'
29
+ when :except
30
+ "^#{value}"
31
+ when :like
32
+ "~#{value}"
33
+ when :named
34
+ "=#{value}"
35
+ else
36
+ value
37
+ end
38
+ end
39
+
40
+ def i18n_suffix
41
+ case type
42
+ when :anyone
43
+ nil
44
+ when :except
45
+ "_except"
46
+ when :like
47
+ "_like"
48
+ else
49
+ "_named"
50
+ end
51
+ end
52
+
53
+ def self.target_tail(target_s)
54
+ target_s[1..-1]
55
+ end
56
+
57
+ def self.unknown(value)
58
+ new(:unknown, value)
59
+ end
60
+
61
+ def self.named(value)
62
+ new(:named, value)
63
+ end
64
+
65
+ def self.anyone
66
+ new(:anyone)
67
+ end
68
+ end
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
- module Inspection
3
- VERSION = '1.0.0'
2
+ class Inspection
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-inspection
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
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-04-28 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '1.0'
22
+ version: '2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '0.1'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '1.0'
32
+ version: '2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -90,7 +96,9 @@ files:
90
96
  - lib/locales/en.yml
91
97
  - lib/locales/es.yml
92
98
  - lib/mumukit/inspection.rb
99
+ - lib/mumukit/inspection/expectation.rb
93
100
  - lib/mumukit/inspection/i18n.rb
101
+ - lib/mumukit/inspection/target.rb
94
102
  - lib/mumukit/inspection/version.rb
95
103
  homepage: ''
96
104
  licenses: