mulang 5.2.0 → 5.3.0
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/bin/mulang +0 -0
- data/lib/locales/en.yml +53 -24
- data/lib/locales/es.yml +52 -23
- data/lib/locales/pt.yml +52 -23
- data/lib/mulang/expectation.rb +40 -9
- data/lib/mulang/expectation/i18n.rb +52 -28
- data/lib/mulang/expectation/standard.rb +5 -5
- data/lib/mulang/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c4b91159deb396c27d53a9a9a1399599fb27ed62a8dd8c066520db026b70dba
|
4
|
+
data.tar.gz: 55197a5e6936e8dece7b4698d49be7458a5bf7794b2f0148bedc7dd043400362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d043f51ed7c3faa12973648c44fd10f804270eaef97e8bdd457817bab25370ca17e7a9fab4cea57832f581b5181dbe59b4f72fb6a2772cd14581f3cc0236ffd
|
7
|
+
data.tar.gz: 5bfbb6977a62ab53824703e854ed0022fbcdee91e7ffb8e588d805dd3ab328b62ab63b3fa0169463c988277a4d8d9fde23bb9c7a203c9b11169a69fc6804ad95
|
data/bin/mulang
CHANGED
Binary file
|
data/lib/locales/en.yml
CHANGED
@@ -6,7 +6,7 @@ en:
|
|
6
6
|
must: must
|
7
7
|
solution: solution
|
8
8
|
with_char: ' with character <i>%{value}</i>'
|
9
|
-
with_false: ' with value <i>%{
|
9
|
+
with_false: ' with value <i>%{keyword_False}</i>'
|
10
10
|
with_literal: ' with a literal value'
|
11
11
|
with_logic: ' with a boolean expression'
|
12
12
|
with_math: ' with a math expression'
|
@@ -15,7 +15,7 @@ en:
|
|
15
15
|
with_number: ' with number <i>%{value}</i>'
|
16
16
|
with_string: ' with string <i>%{value}</i>'
|
17
17
|
with_symbol: ' with symbol <i>%{value}</i>'
|
18
|
-
with_true: ' with value <i>%{
|
18
|
+
with_true: ' with value <i>%{keyword_True}</i>'
|
19
19
|
inspection:
|
20
20
|
Assigns_except: '%{binding} %{must} assign something distinct from %{target}%{matching}'
|
21
21
|
Assigns_like: '%{binding} %{must} assign something similar to %{target}%{matching}'
|
@@ -47,7 +47,7 @@ en:
|
|
47
47
|
DeclaresComputationWithArity3_named: '%{target} %{must} have 3 parameters'
|
48
48
|
DeclaresComputationWithArity4_named: '%{target} %{must} have 4 parameters'
|
49
49
|
DeclaresComputationWithArity5_named: '%{target} %{must} have 5 parameters'
|
50
|
-
DeclaresEntryPoint: '%{binding} %{must} declare
|
50
|
+
DeclaresEntryPoint: '%{binding} %{must} declare a <i>%{keyword_EntryPoint}</i>%{matching}'
|
51
51
|
DeclaresEnumeration_except: '%{binding} %{must} declare enumerations distinct from %{target}'
|
52
52
|
DeclaresEnumeration_like: '%{binding} %{must} declare an enumeration like %{target}'
|
53
53
|
DeclaresEnumeration_named: '%{binding} %{must} declare an enumeration %{target}'
|
@@ -97,30 +97,34 @@ en:
|
|
97
97
|
DeclaresVariable_like: '%{binding} %{must} declare a variable similar to %{target}%{matching}'
|
98
98
|
DeclaresVariable_named: '%{binding} %{must} declare a variable %{target}%{matching}'
|
99
99
|
DeclaresVariable: '%{binding} %{must} debe declare variables%{matching}'
|
100
|
+
Delegates: '%{binding} %{must} delegate'
|
100
101
|
DiscardsExceptions: '%{binding} is ignoring exceptions silently'
|
101
102
|
DoesConsolePrint: '%{binding} is printing to the console'
|
102
|
-
DoesNilTest: '%{binding} does <i>%{
|
103
|
-
DoesNullTest: '%{binding} does <i>%{
|
103
|
+
DoesNilTest: '%{binding} does <i>%{keyword_Null}</i> tests'
|
104
|
+
DoesNullTest: '%{binding} does <i>%{keyword_Null}</i> tests'
|
104
105
|
DoesTypeTest: '%{binding} string type tests'
|
105
|
-
|
106
|
+
HasAssignmentCondition: '%{binding} evaluates the result of an assignment where a boolean expression is expected. Perhaps you meant to use the <i>%{operator_Equal}</i> operator?'
|
107
|
+
HasAssignmentReturn: '%{binding} returns the result of an assignment. Perhaps you meant to use the <i>%{operator_Equal}</i> operator?'
|
106
108
|
HasCodeDuplication: '%{binding} has code duplication'
|
107
|
-
|
108
|
-
|
109
|
+
HasDeclarationTypos_named: 'Solution must declare %{target}, but declares %{binding}. Perhaps you meant %{target}?'
|
110
|
+
HasEmptyIfBranches: '%{binding} has empty <i>%{keyword_If}</i> branches'
|
111
|
+
HasEmptyRepeat: '%{binding} has empty <i>%{keyword_Repeat}</i>'
|
109
112
|
HasLongParameterList: '%{binding} has too many parameters. You may be missing an abstraction.'
|
110
113
|
HasMisspelledBindings: '%{binding} is misspelled'
|
111
114
|
HasMisspelledIdentifiers: '%{binding} is misspelled'
|
112
115
|
HasRedundantBooleanComparison: '%{binding} makes unnecesary boolean comparisons'
|
113
116
|
HasRedundantGuards: '%{binding} has unnecessary guards'
|
114
|
-
HasRedundantIf: '%{binding} has unnecessary <i>%{
|
117
|
+
HasRedundantIf: '%{binding} has unnecessary <i>%{keyword_If}</i>s'
|
115
118
|
HasRedundantLambda: '%{binding} has unnecessary lambdas'
|
116
119
|
HasRedundantLocalVariableReturn: '%{binding} has unnecesary local variables; please try returning the expression directly'
|
117
120
|
HasRedundantParameter: '%{binding} has unnecessary parameters, that can be removed using point-free'
|
118
|
-
HasRedundantReduction: '%{binding} uses <i>%{
|
119
|
-
HasRedundantRepeat: '%{binding} has an unnecesary <i>%{
|
121
|
+
HasRedundantReduction: '%{binding} uses <i>%{keyword_Is}</i>, but it does not artihmetic'
|
122
|
+
HasRedundantRepeat: '%{binding} has an unnecesary <i>%{keyword_Repeat}</i>'
|
120
123
|
HasTooManyMethods: '%{binding} has too many methods'
|
121
124
|
HasTooShortBindings: '%{binding} is a too short identifier'
|
122
125
|
HasTooShortIdentifiers: '%{binding} is a too short identifier'
|
123
126
|
HasUnreachableCode: '%{binding} has unreachable code'
|
127
|
+
HasUsageTypos_named: 'Solution must use %{target}, but it uses %{binding}. Perhaps you meant %{target}?'
|
124
128
|
HasWrongCaseBindings: '%{binding} does not honor case conventions'
|
125
129
|
HasWrongCaseIdentifiers: '%{binding} does not honor case conventions'
|
126
130
|
Implements_except: '%{binding} %{must} implement interfaces distinct from %{target}'
|
@@ -142,9 +146,11 @@ en:
|
|
142
146
|
Raises_named: '%{binding} %{must} throw %{target}'
|
143
147
|
Raises: '%{binding} %{must} throw exceptions'
|
144
148
|
Returns: '%{binding} %{must} return%{matching}'
|
145
|
-
ReturnsNil: '%{binding} retuns <i>%{
|
146
|
-
ReturnsNull: '%{binding} retuns <i>%{
|
147
|
-
ShouldInvertIfCondition: '%{binding} should invert <i>%{
|
149
|
+
ReturnsNil: '%{binding} retuns <i>%{keyword_Null}</i>, which is a bad practice'
|
150
|
+
ReturnsNull: '%{binding} retuns <i>%{keyword_Null}</i>, which is a bad practice'
|
151
|
+
ShouldInvertIfCondition: '%{binding} should invert <i>%{keyword_If}</i> condition and swap branches'
|
152
|
+
SubordinatesDeclarationsTo: 'All declarations in %{binding} %{must} be used from %{target}'
|
153
|
+
SubordinatesDeclarationsToEntryPoint: 'All declarations in %{binding} %{must} be used from <i>%{keyword_EntryPoint}</i> '
|
148
154
|
TypesAs_named: '%{binding} %{must} type as %{target}'
|
149
155
|
TypesAs: '%{binding} %{must} type'
|
150
156
|
TypesParameterAs_except: '%{binding} %{must} type parameters with a type distinct from %{target}'
|
@@ -157,33 +163,56 @@ en:
|
|
157
163
|
Uses_like: '%{binding} %{must} delegate to something similar to %{target}'
|
158
164
|
Uses_named: '%{binding} %{must} use %{target}'
|
159
165
|
Uses: '%{binding} %{must} delegate'
|
166
|
+
UsesAnd: '%{binding} %{must} use <i>%{operator_And}</i>'
|
160
167
|
UsesAnonymousVariable: '%{binding} %{must} use an annonymous variable'
|
168
|
+
UsesBackwardComposition: '%{binding} %{must} use <i>%{operator_BackwardComposition}</i>'
|
169
|
+
UsesBitwiseAnd: '%{binding} %{must} use <i>%{operator_BitwiseAnd}</i>'
|
170
|
+
UsesBitwiseLeftShift: '%{binding} %{must} use <i>%{operator_BitwiseLeftShift}</i>'
|
171
|
+
UsesBitwiseOr: '%{binding} %{must} use <i>%{operator_BitwiseOr}</i>'
|
172
|
+
UsesBitwiseRightShift: '%{binding} %{must} use <i>%{operator_BitwiseRightShift}</i>'
|
173
|
+
UsesBitwiseXor: '%{binding} %{must} use <i>%{operator_BitwiseXor}</i>'
|
161
174
|
UsesComposition: '%{binding} %{must} use composition'
|
162
175
|
UsesComprehension: '%{binding} %{must} use comprehensions'
|
163
176
|
UsesConditional: '%{binding} %{must} use conditionals'
|
164
177
|
UsesCut: '%{binding} uses <i>!</li> operator, which is a bad practice'
|
178
|
+
UsesDivide: '%{binding} %{must} use <i>%{operator_Divide}</i>'
|
165
179
|
UsesDyamicPolymorphism: '%{binding} %{must} use polymorphism'
|
166
180
|
UsesDynamicMethodOverload: '%{binding} %{must} use overload'
|
167
|
-
|
181
|
+
UsesEqual: '%{binding} %{must} use <i>%{operator_Equal}</i>'
|
182
|
+
UsesFail: '%{binding} uses <i>%{keyword_Fail}</li>, which is a bad practice'
|
168
183
|
UsesFindall: '%{binding} %{must} use <i>%{keyword_findall}</i>'
|
169
|
-
UsesForall: '%{binding} %{must} use <i>%{
|
170
|
-
UsesForeach: '%{binding} %{must} use <i>%{
|
171
|
-
UsesForLoop: '%{binding} %{must} use <i>%{
|
184
|
+
UsesForall: '%{binding} %{must} use <i>%{keyword_Forall}</i>'
|
185
|
+
UsesForeach: '%{binding} %{must} use <i>%{keyword_Foreach}</i>%{matching}'
|
186
|
+
UsesForLoop: '%{binding} %{must} use <i>%{keyword_For}</i>%{matching}'
|
187
|
+
UsesForwardComposition: '%{binding} %{must} use <i>%{operator_ForwardComposition}</i>'
|
188
|
+
UsesGreatherOrEqualThan: '%{binding} %{must} use <i>%{operator_GreatherOrEqualThan}</i>'
|
189
|
+
UsesGreatherThan: '%{binding} %{must} use <i>%{operator_GreatherThan}</i>'
|
172
190
|
UsesGuards: '%{binding} %{must} use guards%{matching}'
|
173
|
-
|
191
|
+
UsesHash: '%{binding} %{must} use <i>%{operator_Hash}</i>'
|
192
|
+
UsesIf: '%{binding} %{must} use <i>%{keyword_If}</i>%{matching}'
|
174
193
|
UsesLambda: '%{binding} %{must} use lambda expressions%{matching}'
|
175
|
-
|
194
|
+
UsesLessOrEqualThan: '%{binding} %{must} use <i>%{operator_LessOrEqualThan}</i>'
|
195
|
+
UsesLessThan: '%{binding} %{must} use <i>%{operator_LessThan}</i>'
|
196
|
+
UsesLogic: '%{binding} %{must} usar boolean operators'
|
176
197
|
UsesLoop: '%{binding} %{must} use a loop%{matching}'
|
177
198
|
UsesMath: '%{binding} %{must} usar math expressions'
|
199
|
+
UsesMinus: '%{binding} %{must} use <i>%{operator_Minus}</i>'
|
178
200
|
UsesMixin: '%{binding} %{must} use mixins'
|
201
|
+
UsesModulo: '%{binding} %{must} use <i>%{operator_Modulo}</i>'
|
202
|
+
UsesMultiply: '%{binding} %{must} use <i>%{operator_Multiply}</i>'
|
203
|
+
UsesNegation: '%{binding} %{must} use <i>%{operator_Negation}</i>'
|
179
204
|
UsesNot: '%{binding} %{must} use not'
|
205
|
+
UsesNotEqual: '%{binding} %{must} use <i>%{operator_NotEqual}</i>'
|
180
206
|
UsesObjectComposition: '%{binding} %{must} use composition'
|
207
|
+
UsesOr: '%{binding} %{must} use <i>%{operator_Or}</i>'
|
208
|
+
UsesOtherwise: '%{binding} %{must} use <i>%{operator_Otherwise}</i>'
|
181
209
|
UsesPatternMatching: '%{binding} %{must} use pattern matching'
|
182
|
-
|
183
|
-
|
210
|
+
UsesPlus: '%{binding} %{must} use <i>%{operator_Plus}</i>'
|
211
|
+
UsesRepeat: '%{binding} %{must} use <i>%{keyword_Repeat}</i>%{matching}'
|
212
|
+
UsesRepeatOf: '%{binding} %{must} use <i>%{keyword_Repeat}</i>'
|
184
213
|
UsesStaticMethodOverload: '%{binding} %{must} use overload'
|
185
214
|
UsesStaticPolymorphism: '%{binding} %{must} use polymorphism'
|
186
|
-
UsesSwitch: '%{binding} %{must} use a <i>%{
|
215
|
+
UsesSwitch: '%{binding} %{must} use a <i>%{keyword_Switch}</i>'
|
187
216
|
UsesTemplateMethod: '%{binding} %{must} use a template method'
|
188
217
|
UsesUnificationOperator: '%{binding} uses the unification operator (=)'
|
189
|
-
UsesWhile: '%{binding} %{must} use <i>%{
|
218
|
+
UsesWhile: '%{binding} %{must} use <i>%{keyword_While}</i>%{matching}'
|
data/lib/locales/es.yml
CHANGED
@@ -6,7 +6,7 @@ es:
|
|
6
6
|
must: debe
|
7
7
|
solution: la solución
|
8
8
|
with_char: ' con el carácter <i>%{value}</i>'
|
9
|
-
with_false: ' con el valor <i>%{
|
9
|
+
with_false: ' con el valor <i>%{keyword_False}</i>'
|
10
10
|
with_literal: ' con un valor literal'
|
11
11
|
with_logic: ' con una expresión booleana'
|
12
12
|
with_math: 'con una expresión matemática'
|
@@ -15,7 +15,7 @@ es:
|
|
15
15
|
with_number: ' con el número <i>%{value}</i>'
|
16
16
|
with_string: ' con la cadena <i>%{value}</i>'
|
17
17
|
with_symbol: ' con el símbolo <i>%{value}</i>'
|
18
|
-
with_true: ' con el valor <i>%{
|
18
|
+
with_true: ' con el valor <i>%{keyword_True}</i>'
|
19
19
|
inspection:
|
20
20
|
Assigns_except: '%{binding} %{must} asignar a algo diferente a %{target}%{matching}'
|
21
21
|
Assigns_like: '%{binding} %{must} asignar algo parecido a %{target}%{matching}'
|
@@ -47,7 +47,7 @@ es:
|
|
47
47
|
DeclaresComputationWithArity3_named: '%{target} %{must} tener tres parámetros'
|
48
48
|
DeclaresComputationWithArity4_named: '%{target} %{must} tener cuatro parámetros'
|
49
49
|
DeclaresComputationWithArity5_named: '%{target} %{must} tener cinco parámetros'
|
50
|
-
DeclaresEntryPoint: '%{binding} %{must} declarar un
|
50
|
+
DeclaresEntryPoint: '%{binding} %{must} declarar un <i>%{keyword_EntryPoint}</i>%{matching}'
|
51
51
|
DeclaresEnumeration_except: '%{binding} %{must} declarar enumeraciones que no se llamen %{target}'
|
52
52
|
DeclaresEnumeration_like: '%{binding} %{must} declarar una enumeracion de nombre parecido a %{target}'
|
53
53
|
DeclaresEnumeration_named: '%{binding} %{must} declarar una enumeracion %{target}'
|
@@ -101,15 +101,18 @@ es:
|
|
101
101
|
DeclaresVariable_like: '%{binding} %{must} declarar una variable parecida a %{target}%{matching}'
|
102
102
|
DeclaresVariable_named: '%{binding} %{must} declarar una variable %{target}%{matching}'
|
103
103
|
DeclaresVariable: '%{binding} %{must} debe declarar variables%{matching}'
|
104
|
+
Delegates: '%{binding} %{must} delegar'
|
104
105
|
DiscardsExceptions: '%{binding} está ignorando excepciones silenciosamiente'
|
105
106
|
DoesConsolePrint: '%{binding} está realizando impresiones por pantalla'
|
106
|
-
DoesNilTest: '%{binding} hace comparaciones contra <i>%{
|
107
|
-
DoesNullTest: '%{binding} hace comparaciones contra <i>%{
|
107
|
+
DoesNilTest: '%{binding} hace comparaciones contra <i>%{keyword_Null}</i>'
|
108
|
+
DoesNullTest: '%{binding} hace comparaciones contra <i>%{keyword_Null}</i>'
|
108
109
|
DoesTypeTest: '%{binding} hace comparaciones contra strings'
|
109
|
-
|
110
|
+
HasAssignmentCondition: '%{binding} evalúa el resultado de una asignación en donde se esperaba una expresión booleana. ¿Quizás quisiste usar el operador <i>%{operator_Equal}</i>?'
|
111
|
+
HasAssignmentReturn: '%{binding} devuelve el resultado de una asignación. ¿Quizás quisiste usar el operador <i>%{operator_Equal}</i>?'
|
110
112
|
HasCodeDuplication: '%{binding} tiene código repetido'
|
111
|
-
|
112
|
-
|
113
|
+
HasDeclarationTypos_named: 'La solución parece tener un error de tipeo: debe declarar %{target}, pero declara %{binding}. ¿Quizás quisiste decir %{target}?'
|
114
|
+
HasEmptyIfBranches: '%{binding} tiene ramas de <i>%{keyword_If}</i> vacías'
|
115
|
+
HasEmptyRepeat: '%{binding} tiene un <i>%{keyword_Repeat}</i> vacío'
|
113
116
|
HasLongParameterList: '%{binding} tiene demasiados parámetros. Te podría estar faltando una abstracción'
|
114
117
|
HasMisspelledBindings: '%{binding} está mal escrito. Revisá la ortografía y procurá no usar abreviaturas'
|
115
118
|
HasMisspelledIdentifiers: '%{binding} está mal escrito. Revisá la ortografía y procurá no usar abreviaturas'
|
@@ -119,12 +122,13 @@ es:
|
|
119
122
|
HasRedundantLambda: '%{binding} tiene lambdas innecesarias'
|
120
123
|
HasRedundantLocalVariableReturn: '%{binding} usa variables locales innecesarias; podés retornar directamente la expresión'
|
121
124
|
HasRedundantParameter: '%{binding} tiene parámetros innecesarios (se pueden eliminar mediante point-free)'
|
122
|
-
HasRedundantReduction: '%{binding} usa <i>%{
|
123
|
-
HasRedundantRepeat: '%{binding} tiene un <i>%{
|
125
|
+
HasRedundantReduction: '%{binding} usa <i>%{keyword_Is}</i>, pero no realiza cálculos'
|
126
|
+
HasRedundantRepeat: '%{binding} tiene un <i>%{keyword_Repeat}</i> innecesario'
|
124
127
|
HasTooManyMethods: '%{binding} tiene demasiados métodos'
|
125
128
|
HasTooShortBindings: '%{binding} es un identificador muy corto'
|
126
129
|
HasTooShortIdentifiers: '%{binding} es un identificador muy corto'
|
127
130
|
HasUnreachableCode: '%{binding} tiene código inalcanzable'
|
131
|
+
HasUsageTypos_named: 'La solución parece tener un error de tipeo: debe usar %{target}, pero usa %{binding}. ¿Quizás quisiste decir %{target}?'
|
128
132
|
HasWrongCaseBindings: '%{binding} no respeta la convención de nombres'
|
129
133
|
HasWrongCaseIdentifiers: '%{binding} no respeta la convención de nombres'
|
130
134
|
Implements_except: '%{binding} %{must} implementar interfaces distintas de %{target}'
|
@@ -156,7 +160,9 @@ es:
|
|
156
160
|
Returns: '%{binding} %{must} retornar%{matching}'
|
157
161
|
ReturnsNil: '%{binding} retorna null, lo cual es una mala práctica'
|
158
162
|
ReturnsNull: '%{binding} retorna null, lo cual es una mala práctica'
|
159
|
-
ShouldInvertIfCondition: '%{binding} debería invertir la condición del <i>%{
|
163
|
+
ShouldInvertIfCondition: '%{binding} debería invertir la condición del <i>%{keyword_If}</i> e intercambiar las ramas'
|
164
|
+
SubordinatesDeclarationsTo: 'Todas las declaraciones en %{binding} %{must} ser usadas desde %{target}'
|
165
|
+
SubordinatesDeclarationsToEntryPoint: 'Todas las declaraciones en %{binding} %{must} deben ser usadas desde un <i>%{keyword_EntryPoint}</i>'
|
160
166
|
TypesAs_named: '%{binding} %{must} ser de tipo %{target}'
|
161
167
|
TypesAs: '%{binding} %{must} tipar'
|
162
168
|
TypesParameterAs_except: '%{binding} %{must} tipar parámetros con un tipo diferente a %{target}'
|
@@ -169,38 +175,61 @@ es:
|
|
169
175
|
Uses_like: '%{binding} %{must} delegar en algo parecido a %{target}'
|
170
176
|
Uses_named: '%{binding} %{must} utilizar %{target}'
|
171
177
|
Uses: '%{binding} %{must} delegar'
|
178
|
+
UsesAnd: '%{binding} %{must} utilizar <i>%{operator_And}</i>'
|
172
179
|
UsesAnonymousVariable: '%{binding} %{must} utilizar una variable anónima'
|
180
|
+
UsesBackwardComposition: '%{binding} %{must} utilizar <i>%{operator_BackwardComposition}</i>'
|
181
|
+
UsesBitwiseAnd: '%{binding} %{must} utilizar <i>%{operator_BitwiseAnd}</i>'
|
182
|
+
UsesBitwiseLeftShift: '%{binding} %{must} utilizar <i>%{operator_BitwiseLeftShift}</i>'
|
183
|
+
UsesBitwiseOr: '%{binding} %{must} utilizar <i>%{operator_BitwiseOr}</i>'
|
184
|
+
UsesBitwiseRightShift: '%{binding} %{must} utilizar <i>%{operator_BitwiseRightShift}</i>'
|
185
|
+
UsesBitwiseXor: '%{binding} %{must} utilizar <i>%{operator_BitwiseXor}</i>'
|
173
186
|
UsesComposition: '%{binding} %{must} usar composición'
|
174
187
|
UsesComprehension: '%{binding} %{must} emplear listas por comprensión'
|
175
188
|
UsesConditional: '%{binding} %{must} utilizar condicionales'
|
176
189
|
UsesCut: '%{binding} usa el operador !, lo cual es una mala práctica'
|
190
|
+
UsesDivide: '%{binding} %{must} utilizar <i>%{operator_Divide}</i>'
|
177
191
|
UsesDyamicPolymorphism: '%{binding} %{must} usar polimorfismo'
|
178
192
|
UsesDynamicMethodOverload: '%{binding} %{must} usar sobrecarga'
|
193
|
+
UsesEqual: '%{binding} %{must} utilizar <i>%{operator_Equal}</i>'
|
179
194
|
UsesExceptionHandling: '%{binding} %{must} realizar manejo de excepciones'
|
180
195
|
UsesExceptions: '%{binding} %{must} usar excepciones'
|
181
|
-
UsesFail: '%{binding} usa <i>%{
|
196
|
+
UsesFail: '%{binding} usa <i>%{keyword_Fail}</li>, lo cual es una mala práctica'
|
182
197
|
UsesFindall: '%{binding} %{must} utilizar <i>%{keyword_findall}</i>'
|
183
|
-
UsesForall: '%{binding} %{must} utilizar <i>%{
|
184
|
-
UsesForeach: '%{binding} %{must} usar <i>%{
|
185
|
-
UsesForLoop: '%{binding} %{must} usar <i>%{
|
198
|
+
UsesForall: '%{binding} %{must} utilizar <i>%{keyword_Forall}</i>'
|
199
|
+
UsesForeach: '%{binding} %{must} usar <i>%{keyword_Foreach}</i>%{matching}'
|
200
|
+
UsesForLoop: '%{binding} %{must} usar <i>%{keyword_For}</i>%{matching}'
|
201
|
+
UsesForwardComposition: '%{binding} %{must} utilizar <i>%{operator_ForwardComposition}</i>'
|
202
|
+
UsesGreatherOrEqualThan: '%{binding} %{must} utilizar <i>%{operator_GreatherOrEqualThan}</i>'
|
203
|
+
UsesGreatherThan: '%{binding} %{must} utilizar <i>%{operator_GreatherThan}</i>'
|
186
204
|
UsesGuards: '%{binding} %{must} usar guardas%{matching}'
|
187
|
-
|
205
|
+
UsesHash: '%{binding} %{must} utilizar <i>%{operator_Hash}</i>'
|
206
|
+
UsesIf: '%{binding} %{must} usar <i>%{keyword_If}</i>%{matching}'
|
188
207
|
UsesInheritance: '%{binding} %{must} usar herencia'
|
189
208
|
UsesLambda: '%{binding} %{must} emplear expresiones lambda%{matching}'
|
190
|
-
|
209
|
+
UsesLessOrEqualThan: '%{binding} %{must} utilizar <i>%{operator_LessOrEqualThan}</i>'
|
210
|
+
UsesLessThan: '%{binding} %{must} utilizar <i>%{operator_LessThan}</i>'
|
211
|
+
UsesLogic: '%{binding} %{must} usar operadores booleanos'
|
191
212
|
UsesLoop: '%{binding} %{must} usar un bucle'
|
192
213
|
UsesMath: '%{binding} %{must} usar expresiones matemáticas'
|
214
|
+
UsesMinus: '%{binding} %{must} utilizar <i>%{operator_Minus}</i>'
|
193
215
|
UsesMixin: '%{binding} %{must} utilizar mixins'
|
194
216
|
UsesMixins: '%{binding} %{must} usar mixins'
|
195
|
-
|
217
|
+
UsesModulo: '%{binding} %{must} utilizar <i>%{operator_Modulo}</i>'
|
218
|
+
UsesMultiply: '%{binding} %{must} utilizar <i>%{operator_Multiply}</i>'
|
219
|
+
UsesNegation: '%{binding} %{must} utilizar <i>%{operator_Negation}</i>'
|
220
|
+
UsesNot: '%{binding} %{must} utilizar <i>%{keyword_Not}</i>'
|
221
|
+
UsesNotEqual: '%{binding} %{must} utilizar <i>%{operator_NotEqual}</i>'
|
196
222
|
UsesObjectComposition: '%{binding} %{must} usar composición'
|
223
|
+
UsesOr: '%{binding} %{must} utilizar <i>%{operator_Or}</i>'
|
224
|
+
UsesOtherwise: '%{binding} %{must} utilizar <i>%{operator_Otherwise}</i>'
|
197
225
|
UsesPatternMatching: '%{binding} %{must} utilizar pattern matching'
|
198
|
-
|
199
|
-
|
226
|
+
UsesPlus: '%{binding} %{must} utilizar <i>%{operator_Plus}</i>'
|
227
|
+
UsesRepeat: '%{binding} %{must} usar <i>%{keyword_Repeat}</i>%{matching}'
|
228
|
+
UsesRepeatOf: '%{binding} %{must} usar un <i>%{keyword_Repeat}</i> de %{target}'
|
200
229
|
UsesStaticMethodOverload: '%{binding} %{must} usar sobrecarga'
|
201
230
|
UsesStaticPolymorphism: '%{binding} %{must} usar polimorfismo'
|
202
|
-
UsesSwitch: '%{binding} %{must} utilizar un <i>%{
|
231
|
+
UsesSwitch: '%{binding} %{must} utilizar un <i>%{keyword_Switch}</i>'
|
203
232
|
UsesTemplateMethod: '%{binding} %{must} usar un método plantilla'
|
204
233
|
UsesUnificationOperator: '%{binding} usa el operador de unificación (=)'
|
205
|
-
UsesWhile: '%{binding} %{must} utilizar un <i>%{
|
206
|
-
UsesYield: '%{binding} %{must} utilizar un <i>%{
|
234
|
+
UsesWhile: '%{binding} %{must} utilizar un <i>%{keyword_While}</i>'
|
235
|
+
UsesYield: '%{binding} %{must} utilizar un <i>%{keyword_Yield}</i>'
|
data/lib/locales/pt.yml
CHANGED
@@ -6,7 +6,7 @@ pt:
|
|
6
6
|
must: 'deve'
|
7
7
|
solution: 'a solução'
|
8
8
|
with_char: ' com o caractere <i>%{value}</i>'
|
9
|
-
with_false: ' com o valor <i>%{
|
9
|
+
with_false: ' com o valor <i>%{keyword_False}</i>'
|
10
10
|
with_literal: ' com um valor literal'
|
11
11
|
with_logic: ' com uma expressão booleana'
|
12
12
|
with_math: ' com uma expressão matemática'
|
@@ -15,7 +15,7 @@ pt:
|
|
15
15
|
with_number: ' com o número <i>%{value}</i>'
|
16
16
|
with_string: ' com a string <i>%{value}</i>'
|
17
17
|
with_symbol: ' com o símbolo <i>%{value}</i>'
|
18
|
-
with_true: ' com o valor <i>%{
|
18
|
+
with_true: ' com o valor <i>%{keyword_True}</i>'
|
19
19
|
inspection:
|
20
20
|
Assigns_except: '%{binding} %{must} atribuir algo diferente a %{target}%{matching}'
|
21
21
|
Assigns_like: '%{binding} %{must} atribuir algo semelhante ao %{target}%{matching}'
|
@@ -47,7 +47,7 @@ pt:
|
|
47
47
|
DeclaresComputationWithArity3_named: '%{target} %{must} tem três parâmetros'
|
48
48
|
DeclaresComputationWithArity4_named: '%{target} %{must} tem quatro parâmetros'
|
49
49
|
DeclaresComputationWithArity5_named: '%{target} %{must} tem cinco parâmetros'
|
50
|
-
DeclaresEntryPoint: '%{binding} %{must} declarar um
|
50
|
+
DeclaresEntryPoint: '%{binding} %{must} declarar um <i>%{keyword_EntryPoint}</i>%{matching}'
|
51
51
|
DeclaresEnumeration_except: '%{binding} %{must} declarar enumerações que não são chamadas %{target}'
|
52
52
|
DeclaresEnumeration_like: '%{binding} %{must} declarar uma enumeração de nome semelhante a %{target}'
|
53
53
|
DeclaresEnumeration_named: '%{binding} %{must} declarar uma enumeração %{target}'
|
@@ -101,30 +101,34 @@ pt:
|
|
101
101
|
DeclaresVariable_like: '%{binding} %{must} declarar uma variável semelhante a %{target}%{matching}'
|
102
102
|
DeclaresVariable_named: '%{binding} %{must} declarar uma variável %{target}%{matching}'
|
103
103
|
DeclaresVariable: '%{binding} %{must} deve declarar variáveis%{matching}'
|
104
|
+
Delegates: '%{binding} %{must} delegar'
|
104
105
|
DiscardsExceptions: '%{binding} está silenciosamente ignorando exceções'
|
105
106
|
DoesConsolePrint: '%{binding} está fazendo impressões na tela'
|
106
|
-
DoesNilTest: '%{binding} faz comparações contra <i>%{
|
107
|
-
DoesNullTest: '%{binding} faz comparações contra <i>%{
|
107
|
+
DoesNilTest: '%{binding} faz comparações contra <i>%{keyword_Null}</i>'
|
108
|
+
DoesNullTest: '%{binding} faz comparações contra <i>%{keyword_Null}</i>'
|
108
109
|
DoesTypeTest: '%{binding} faz comparações contra strings'
|
109
|
-
|
110
|
+
HasAssignmentCondition: '%{binding} avalia o resultado de uma atribuição no qual uma expressão booleana era esperada. Talvez você queira usar o operador <i>%{operator_Equal}</i>?'
|
111
|
+
HasAssignmentReturn: '%{binding} retorna o resultado de uma atribuição. Talvez você queira usar o operador <i>%{operator_Equal}</i>?'
|
110
112
|
HasCodeDuplication: '%{binding} tem código repetido'
|
111
|
-
|
112
|
-
|
113
|
+
HasDeclarationTypos_named: 'A solução deve declarar %{target}, mas declara %{binding}. Você poderia ter cometido um erro de digitação?'
|
114
|
+
HasEmptyIfBranches: '%{binding} tem uma ramificaçao %{keyword_If} vazia'
|
115
|
+
HasEmptyRepeat: '%{binding} tem um <i>%{keyword_Repeat}</i> vazio'
|
113
116
|
HasLongParameterList: '%{binding} tem muitos parâmetros. Você pode estar perdendo uma abstração.'
|
114
117
|
HasMisspelledBindings: '%{binding} está incorreto. Verifique a ortografia e tente não usar abreviaturas'
|
115
118
|
HasMisspelledIdentifiers: '%{binding} está incorreto. Verifique a ortografia e tente não usar abreviaturas'
|
116
119
|
HasRedundantBooleanComparison: '%{binding} faz comparações booleanas desnecessárias'
|
117
120
|
HasRedundantGuards: '%{binding} possui protetores desnecessários'
|
118
|
-
HasRedundantIf: '%{binding} <i>%{
|
121
|
+
HasRedundantIf: '%{binding} <i>%{keyword_If}</i> desnecessário'
|
119
122
|
HasRedundantLambda: '%{binding} possui lambdas desnecessários'
|
120
123
|
HasRedundantLocalVariableReturn: '%{binding} usa variáveis locais desnecessárias; você pode retornar a expressão diretamente'
|
121
124
|
HasRedundantParameter: '%{binding} possui parâmetros desnecessários (pode ser removido por ponto-livre)'
|
122
|
-
HasRedundantReduction: '%{binding} usa <i>%{
|
123
|
-
HasRedundantRepeat: '%{binding} tem <i>%{
|
125
|
+
HasRedundantReduction: '%{binding} usa <i>%{keyword_Is}</i>, mas não executa cálculos'
|
126
|
+
HasRedundantRepeat: '%{binding} tem <i>%{keyword_Repeat}</i> desnecessário'
|
124
127
|
HasTooManyMethods: '%{binding} tem muitos métodos'
|
125
128
|
HasTooShortBindings: '%{binding} é um identificador muito curto'
|
126
129
|
HasTooShortIdentifiers: '%{binding} é um identificador muito curto'
|
127
130
|
HasUnreachableCode: '%{binding} tem código inacessível'
|
131
|
+
HasUsageTypos_named: 'A solução deve usar %{target}, mas usa %{binding}. Você poderia ter cometido um erro de digitação?'
|
128
132
|
HasWrongCaseBindings: '%{binding} não respeita a convenção de nomenclatura'
|
129
133
|
HasWrongCaseIdentifiers: '%{binding} não respeita a convenção de nomenclatura'
|
130
134
|
Implements_except: '%{binding} %{must} implementar interfaces diferentes de %{target}'
|
@@ -144,7 +148,6 @@ pt:
|
|
144
148
|
Raises_except: '%{binding} %{must} lançar exceções diferentes de %{target}'
|
145
149
|
Raises_like: '%{binding} %{must} lançar exceções semelhantes a %{target}'
|
146
150
|
Raises_named: '%{binding} %{must} launch %{target}'
|
147
|
-
ShouldInvertIfCondition: '%{binding} deve inverter a condição da <i>%{keyword_if}</i> e trocar as ramos'
|
148
151
|
Raises: '%{binding} %{must} lançar exceções'
|
149
152
|
Rescues_except: '%{binding} %{must} capturar exceções que não sejam %{target}'
|
150
153
|
Rescues_like: '%{binding} %{must} capturar exceções semelhantes a %{target}'
|
@@ -153,6 +156,9 @@ pt:
|
|
153
156
|
Returns: '%{binding} %{must} retornar%{matching}'
|
154
157
|
ReturnsNil: '%{binding} retorna nulo, o que é uma prática ruim'
|
155
158
|
ReturnsNull: '%{binding} retorna nulo, o que é uma prática ruim'
|
159
|
+
ShouldInvertIfCondition: '%{binding} deve inverter a condição da <i>%{keyword_If}</i> e trocar as ramos'
|
160
|
+
SubordinatesDeclarationsTo: 'Todas as declarações em %{binding} %{must} ser usadas a partir de %{target}'
|
161
|
+
SubordinatesDeclarationsToEntryPoint: 'Todas as declarações em %{binding} %{must} devem ser usadas a partir de <i>%{keyword_EntryPoint}</i>'
|
156
162
|
TypesAs_named: '%{binding} %{must} é do tipo %{target}'
|
157
163
|
TypesAs: '%{binding} %{must} tem tipo'
|
158
164
|
TypesReturnAs_named: '%{binding} %{must} tem tipo de valor de retorno %{target}'
|
@@ -161,36 +167,59 @@ pt:
|
|
161
167
|
Uses_like: '%{binding} %{must} delegar algo semelhante ao %{target}'
|
162
168
|
Uses_named: '%{binding} %{must} usar %{target}'
|
163
169
|
Uses: '%{binding} %{must} delegar'
|
170
|
+
UsesAnd: '%{binding} %{must} utilizar <i>%{operator_And}</i>'
|
164
171
|
UsesAnonymousVariable: '%{binding} %{must} usar uma variável anônima'
|
172
|
+
UsesBackwardComposition: '%{binding} %{must} utilizar <i>%{operator_BackwardComposition}</i>'
|
173
|
+
UsesBitwiseAnd: '%{binding} %{must} utilizar <i>%{operator_BitwiseAnd}</i>'
|
174
|
+
UsesBitwiseLeftShift: '%{binding} %{must} utilizar <i>%{operator_BitwiseLeftShift}</i>'
|
175
|
+
UsesBitwiseOr: '%{binding} %{must} utilizar <i>%{operator_BitwiseOr}</i>'
|
176
|
+
UsesBitwiseRightShift: '%{binding} %{must} utilizar <i>%{operator_BitwiseRightShift}</i>'
|
177
|
+
UsesBitwiseXor: '%{binding} %{must} utilizar <i>%{operator_BitwiseXor}</i>'
|
165
178
|
UsesComposition: '%{binding} %{must} usar a composição'
|
166
179
|
UsesComprehension: '%{binding} %{must} usar listas pelo entendimento'
|
167
180
|
UsesConditional: '%{binding} %{must} usar conditional'
|
168
181
|
UsesCut: '%{binding} usa o operador !, que é uma má prática'
|
182
|
+
UsesDivide: '%{binding} %{must} utilizar <i>%{operator_Divide}</i>'
|
169
183
|
UsesDyamicPolymorphism: '%{binding} %{must} usar polimorfismo'
|
170
184
|
UsesDynamicMethodOverload: '%{binding} %{must} usar sobrecarga'
|
185
|
+
UsesEqual: '%{binding} %{must} utilizar <i>%{operator_Equal}</i>'
|
171
186
|
UsesExceptionHandling: '%{binding} %{must} executar o tratamento de exceção'
|
172
187
|
UsesExceptions: '%{binding} %{must} usar exceções'
|
173
|
-
UsesFail: '%{binding} usa <i>%{
|
188
|
+
UsesFail: '%{binding} usa <i>%{keyword_Fail}</li>, o que é uma prática ruim'
|
174
189
|
UsesFindall: '%{binding} %{must} usar <i>%{keyword_findall}</i>'
|
175
|
-
|
176
|
-
|
177
|
-
UsesForeach: '%{binding} %{must} usar <i>%{
|
190
|
+
UsesFor: '%{binding} %{must} usar <i>%{keyword_For}</i>%{matching}'
|
191
|
+
UsesForall: '%{binding} %{must} usar <i>%{keyword_Forall}</i>'
|
192
|
+
UsesForeach: '%{binding} %{must} usar <i>%{keyword_Foreach}</i>%{matching}'
|
193
|
+
UsesForwardComposition: '%{binding} %{must} utilizar <i>%{operator_ForwardComposition}</i>'
|
194
|
+
UsesGreatherOrEqualThan: '%{binding} %{must} utilizar <i>%{operator_GreatherOrEqualThan}</i>'
|
195
|
+
UsesGreatherThan: '%{binding} %{must} utilizar <i>%{operator_GreatherThan}</i>'
|
178
196
|
UsesGuards: '%{binding} %{must} usar guardas%{matching}'
|
179
|
-
|
197
|
+
UsesHash: '%{binding} %{must} utilizar <i>%{operator_Hash}</i>'
|
198
|
+
UsesIf: '%{binding} %{must} usar <i>%{keyword_If}</i>%{matching}'
|
180
199
|
UsesInheritance: '%{binding} %{must} usar herança'
|
181
200
|
UsesLambda: '%{binding} %{must} usar expressões lambda%{matching}'
|
201
|
+
UsesLessOrEqualThan: '%{binding} %{must} utilizar <i>%{operator_LessOrEqualThan}</i>'
|
202
|
+
UsesLessThan: '%{binding} %{must} utilizar <i>%{operator_LessThan}</i>'
|
203
|
+
UsesLogic: '%{binding} %{must} usar operadores booleanos'
|
182
204
|
UsesLoop: '%{binding} %{must} usar um loop%{matching}'
|
183
|
-
UsesLogic: '%{binding} %{must} usar expressões booleanas'
|
184
205
|
UsesMath: '%{binding} %{must} usar expressões matemáticas'
|
206
|
+
UsesMinus: '%{binding} %{must} utilizar <i>%{operator_Minus}</i>'
|
185
207
|
UsesMixins: '%{binding} %{must} usar mixins'
|
186
|
-
|
208
|
+
UsesModulo: '%{binding} %{must} utilizar <i>%{operator_Modulo}</i>'
|
209
|
+
UsesMultiply: '%{binding} %{must} utilizar <i>%{operator_Multiply}</i>'
|
210
|
+
UsesNegation: '%{binding} %{must} utilizar <i>%{operator_Negation}</i>'
|
211
|
+
UsesNot: '%{binding} %{must} usar <i>%{keyword_Not}</i>'
|
212
|
+
UsesNotEqual: '%{binding} %{must} utilizar <i>%{operator_NotEqual}</i>'
|
187
213
|
UsesObjectComposition: '%{binding} %{must} usar composição'
|
214
|
+
UsesOr: '%{binding} %{must} utilizar <i>%{operator_Or}</i>'
|
215
|
+
UsesOtherwise: '%{binding} %{must} utilizar <i>%{operator_Otherwise}</i>'
|
188
216
|
UsesPatternMatching: '%{binding} %{must} usar o padrão de correspondência'
|
189
|
-
|
190
|
-
|
217
|
+
UsesPlus: '%{binding} %{must} utilizar <i>%{operator_Plus}</i>'
|
218
|
+
UsesRepeat: '%{binding} %{must} usar <i>%{keyword_Repeat}</i>%{matching}'
|
219
|
+
UsesRepeatOf: '%{binding} %{must} usar uma <i>%{keyword_Repeat}</i> de %{target}'
|
191
220
|
UsesStaticMethodOverload: '%{binding} %{must} usar sobrecarga'
|
192
221
|
UsesStaticPolymorphism: '%{binding} %{must} usar polimorfismo'
|
193
|
-
UsesSwitch: '%{binding} %{must} usar um <i>%{
|
222
|
+
UsesSwitch: '%{binding} %{must} usar um <i>%{keyword_Switch}</i>'
|
194
223
|
UsesTemplateMethod: '%{binding} %{must} usar um _template method_'
|
195
224
|
UsesUnificationOperator: '%{binding} usa o operador de unificação (=)'
|
196
|
-
UsesWhile: '%{binding} %{must} usar um <i>%{
|
225
|
+
UsesWhile: '%{binding} %{must} usar um <i>%{keyword_While}</i>%{matching}'
|
data/lib/mulang/expectation.rb
CHANGED
@@ -1,12 +1,43 @@
|
|
1
1
|
module Mulang::Expectation
|
2
|
-
SMELLS = %w(
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
SMELLS = %w(
|
3
|
+
DiscardsExceptions
|
4
|
+
DoesConsolePrint
|
5
|
+
DoesNilTest
|
6
|
+
DoesNullTest
|
7
|
+
DoesTypeTest
|
8
|
+
HasAssignmentReturn
|
9
|
+
HasAssignmentCondition
|
10
|
+
HasCodeDuplication
|
11
|
+
HasDeclarationTypos
|
12
|
+
HasEmptyIfBranches
|
13
|
+
HasEmptyRepeat
|
14
|
+
HasLongParameterList
|
15
|
+
HasMisspelledBindings
|
16
|
+
HasMisspelledIdentifiers
|
17
|
+
HasRedundantBooleanComparison
|
18
|
+
HasRedundantGuards
|
19
|
+
HasRedundantIf
|
20
|
+
HasRedundantLambda
|
21
|
+
HasRedundantLocalVariableReturn
|
22
|
+
HasRedundantParameter
|
23
|
+
HasRedundantReduction
|
24
|
+
HasRedundantRepeat
|
25
|
+
HasTooManyMethods
|
26
|
+
HasTooShortBindings
|
27
|
+
HasTooShortIdentifiers
|
28
|
+
HasUnreachableCode
|
29
|
+
HasUsageTypos
|
30
|
+
HasWrongCaseBinding
|
31
|
+
HasWrongCaseIdentifiers
|
32
|
+
IsLongCode
|
33
|
+
OverridesEqualOrHashButNotBoth
|
34
|
+
ReturnsNil
|
35
|
+
ReturnsNull
|
36
|
+
ShouldInvertIfCondition
|
37
|
+
ShouldUseOtherwise
|
38
|
+
UsesCut
|
39
|
+
UsesFail
|
40
|
+
UsesUnificationOperator)
|
10
41
|
|
11
42
|
def self.guess_type(expectation)
|
12
43
|
if expectation[:binding] == '<<custom>>'
|
@@ -19,7 +50,7 @@ module Mulang::Expectation
|
|
19
50
|
end
|
20
51
|
|
21
52
|
def self.has_smell?(smell)
|
22
|
-
SMELLS.include? smell
|
53
|
+
SMELLS.include? smell.split(':').first
|
23
54
|
end
|
24
55
|
|
25
56
|
def self.parse(expectation)
|
@@ -1,45 +1,69 @@
|
|
1
1
|
module Mulang::Expectation::I18n
|
2
2
|
class << self
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
3
|
+
DEFAULT_TOKENS = {
|
4
|
+
keyword_EntryPoint: 'program',
|
5
|
+
keyword_Fail: 'fail',
|
6
|
+
keyword_False: 'false',
|
7
|
+
keyword_findall: 'findall',
|
8
|
+
keyword_For: 'for',
|
9
|
+
keyword_Forall: 'forall',
|
10
|
+
keyword_Foreach: 'foreach',
|
11
|
+
keyword_If: 'if',
|
12
|
+
keyword_Is: 'is',
|
13
|
+
keyword_Not: 'not',
|
14
|
+
keyword_Null: 'null',
|
15
|
+
keyword_Repeat: 'repeat',
|
16
|
+
keyword_Switch: 'switch',
|
17
|
+
keyword_True: 'true',
|
18
|
+
keyword_While: 'while',
|
19
|
+
keyword_Yield: 'yield',
|
20
|
+
operator_And: '&&',
|
21
|
+
operator_BackwardComposition: '.',
|
22
|
+
operator_Divide: '/',
|
23
|
+
operator_Equal: '==',
|
24
|
+
operator_ForwardComposition: '>>',
|
25
|
+
operator_GreatherOrEqualThan: '>=',
|
26
|
+
operator_GreatherThan: '>',
|
27
|
+
operator_Hash: 'hash',
|
28
|
+
operator_LessOrEqualThan: '<=',
|
29
|
+
operator_LessThan: '<',
|
30
|
+
operator_Minus: '-',
|
31
|
+
operator_Multiply: '*',
|
32
|
+
operator_Negation: '!',
|
33
|
+
operator_NotEqual: '!=',
|
34
|
+
operator_Or: '||',
|
35
|
+
operator_Otherwise: 'otherwise',
|
36
|
+
operator_Plus: '+',
|
37
|
+
operator_Modulo: '%',
|
38
|
+
operator_BitwiseOr: '|',
|
39
|
+
operator_BitwiseAnd: '&',
|
40
|
+
operator_BitwiseXor: '^',
|
41
|
+
operator_BitwiseLeftShift: '<<',
|
42
|
+
operator_BitwiseRightShift: '>>'
|
43
|
+
}.transform_values { |v| CGI::escapeHTML(v) }.freeze
|
20
44
|
|
21
|
-
def translate(e,
|
22
|
-
translate!(e,
|
45
|
+
def translate(e, tokens = nil)
|
46
|
+
translate!(e, tokens)
|
23
47
|
rescue
|
24
48
|
'<unknown expectation>'
|
25
49
|
end
|
26
50
|
|
27
|
-
def translate!(e,
|
51
|
+
def translate!(e, tokens = nil)
|
28
52
|
e = e.as_v2
|
29
53
|
key = key_for e.binding, e.inspection
|
30
|
-
::I18n.t key, translation_params(e,
|
54
|
+
::I18n.t key, translation_params(e, tokens)
|
31
55
|
end
|
32
56
|
|
33
57
|
alias t translate
|
34
58
|
|
35
59
|
private
|
36
60
|
|
37
|
-
def translation_params(e,
|
38
|
-
|
61
|
+
def translation_params(e, tokens)
|
62
|
+
with_tokens tokens,
|
39
63
|
binding: t_binding(e.binding),
|
40
64
|
target: t_target(e.inspection),
|
41
65
|
must: t_must(e.inspection),
|
42
|
-
matching: t_matching(
|
66
|
+
matching: t_matching(tokens, e.inspection)
|
43
67
|
end
|
44
68
|
|
45
69
|
def key_for(binding, inspection)
|
@@ -58,12 +82,12 @@ module Mulang::Expectation::I18n
|
|
58
82
|
"<strong>#{parsed.target.value}</strong>" if parsed.target
|
59
83
|
end
|
60
84
|
|
61
|
-
def t_matching(
|
62
|
-
::I18n.t("mulang.expectation.#{parsed.matcher.type}",
|
85
|
+
def t_matching(tokens, parsed)
|
86
|
+
::I18n.t("mulang.expectation.#{parsed.matcher.type}", with_tokens(tokens, value: parsed.matcher.value)) if parsed.matcher
|
63
87
|
end
|
64
88
|
|
65
|
-
def
|
66
|
-
params.merge(
|
89
|
+
def with_tokens(tokens, params)
|
90
|
+
params.merge(DEFAULT_TOKENS).merge(tokens || {})
|
67
91
|
end
|
68
92
|
end
|
69
93
|
end
|
@@ -11,12 +11,12 @@ class Mulang::Expectation::Standard
|
|
11
11
|
raise "Wrong inspection #{to_h}" unless inspection?
|
12
12
|
end
|
13
13
|
|
14
|
-
def translate(
|
15
|
-
Mulang::Expectation::I18n.translate self,
|
14
|
+
def translate(tokens = nil)
|
15
|
+
Mulang::Expectation::I18n.translate self, tokens
|
16
16
|
end
|
17
17
|
|
18
|
-
def translate!(
|
19
|
-
Mulang::Expectation::I18n.translate! self,
|
18
|
+
def translate!(tokens = nil)
|
19
|
+
Mulang::Expectation::I18n.translate! self, tokens
|
20
20
|
end
|
21
21
|
|
22
22
|
def to_h
|
@@ -72,7 +72,7 @@ class Mulang::Expectation::V0 < Mulang::Expectation::Standard
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def as_v2_use
|
75
|
-
Mulang::Expectation::V2.new binding, new_inspection(inspection.type.gsub(
|
75
|
+
Mulang::Expectation::V2.new binding, new_inspection(inspection.type.gsub(/^Has/, 'Uses'), nil)
|
76
76
|
end
|
77
77
|
|
78
78
|
def as_v2_declare(simple_type)
|
data/lib/mulang/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mulang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit-core
|