mulang 4.5.3 → 5.0.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 +198 -0
- data/lib/locales/es.yml +215 -0
- data/lib/locales/pt.yml +205 -0
- data/lib/mulang.rb +5 -1
- data/lib/mulang/code.rb +26 -0
- data/lib/mulang/expectation.rb +113 -0
- data/lib/mulang/expectation/i18n.rb +65 -0
- data/lib/mulang/inspection.rb +63 -0
- data/lib/mulang/inspection/matcher.rb +18 -0
- data/lib/mulang/inspection/target.rb +70 -0
- data/lib/mulang/version.rb +2 -2
- metadata +31 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9175932c143b6a0841997e1400944429565ba33beb09aabbbd9183117a041791
|
|
4
|
+
data.tar.gz: b9f93712987684230b357cbf4fcccd9a231fce0873c67f38db57cfe6c7f5fed0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8cb2ca9a340f56f504e8c70be5d44b24d3c7ebb344eb93695abed8d6c136dd9a2196a84169e238d9d2afc8e5a4c22fa946b65804cf83a4a3580625a51bceab7
|
|
7
|
+
data.tar.gz: 94bd5b78f772d46e15e341d4264fdf7bca020081dfe9e3ddff05dd04df3664cedeac77413577bd0c641bc7ae441f980b932b9d9601d0a8c9083d00c77521517b
|
data/bin/mulang
CHANGED
|
Binary file
|
data/lib/locales/en.yml
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
en:
|
|
3
|
+
mulang:
|
|
4
|
+
expectation:
|
|
5
|
+
must_not: must not
|
|
6
|
+
must: must
|
|
7
|
+
solution: solution
|
|
8
|
+
with_char: ' with character <i>%{value}</i>'
|
|
9
|
+
with_false: ' with value <i>%{keyword_false}</i>'
|
|
10
|
+
with_literal: ' with a literal value'
|
|
11
|
+
with_logic: ' with a boolean expression'
|
|
12
|
+
with_math: ' with a math expression'
|
|
13
|
+
with_nil: ' with <i>%{keyword_nil}</i>'
|
|
14
|
+
with_nonliteral: ' with a non-literal expresson'
|
|
15
|
+
with_number: ' with number <i>%{value}</i>'
|
|
16
|
+
with_string: ' with string <i>%{value}</i>'
|
|
17
|
+
with_symbol: ' with symbol <i>%{value}</i>'
|
|
18
|
+
with_true: ' with value <i>%{keyword_true}</i>'
|
|
19
|
+
inspection:
|
|
20
|
+
Assigns_except: '%{binding} %{must} assign something distinct from %{target}%{matching}'
|
|
21
|
+
Assigns_like: '%{binding} %{must} assign something similar to %{target}%{matching}'
|
|
22
|
+
Assigns_named: '%{binding} %{must} assign %{target}%{matching}'
|
|
23
|
+
Assigns: '%{binding} %{must} perform assignments%{matching}'
|
|
24
|
+
Calls_except: '%{binding} %{must} delegate to something distinct from %{target}%{matching}'
|
|
25
|
+
Calls_like: '%{binding} %{must} delegate to something similar to %{target}%{matching}'
|
|
26
|
+
Calls_named: '%{binding} %{must} use %{target}%{matching}'
|
|
27
|
+
Calls: '%{binding} %{must} delegate%{matching}'
|
|
28
|
+
Declares_except: '%{binding} %{must} contain declarations distinct from %{target}'
|
|
29
|
+
Declares_like: '%{binding} %{must} declare an identifier similar to %{target}'
|
|
30
|
+
Declares_named: '%{binding} %{must} declare %{target}'
|
|
31
|
+
Declares: '%{binding} %{must} contain declarations'
|
|
32
|
+
DeclaresAttribute_except: '%{binding} %{must} declare attributes distinct from %{target}%{matching}'
|
|
33
|
+
DeclaresAttribute_like: '%{binding} %{must} declare an attribute similar to %{target}%{matching}'
|
|
34
|
+
DeclaresAttribute_named: '%{binding} %{must} declare an attribute %{target}%{matching}'
|
|
35
|
+
DeclaresAttribute: '%{binding} %{must} declare attributes%{matching}'
|
|
36
|
+
DeclaresClass_except: '%{binding} %{must} declare classes distinct from %{target}'
|
|
37
|
+
DeclaresClass_like: '%{binding} %{must} declare a class similar to %{target}'
|
|
38
|
+
DeclaresClass_named: '%{binding} %{must} declare a class %{target}'
|
|
39
|
+
DeclaresClass: '%{binding} %{must} declare classes'
|
|
40
|
+
DeclaresComputation_except: '%{binding} %{must} declare computations distinct from %{target}'
|
|
41
|
+
DeclaresComputation_like: '%{binding} %{must} declare a computation similar to %{target}'
|
|
42
|
+
DeclaresComputation_named: '%{binding} %{must} declare a computation %{target}'
|
|
43
|
+
DeclaresComputation: '%{binding} %{must} declare computations'
|
|
44
|
+
DeclaresComputationWithArity0_named: '%{target} %{must} have zero parameters'
|
|
45
|
+
DeclaresComputationWithArity1_named: '%{target} %{must} have one parameter'
|
|
46
|
+
DeclaresComputationWithArity2_named: '%{target} %{must} have 2 parameters'
|
|
47
|
+
DeclaresComputationWithArity3_named: '%{target} %{must} have 3 parameters'
|
|
48
|
+
DeclaresComputationWithArity4_named: '%{target} %{must} have 4 parameters'
|
|
49
|
+
DeclaresComputationWithArity5_named: '%{target} %{must} have 5 parameters'
|
|
50
|
+
DeclaresEntryPoint: '%{binding} %{must} declare an entry point%{matching}'
|
|
51
|
+
DeclaresEnumeration_except: '%{binding} %{must} declare enumerations distinct from %{target}'
|
|
52
|
+
DeclaresEnumeration_like: '%{binding} %{must} declare an enumeration like %{target}'
|
|
53
|
+
DeclaresEnumeration_named: '%{binding} %{must} declare an enumeration %{target}'
|
|
54
|
+
DeclaresEnumeration: '%{binding} %{must} declare enumerations'
|
|
55
|
+
DeclaresFact_except: '%{binding} %{must} declare facts distinct from %{target}'
|
|
56
|
+
DeclaresFact_like: '%{binding} %{must} declare a fact similar to %{target}'
|
|
57
|
+
DeclaresFact_named: '%{binding} %{must} declare a fact %{target}'
|
|
58
|
+
DeclaresFact: '%{binding} %{must} declare facts'
|
|
59
|
+
DeclaresFunction_except: '%{binding} %{must} declare functions distinct from %{target}%{matching}'
|
|
60
|
+
DeclaresFunction_like: '%{binding} %{must} declare a function similar to %{target}%{matching}'
|
|
61
|
+
DeclaresFunction_named: '%{binding} %{must} declare a function %{target}%{matching}'
|
|
62
|
+
DeclaresFunction: '%{binding} %{must} debe declare functions%{matching}'
|
|
63
|
+
DeclaresInterface_except: '%{binding} %{must} declare interfaces distinct from %{target}%{matching}'
|
|
64
|
+
DeclaresInterface_like: '%{binding} %{must} declare an interface like %{target}%{matching}'
|
|
65
|
+
DeclaresInterface_named: '%{binding} %{must} declare an interface %{target}%{matching}'
|
|
66
|
+
DeclaresInterface: '%{binding} %{must} declare interfaces%{matching}%{matching}'
|
|
67
|
+
DeclaresMethod_except: '%{binding} %{must} declare methods distinct from %{target}%{matching}'
|
|
68
|
+
DeclaresMethod_like: '%{binding} %{must} declare a method similar to %{target}%{matching}'
|
|
69
|
+
DeclaresMethod_named: '%{binding} %{must} declare a method %{target}%{matching}'
|
|
70
|
+
DeclaresMethod: '%{binding} %{must} declare methods%{matching}'
|
|
71
|
+
DeclaresObject_except: '%{binding} %{must} declare objects distinct from %{target}%{matching}'
|
|
72
|
+
DeclaresObject_like: '%{binding} %{must} declare an object similar to %{target}%{matching}'
|
|
73
|
+
DeclaresObject_named: '%{binding} %{must} declare an object %{target}%{matching}'
|
|
74
|
+
DeclaresObject: '%{binding} %{must} declare objects%{matching}'
|
|
75
|
+
DeclaresPredicate_except: '%{binding} %{must} declare a predicate distinct from %{target}%{matching}'
|
|
76
|
+
DeclaresPredicate_like: '%{binding} %{must} declare a predicate similar to %{target}%{matching}'
|
|
77
|
+
DeclaresPredicate_named: '%{binding} %{must} declare predicates %{target}%{matching}'
|
|
78
|
+
DeclaresPredicate: '%{binding} %{must} declare predicates%{matching}'
|
|
79
|
+
DeclaresProcedure_except: '%{binding} %{must} declare procedures distinct from %{target}%{matching}'
|
|
80
|
+
DeclaresProcedure_like: '%{binding} %{must} declare a procedure similar to %{target}%{matching}'
|
|
81
|
+
DeclaresProcedure_named: '%{binding} %{must} declare a procedure %{target}%{matching}'
|
|
82
|
+
DeclaresProcedure: '%{binding} %{must} declare procedures%{matching}'
|
|
83
|
+
DeclaresRecursively_named: '%{target} %{must} declared recursively'
|
|
84
|
+
DeclaresRule_except: '%{binding} %{must} declare rules distinct from %{target}'
|
|
85
|
+
DeclaresRule_like: '%{binding} %{must} declare a rule similar to %{target}'
|
|
86
|
+
DeclaresRule_named: '%{binding} %{must} declare a rule %{target}'
|
|
87
|
+
DeclaresRule: '%{binding} %{must} debe declare rules'
|
|
88
|
+
DeclaresStyles_except: '%{binding} %{must} declare style distinct from %{target}'
|
|
89
|
+
DeclaresStyles_like: '%{binding} %{must} declare a style similar to %{target}'
|
|
90
|
+
DeclaresStyles_named: '%{binding} %{must} declare a style %{target}'
|
|
91
|
+
DeclaresStyles: '%{binding} %{must} declare styles'
|
|
92
|
+
DeclaresTag_except: '%{binding} %{must} declare a tag distinct from %{target}'
|
|
93
|
+
DeclaresTag_like: '%{binding} %{must} declare a tag similar to %{target}'
|
|
94
|
+
DeclaresTag_named: '%{binding} %{must} declare a tag %{target}'
|
|
95
|
+
DeclaresTag: '%{binding} %{must} declare a tag'
|
|
96
|
+
DeclaresTypeAlias_except: '%{binding} %{must} declare type aliases distinct from %{target}'
|
|
97
|
+
DeclaresTypeAlias_like: '%{binding} %{must} declare a type alias similar to %{target}'
|
|
98
|
+
DeclaresTypeAlias_named: '%{binding} %{must} declare a type alias %{target}'
|
|
99
|
+
DeclaresTypeAlias: '%{binding} %{must} declare type aliases'
|
|
100
|
+
DeclaresTypeSignature_except: '%{binding} %{must} declare a type signature distinct from %{target}'
|
|
101
|
+
DeclaresTypeSignature_like: '%{binding} %{must} declare a type signature for something like %{target}'
|
|
102
|
+
DeclaresTypeSignature_named: '%{binding} %{must} declare a type signature %{target}'
|
|
103
|
+
DeclaresTypeSignature: '%{binding} %{must} decarar type signatures'
|
|
104
|
+
DeclaresVariable_except: '%{binding} %{must} declare variables distinct from %{target}%{matching}'
|
|
105
|
+
DeclaresVariable_like: '%{binding} %{must} declare a variable similar to %{target}%{matching}'
|
|
106
|
+
DeclaresVariable_named: '%{binding} %{must} declare a variable %{target}%{matching}'
|
|
107
|
+
DeclaresVariable: '%{binding} %{must} debe declare variables%{matching}'
|
|
108
|
+
DiscardsExceptions: '%{binding} is ignoring exceptions silently'
|
|
109
|
+
DoesConsolePrint: '%{binding} is printing to the console'
|
|
110
|
+
DoesNilTest: '%{binding} does <i>%{keyword_null}</i> tests'
|
|
111
|
+
DoesNullTest: '%{binding} does <i>%{keyword_null}</i> tests'
|
|
112
|
+
DoesTypeTest: '%{binding} string type tests'
|
|
113
|
+
HasAssignmentReturn: '%{binding} returns the result of an assignment'
|
|
114
|
+
HasCodeDuplication: '%{binding} has code duplication'
|
|
115
|
+
HasEmptyIfBranches: '%{binding} has empty <i>%{keyword_if}</i> branches'
|
|
116
|
+
HasLongParameterList: '%{binding} has too many parameters. You may be missing an abstraction.'
|
|
117
|
+
HasMisspelledBindings: '%{binding} is misspelled'
|
|
118
|
+
HasMisspelledIdentifiers: '%{binding} is misspelled'
|
|
119
|
+
HasRedundantBooleanComparison: '%{binding} makes unnecesary boolean comparisons'
|
|
120
|
+
HasRedundantGuards: '%{binding} has unnecessary guards'
|
|
121
|
+
HasRedundantIf: '%{binding} has unnecessary <i>%{keyword_if}</i>s'
|
|
122
|
+
HasRedundantLambda: '%{binding} has unnecessary lambdas'
|
|
123
|
+
HasRedundantLocalVariableReturn: '%{binding} has unnecesary local variables; please try returning the expression directly'
|
|
124
|
+
HasRedundantParameter: '%{binding} has unnecessary parameters, that can be removed using point-free'
|
|
125
|
+
HasRedundantReduction: '%{binding} uses <i>%{keyword_is}</i>, but it does not artihmetic'
|
|
126
|
+
HasTooManyMethods: '%{binding} has too many methods'
|
|
127
|
+
HasTooShortBindings: '%{binding} is a too short identifier'
|
|
128
|
+
HasTooShortIdentifiers: '%{binding} is a too short identifier'
|
|
129
|
+
HasUnreachableCode: '%{binding} has unreachable code'
|
|
130
|
+
HasWrongCaseBindings: '%{binding} does not honor case conventions'
|
|
131
|
+
HasWrongCaseIdentifiers: '%{binding} does not honor case conventions'
|
|
132
|
+
Implements_except: '%{binding} %{must} implement interfaces distinct from %{target}'
|
|
133
|
+
Implements_like: '%{binding} %{must} implement interfaces like %{target}'
|
|
134
|
+
Implements_named: '%{binding} %{must} implement %{target}'
|
|
135
|
+
Implements: '%{binding} %{must} implement intefaces'
|
|
136
|
+
Includes_except: '%{binding} %{must} include mixins distinct from %{target}'
|
|
137
|
+
Includes_like: '%{binding} %{must} include a mixin similar to %{target}'
|
|
138
|
+
Includes_named: '%{binding} %{must} include the %{target} mixin'
|
|
139
|
+
Includes: '%{binding} %{must} include mixins'
|
|
140
|
+
Instantiates_except: '%{binding} %{must} instantiate classes distinct from %{target}'
|
|
141
|
+
Instantiates_like: '%{binding} %{must} instantiate classes like %{target}'
|
|
142
|
+
Instantiates_named: '%{binding} %{must} instantiate %{target}'
|
|
143
|
+
Instantiates: '%{binding} %{must} instantiate objects'
|
|
144
|
+
IsLongCode: '%{binding} is too long'
|
|
145
|
+
OverridesEqualOrHashButNotBoth: '%{binding} overrides <i>equals</i> or <i>hash</i> methods, but not both'
|
|
146
|
+
Raises_except: '%{binding} %{must} throw exceptions distinct from %{target}'
|
|
147
|
+
Raises_like: '%{binding} %{must} throw exceptions like %{target}'
|
|
148
|
+
Raises_named: '%{binding} %{must} throw %{target}'
|
|
149
|
+
Raises: '%{binding} %{must} throw exceptions'
|
|
150
|
+
Returns: '%{binding} %{must} return%{matching}'
|
|
151
|
+
ReturnsNil: '%{binding} retuns <i>%{keyword_null}</i>, which is a bad practice'
|
|
152
|
+
ReturnsNull: '%{binding} retuns <i>%{keyword_null}</i>, which is a bad practice'
|
|
153
|
+
SourceContains_named: 'solution %{must} use %{target}'
|
|
154
|
+
SourceEquals_named: 'solution %{must} be equal to %{target}'
|
|
155
|
+
SourceEqualsIgnoreSpaces_named: 'solution %{must} be equal to %{target}'
|
|
156
|
+
SourceRepeats_named: 'solution %{must} use %{target} more than one time'
|
|
157
|
+
TypesAs_named: '%{binding} %{must} type as %{target}'
|
|
158
|
+
TypesAs: '%{binding} %{must} type'
|
|
159
|
+
TypesParameterAs_except: '%{binding} %{must} type parameters with a type distinct from %{target}'
|
|
160
|
+
TypesParameterAs_like: '%{binding} %{must} type parameters with a type similar to %{target}'
|
|
161
|
+
TypesParameterAs_named: '%{binding} %{must} type parameters with type %{target}'
|
|
162
|
+
TypesParameterAs: '%{binding} %{must} type parameters'
|
|
163
|
+
TypesReturnAs_named: '%{binding} %{must} type its return value as %{target}'
|
|
164
|
+
TypesReturnAs: '%{binding} %{must} type its return value'
|
|
165
|
+
Uses_except: '%{binding} %{must} delegate to something distinct from %{target}'
|
|
166
|
+
Uses_like: '%{binding} %{must} delegate to something similar to %{target}'
|
|
167
|
+
Uses_named: '%{binding} %{must} use %{target}'
|
|
168
|
+
Uses: '%{binding} %{must} delegate'
|
|
169
|
+
UsesAnonymousVariable: '%{binding} %{must} use an annonymous variable'
|
|
170
|
+
UsesComposition: '%{binding} %{must} use composition'
|
|
171
|
+
UsesComprehension: '%{binding} %{must} use comprehensions'
|
|
172
|
+
UsesConditional: '%{binding} %{must} use conditionals'
|
|
173
|
+
UsesCut: '%{binding} uses <i>!</li> operator, which is a bad practice'
|
|
174
|
+
UsesDyamicPolymorphism: '%{binding} %{must} use polymorphism'
|
|
175
|
+
UsesDynamicMethodOverload: '%{binding} %{must} use overload'
|
|
176
|
+
UsesFail: '%{binding} uses <i>%{keyword_fail}</li>, which is a bad practice'
|
|
177
|
+
UsesFindall: '%{binding} %{must} use <i>%{keyword_findall}</i>'
|
|
178
|
+
UsesForall: '%{binding} %{must} use <i>%{keyword_forall}</i>'
|
|
179
|
+
UsesForeach: '%{binding} %{must} use <i>%{keyword_foreach}</i>%{matching}'
|
|
180
|
+
UsesForLoop: '%{binding} %{must} use <i>%{keyword_for}</i>%{matching}'
|
|
181
|
+
UsesGuards: '%{binding} %{must} use guards%{matching}'
|
|
182
|
+
UsesIf: '%{binding} %{must} use <i>%{keyword_if}</i>%{matching}'
|
|
183
|
+
UsesLambda: '%{binding} %{must} use lambda expressions%{matching}'
|
|
184
|
+
UsesLogic: '%{binding} %{must} usar boolean expressions'
|
|
185
|
+
UsesLoop: '%{binding} %{must} use a loop%{matching}'
|
|
186
|
+
UsesMath: '%{binding} %{must} usar math expressions'
|
|
187
|
+
UsesMixin: '%{binding} %{must} use mixins'
|
|
188
|
+
UsesNot: '%{binding} %{must} use not'
|
|
189
|
+
UsesObjectComposition: '%{binding} %{must} use composition'
|
|
190
|
+
UsesPatternMatching: '%{binding} %{must} use pattern matching'
|
|
191
|
+
UsesRepeat: '%{binding} %{must} use <i>%{keyword_repeat}</i>%{matching}'
|
|
192
|
+
UsesRepeatOf: '%{binding} %{must} use <i>%{keyword_repeat}</i>'
|
|
193
|
+
UsesStaticMethodOverload: '%{binding} %{must} use overload'
|
|
194
|
+
UsesStaticPolymorphism: '%{binding} %{must} use polymorphism'
|
|
195
|
+
UsesSwitch: '%{binding} %{must} use a <i>%{keyword_switch}</i>'
|
|
196
|
+
UsesTemplateMethod: '%{binding} %{must} use a template method'
|
|
197
|
+
UsesUnificationOperator: '%{binding} uses the unification operator (=)'
|
|
198
|
+
UsesWhile: '%{binding} %{must} use <i>%{keyword_while}</i>%{matching}'
|
data/lib/locales/es.yml
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
---
|
|
2
|
+
es:
|
|
3
|
+
mulang:
|
|
4
|
+
expectation:
|
|
5
|
+
must_not: no debe
|
|
6
|
+
must: debe
|
|
7
|
+
solution: la solución
|
|
8
|
+
with_char: ' con el carácter <i>%{value}</i>'
|
|
9
|
+
with_false: ' con el valor <i>%{keyword_false}</i>'
|
|
10
|
+
with_literal: ' con un valor literal'
|
|
11
|
+
with_logic: ' con una expresión booleana'
|
|
12
|
+
with_math: 'con una expresión matemática'
|
|
13
|
+
with_nil: ' con <i>%{keyword_nil}</i>'
|
|
14
|
+
with_nonliteral: ' con una expresión no literal'
|
|
15
|
+
with_number: ' con el número <i>%{value}</i>'
|
|
16
|
+
with_string: ' con la cadena <i>%{value}</i>'
|
|
17
|
+
with_symbol: ' con el símbolo <i>%{value}</i>'
|
|
18
|
+
with_true: ' con el valor <i>%{keyword_true}</i>'
|
|
19
|
+
inspection:
|
|
20
|
+
Assigns_except: '%{binding} %{must} asignar a algo diferente a %{target}%{matching}'
|
|
21
|
+
Assigns_like: '%{binding} %{must} asignar algo parecido a %{target}%{matching}'
|
|
22
|
+
Assigns_named: '%{binding} %{must} asignar %{target}%{matching}'
|
|
23
|
+
Assigns: '%{binding} %{must} realizar asignaciones%{matching}'
|
|
24
|
+
Calls_except: '%{binding} %{must} delegar en algo diferente a %{target}%{matching}'
|
|
25
|
+
Calls_like: '%{binding} %{must} delegar en algo parecido a %{target}%{matching}'
|
|
26
|
+
Calls_named: '%{binding} %{must} utilizar %{target}%{matching}'
|
|
27
|
+
Calls: '%{binding} %{must} delegar%{matching}'
|
|
28
|
+
Declares_except: '%{binding} %{must} contener declaraciones distintas a %{target}'
|
|
29
|
+
Declares_like: '%{binding} %{must} declarar un identificador parecido a %{target}'
|
|
30
|
+
Declares_named: '%{binding} %{must} declarar %{target}'
|
|
31
|
+
Declares: '%{binding} %{must} contener declaraciones'
|
|
32
|
+
DeclaresAttribute_except: '%{binding} %{must} declarar atributos diferentes a %{target}%{matching}'
|
|
33
|
+
DeclaresAttribute_like: '%{binding} %{must} declarar un atributo parecido a %{target}%{matching}'
|
|
34
|
+
DeclaresAttribute_named: '%{binding} %{must} declarar un atributo %{target}%{matching}'
|
|
35
|
+
DeclaresAttribute: '%{binding} %{must} declarar atributos%{matching}'
|
|
36
|
+
DeclaresClass_except: '%{binding} %{must} declarar clases diferentes a %{target}'
|
|
37
|
+
DeclaresClass_like: '%{binding} %{must} declarar una clase parecida a %{target}'
|
|
38
|
+
DeclaresClass_named: '%{binding} %{must} declarar una clase %{target}'
|
|
39
|
+
DeclaresClass: '%{binding} %{must} declarar clases'
|
|
40
|
+
DeclaresComputation_except: '%{binding} %{must} declarar computaciones diferentes a %{target}'
|
|
41
|
+
DeclaresComputation_like: '%{binding} %{must} declarar una computación parecida a %{target}'
|
|
42
|
+
DeclaresComputation_named: '%{binding} %{must} declarar una computación %{target}'
|
|
43
|
+
DeclaresComputation: '%{binding} %{must} declarar computaciones'
|
|
44
|
+
DeclaresComputationWithArity0_named: '%{target} %{must} declarar cero parametros'
|
|
45
|
+
DeclaresComputationWithArity1_named: '%{target} %{must} tener un parámetro'
|
|
46
|
+
DeclaresComputationWithArity2_named: '%{target} %{must} tener dos parámetros'
|
|
47
|
+
DeclaresComputationWithArity3_named: '%{target} %{must} tener tres parámetros'
|
|
48
|
+
DeclaresComputationWithArity4_named: '%{target} %{must} tener cuatro parámetros'
|
|
49
|
+
DeclaresComputationWithArity5_named: '%{target} %{must} tener cinco parámetros'
|
|
50
|
+
DeclaresEntryPoint: '%{binding} %{must} declarar un punto de entrada%{matching}'
|
|
51
|
+
DeclaresEnumeration_except: '%{binding} %{must} declarar enumeraciones que no se llamen %{target}'
|
|
52
|
+
DeclaresEnumeration_like: '%{binding} %{must} declarar una enumeracion de nombre parecido a %{target}'
|
|
53
|
+
DeclaresEnumeration_named: '%{binding} %{must} declarar una enumeracion %{target}'
|
|
54
|
+
DeclaresEnumeration: '%{binding} %{must} declarar enumeraciones'
|
|
55
|
+
DeclaresFact_except: '%{binding} %{must} declarar hechos diferentes a %{target}'
|
|
56
|
+
DeclaresFact_like: '%{binding} %{must} declarar un hecho parecido a %{target}'
|
|
57
|
+
DeclaresFact_named: '%{binding} %{must} declarar un hecho %{target}'
|
|
58
|
+
DeclaresFact: '%{binding} %{must} declarar hechos'
|
|
59
|
+
DeclaresFunction_except: '%{binding} %{must} declarar funciones diferentes a %{target}%{matching}'
|
|
60
|
+
DeclaresFunction_like: '%{binding} %{must} declarar una función parecida a %{target}%{matching}'
|
|
61
|
+
DeclaresFunction_named: '%{binding} %{must} declarar una función %{target}%{matching}'
|
|
62
|
+
DeclaresFunction: '%{binding} %{must} debe declarar funciones%{matching}'
|
|
63
|
+
DeclaresInterface_except: '%{binding} %{must} declarar interfaces que no se llamen %{target}%{matching}'
|
|
64
|
+
DeclaresInterface_like: '%{binding} %{must} declarar una interfaz de nombre parecido a %{target}%{matching}'
|
|
65
|
+
DeclaresInterface_named: '%{binding} %{must} declarar una interfaz %{target}%{matching}'
|
|
66
|
+
DeclaresInterface: '%{binding} %{must} declarar interfaces%{matching}'
|
|
67
|
+
DeclaresMethod_except: '%{binding} %{must} declarar métodos diferentes a %{target}%{matching}'
|
|
68
|
+
DeclaresMethod_like: '%{binding} %{must} declarar un método parecido a %{target}%{matching}'
|
|
69
|
+
DeclaresMethod_named: '%{binding} %{must} declarar un método %{target}%{matching}'
|
|
70
|
+
DeclaresMethod: '%{binding} %{must} declarar métodos%{matching}'
|
|
71
|
+
DeclaresObject_except: '%{binding} %{must} declarar objetos diferentes a %{target}%{matching}'
|
|
72
|
+
DeclaresObject_like: '%{binding} %{must} declarar un objeto parecido a%{target}%{matching}'
|
|
73
|
+
DeclaresObject_named: '%{binding} %{must} declarar un objeto %{target}%{matching}'
|
|
74
|
+
DeclaresObject: '%{binding} %{must} declarar objetos%{matching}'
|
|
75
|
+
DeclaresPredicate_except: '%{binding} %{must} declarar predicados diferentes a %{target}%{matching}'
|
|
76
|
+
DeclaresPredicate_like: '%{binding} %{must} declarar un predicados parecido a %{target}%{matching}'
|
|
77
|
+
DeclaresPredicate_named: '%{binding} %{must} declarar un predicados %{target}%{matching}'
|
|
78
|
+
DeclaresPredicate: '%{binding} %{must} declarar predicados%{matching}'
|
|
79
|
+
DeclaresProcedure_except: '%{binding} %{must} declarar procedimientos diferentes a %{target}%{matching}'
|
|
80
|
+
DeclaresProcedure_like: '%{binding} %{must} declarar un procedimiento parecido a %{target}%{matching}'
|
|
81
|
+
DeclaresProcedure_named: '%{binding} %{must} declarar un procedimiento %{target}%{matching}'
|
|
82
|
+
DeclaresProcedure: '%{binding} %{must} declarar procedimientos%{matching}'
|
|
83
|
+
DeclaresRecursively_named: '%{target} %{must} estar declarado recursivamente'
|
|
84
|
+
DeclaresRule_except: '%{binding} %{must} declarar reglas diferentes a %{target}'
|
|
85
|
+
DeclaresRule_like: '%{binding} %{must} declarar una regla parecida a %{target}'
|
|
86
|
+
DeclaresRule_named: '%{binding} %{must} declarar una regla %{target}'
|
|
87
|
+
DeclaresRule: '%{binding} %{must} debe declarar reglas'
|
|
88
|
+
DeclaresStyle_except: '%{binding} %{must} declarar un estilo diferente a %{target}'
|
|
89
|
+
DeclaresStyle_like: '%{binding} %{must} declarar un estilo parecido a %{target}'
|
|
90
|
+
DeclaresStyle_named: '%{binding} %{must} declarar un estilo %{target}'
|
|
91
|
+
DeclaresStyle: '%{binding} %{must} declarar un estilo'
|
|
92
|
+
DeclaresSuperclass_except: '%{binding} %{must} declarar una superclase distinta de %{target}'
|
|
93
|
+
DeclaresSuperclass_like: '%{binding} %{must} declarar una superclase parecida a %{target}'
|
|
94
|
+
DeclaresSuperclass_named: '%{binding} %{must} declarar una superclase %{target}'
|
|
95
|
+
DeclaresSuperclass: '%{binding} %{must} declarar una superclase'
|
|
96
|
+
DeclaresTag_except: '%{binding} %{must} declarar un elemento diferente a %{target}'
|
|
97
|
+
DeclaresTag_like: '%{binding} %{must} declarar un elemento parecido a %{target}'
|
|
98
|
+
DeclaresTag_named: '%{binding} %{must} declarar un elemento %{target}'
|
|
99
|
+
DeclaresTag: '%{binding} %{must} declarar un elemento'
|
|
100
|
+
DeclaresTypeAlias_except: '%{binding} %{must} declarar sinónimos de tipo diferentes a %{target}'
|
|
101
|
+
DeclaresTypeAlias_like: '%{binding} %{must} declarar un sinónimo de tipo parecido a %{target}'
|
|
102
|
+
DeclaresTypeAlias_named: '%{binding} %{must} declarar un sinónimo de tipo %{target}'
|
|
103
|
+
DeclaresTypeAlias: '%{binding} %{must} declarar sinónimos de tipo'
|
|
104
|
+
DeclaresTypeSignature_except: '%{binding} %{must} declarar firmas de tipos diferentes a %{target}'
|
|
105
|
+
DeclaresTypeSignature_like: '%{binding} %{must} declarar una firma para algo parecido %{target}'
|
|
106
|
+
DeclaresTypeSignature_named: '%{binding} %{must} declarar una firma %{target}'
|
|
107
|
+
DeclaresTypeSignature: '%{binding} %{must} declarar firmas de tipos'
|
|
108
|
+
DeclaresVariable_except: '%{binding} %{must} declarar variables diferentes a %{target}%{matching}'
|
|
109
|
+
DeclaresVariable_like: '%{binding} %{must} declarar una variable parecida a %{target}%{matching}'
|
|
110
|
+
DeclaresVariable_named: '%{binding} %{must} declarar una variable %{target}%{matching}'
|
|
111
|
+
DeclaresVariable: '%{binding} %{must} debe declarar variables%{matching}'
|
|
112
|
+
DiscardsExceptions: '%{binding} está ignorando excepciones silenciosamiente'
|
|
113
|
+
DoesConsolePrint: '%{binding} está realizando impresiones por pantalla'
|
|
114
|
+
DoesNilTest: '%{binding} hace comparaciones contra <i>%{keyword_null}</i>'
|
|
115
|
+
DoesNullTest: '%{binding} hace comparaciones contra <i>%{keyword_null}</i>'
|
|
116
|
+
DoesTypeTest: '%{binding} hace comparaciones contra strings'
|
|
117
|
+
HasAssignmentReturn: '%{binding} devuelve el resultado de una asignación'
|
|
118
|
+
HasCodeDuplication: '%{binding} tiene código repetido'
|
|
119
|
+
HasEmptyIfBranches: '%{binding} tiene ramas de <i>%{keyword_if}</i> vacías'
|
|
120
|
+
HasLongParameterList: '%{binding} tiene demasiados parámetros. Te podría estar faltando una abstracción'
|
|
121
|
+
HasMisspelledBindings: '%{binding} está mal escrito. Revisá la ortografía y procurá no usar abreviaturas'
|
|
122
|
+
HasMisspelledIdentifiers: '%{binding} está mal escrito. Revisá la ortografía y procurá no usar abreviaturas'
|
|
123
|
+
HasRedundantBooleanComparison: '%{binding} hace comparaciones booleanas innecesarias'
|
|
124
|
+
HasRedundantGuards: '%{binding} tiene guardas innecesarias'
|
|
125
|
+
HasRedundantIf: '%{binding} tiene ifs innecesarios'
|
|
126
|
+
HasRedundantLambda: '%{binding} tiene lambdas innecesarias'
|
|
127
|
+
HasRedundantLocalVariableReturn: '%{binding} usa variables locales innecesarias; podés retornar directamente la expresión'
|
|
128
|
+
HasRedundantParameter: '%{binding} tiene parámetros innecesarios (se pueden eliminar mediante point-free)'
|
|
129
|
+
HasRedundantReduction: '%{binding} usa <i>%{keyword_is}</i>, pero no realiza cálculos'
|
|
130
|
+
HasTooManyMethods: '%{binding} tiene demasiados métodos'
|
|
131
|
+
HasTooShortBindings: '%{binding} es un identificador muy corto'
|
|
132
|
+
HasTooShortIdentifiers: '%{binding} es un identificador muy corto'
|
|
133
|
+
HasUnreachableCode: '%{binding} tiene código inalcanzable'
|
|
134
|
+
HasWrongCaseBindings: '%{binding} no respeta la convención de nombres'
|
|
135
|
+
HasWrongCaseIdentifiers: '%{binding} no respeta la convención de nombres'
|
|
136
|
+
Implements_except: '%{binding} %{must} implementar interfaces distintas de %{target}'
|
|
137
|
+
Implements_like: '%{binding} %{must} implementar insterfaces parecidas a %{target}'
|
|
138
|
+
Implements_named: '%{binding} %{must} implementar %{target}'
|
|
139
|
+
Implements: '%{binding} %{must} implementar intefaces'
|
|
140
|
+
Includes_except: '%{binding} %{must} incluir mixins diferentes a %{target}'
|
|
141
|
+
Includes_like: '%{binding} %{must} incluir un mixin parecido a %{target}'
|
|
142
|
+
Includes_named: '%{binding} %{must} incluir el mixin %{target}'
|
|
143
|
+
Includes: '%{binding} %{must} incluir mixins'
|
|
144
|
+
Inherits_except: '%{binding} %{must} declarar una superclase distinta de %{target}'
|
|
145
|
+
Inherits_like: '%{binding} %{must} declarar una superclase parecida a %{target}'
|
|
146
|
+
Inherits_named: '%{binding} %{must} declarar una superclase %{target}'
|
|
147
|
+
Inherits: '%{binding} %{must} declarar una superclase'
|
|
148
|
+
Instantiates_except: '%{binding} %{must} instanciar clases distintas de %{target}'
|
|
149
|
+
Instantiates_like: '%{binding} %{must} instanciar clases parecidas a %{target}'
|
|
150
|
+
Instantiates_named: '%{binding} %{must} instanciar %{target}'
|
|
151
|
+
Instantiates: '%{binding} %{must} instanciar objetos'
|
|
152
|
+
IsLongCode: '%{binding} es muy largo. Tratá de delegar más'
|
|
153
|
+
OverridesEqualOrHashButNotBoth: '%{binding} redefine los métodos <i>equals</i> o <i>hash</i>, pero no ambos'
|
|
154
|
+
Raises_except: '%{binding} %{must} lanzar excepciones diferentes a %{target}'
|
|
155
|
+
Raises_like: '%{binding} %{must} lanzar excepciones parecidas a %{target}'
|
|
156
|
+
Raises_named: '%{binding} %{must} lanzar %{target}'
|
|
157
|
+
Raises: '%{binding} %{must} lanzar excepciones'
|
|
158
|
+
Rescues_except: '%{binding} %{must} capturar excepciones diferentes a %{target}'
|
|
159
|
+
Rescues_like: '%{binding} %{must} capturar excepciones parecidas a %{target}'
|
|
160
|
+
Rescues_named: '%{binding} %{must} capturar %{target}'
|
|
161
|
+
Rescues: '%{binding} %{must} capturar excepciones'
|
|
162
|
+
Returns: '%{binding} %{must} retornar%{matching}'
|
|
163
|
+
ReturnsNil: '%{binding} retorna null, lo cual es una mala práctica'
|
|
164
|
+
ReturnsNull: '%{binding} retorna null, lo cual es una mala práctica'
|
|
165
|
+
SourceContains_named: 'la solución %{must} usar %{target}'
|
|
166
|
+
SourceEquals_named: 'la solución %{must} ser igual a %{target}'
|
|
167
|
+
SourceEqualsIgnoreSpaces_named: 'la solución %{must} ser igual a %{target}'
|
|
168
|
+
SourceRepeats_named: 'la solución %{must} usar %{target} más de una vez'
|
|
169
|
+
TypesAs_named: '%{binding} %{must} ser de tipo %{target}'
|
|
170
|
+
TypesAs: '%{binding} %{must} tipar'
|
|
171
|
+
TypesParameterAs_except: '%{binding} %{must} tipar parámetros con un tipo diferente a %{target}'
|
|
172
|
+
TypesParameterAs_like: '%{binding} %{must} tipar parámetros con un tipo parecido a %{target}'
|
|
173
|
+
TypesParameterAs_named: '%{binding} %{must} tipar parámetros con el tipo %{target}'
|
|
174
|
+
TypesParameterAs: '%{binding} %{must} tipar parámetros'
|
|
175
|
+
TypesReturnAs_named: '%{binding} %{must} tipar su valor de retorno como %{target}'
|
|
176
|
+
TypesReturnAs: '%{binding} %{must} tipar su valor de retorno'
|
|
177
|
+
Uses_except: '%{binding} %{must} delegar en algo diferente a %{target}'
|
|
178
|
+
Uses_like: '%{binding} %{must} delegar en algo parecido a %{target}'
|
|
179
|
+
Uses_named: '%{binding} %{must} utilizar %{target}'
|
|
180
|
+
Uses: '%{binding} %{must} delegar'
|
|
181
|
+
UsesAnonymousVariable: '%{binding} %{must} utilizar una variable anónima'
|
|
182
|
+
UsesComposition: '%{binding} %{must} usar composición'
|
|
183
|
+
UsesComprehension: '%{binding} %{must} emplear listas por comprensión'
|
|
184
|
+
UsesConditional: '%{binding} %{must} utilizar condicionales'
|
|
185
|
+
UsesCut: '%{binding} usa el operador !, lo cual es una mala práctica'
|
|
186
|
+
UsesDyamicPolymorphism: '%{binding} %{must} usar polimorfismo'
|
|
187
|
+
UsesDynamicMethodOverload: '%{binding} %{must} usar sobrecarga'
|
|
188
|
+
UsesExceptionHandling: '%{binding} %{must} realizar manejo de excepciones'
|
|
189
|
+
UsesExceptions: '%{binding} %{must} usar excepciones'
|
|
190
|
+
UsesFail: '%{binding} usa <i>%{keyword_fail}</li>, lo cual es una mala práctica'
|
|
191
|
+
UsesFindall: '%{binding} %{must} utilizar <i>%{keyword_findall}</i>'
|
|
192
|
+
UsesForall: '%{binding} %{must} utilizar <i>%{keyword_forall}</i>'
|
|
193
|
+
UsesForeach: '%{binding} %{must} usar <i>%{keyword_foreach}</i>%{matching}'
|
|
194
|
+
UsesForLoop: '%{binding} %{must} usar <i>%{keyword_for}</i>%{matching}'
|
|
195
|
+
UsesGuards: '%{binding} %{must} usar guardas%{matching}'
|
|
196
|
+
UsesIf: '%{binding} %{must} usar <i>%{keyword_if}</i>%{matching}'
|
|
197
|
+
UsesInheritance: '%{binding} %{must} usar herencia'
|
|
198
|
+
UsesLambda: '%{binding} %{must} emplear expresiones lambda%{matching}'
|
|
199
|
+
UsesLogic: '%{binding} %{must} usar expresiones booleanas'
|
|
200
|
+
UsesLoop: '%{binding} %{must} usar un bucle'
|
|
201
|
+
UsesMath: '%{binding} %{must} usar expresiones matemáticas'
|
|
202
|
+
UsesMixin: '%{binding} %{must} utilizar mixins'
|
|
203
|
+
UsesMixins: '%{binding} %{must} usar mixins'
|
|
204
|
+
UsesNot: '%{binding} %{must} utilizar <i>%{keyword_not}</i>'
|
|
205
|
+
UsesObjectComposition: '%{binding} %{must} usar composición'
|
|
206
|
+
UsesPatternMatching: '%{binding} %{must} utilizar pattern matching'
|
|
207
|
+
UsesRepeat: '%{binding} %{must} usar <i>%{keyword_repeat}</i>%{matching}'
|
|
208
|
+
UsesRepeatOf: '%{binding} %{must} usar un <i>%{keyword_repeat}</i> de %{target}'
|
|
209
|
+
UsesStaticMethodOverload: '%{binding} %{must} usar sobrecarga'
|
|
210
|
+
UsesStaticPolymorphism: '%{binding} %{must} usar polimorfismo'
|
|
211
|
+
UsesSwitch: '%{binding} %{must} utilizar un <i>%{keyword_switch}</i>'
|
|
212
|
+
UsesTemplateMethod: '%{binding} %{must} usar un método plantilla'
|
|
213
|
+
UsesUnificationOperator: '%{binding} usa el operador de unificación (=)'
|
|
214
|
+
UsesWhile: '%{binding} %{must} utilizar un <i>%{keyword_while}</i>'
|
|
215
|
+
UsesYield: '%{binding} %{must} utilizar un <i>%{keyword_yield}</i>'
|
data/lib/locales/pt.yml
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
pt:
|
|
3
|
+
mulang:
|
|
4
|
+
expectation:
|
|
5
|
+
must_not: 'não deve'
|
|
6
|
+
must: 'deve'
|
|
7
|
+
solution: 'a solução'
|
|
8
|
+
with_char: ' com o caractere <i>%{value}</i>'
|
|
9
|
+
with_false: ' com o valor <i>%{keyword_false}</i>'
|
|
10
|
+
with_literal: ' com um valor literal'
|
|
11
|
+
with_logic: ' com uma expressão booleana'
|
|
12
|
+
with_math: ' com uma expressão matemática'
|
|
13
|
+
with_nil: ' com <i>%{keyword_nil}</i>'
|
|
14
|
+
with_nonliteral: ' com uma expressão não literal'
|
|
15
|
+
with_number: ' com o número <i>%{value}</i>'
|
|
16
|
+
with_string: ' com a string <i>%{value}</i>'
|
|
17
|
+
with_symbol: ' com o símbolo <i>%{value}</i>'
|
|
18
|
+
with_true: ' com o valor <i>%{keyword_true}</i>'
|
|
19
|
+
inspection:
|
|
20
|
+
Assigns_except: '%{binding} %{must} atribuir algo diferente a %{target}%{matching}'
|
|
21
|
+
Assigns_like: '%{binding} %{must} atribuir algo semelhante ao %{target}%{matching}'
|
|
22
|
+
Assigns_named: '%{binding} %{must} atribuir %{target}%{matching}'
|
|
23
|
+
Assigns: '%{binding} %{must} fazer atribuições%{matching}'
|
|
24
|
+
Calls_except: '%{binding} %{must} delegar algo diferente para %{target}%{matching}'
|
|
25
|
+
Calls_like: '%{binding} %{must} delegar algo semelhante ao %{target}%{matching}'
|
|
26
|
+
Calls_named: '%{binding} %{must} usar %{target}%{matching}'
|
|
27
|
+
Calls: '%{binding} %{must} delegate%{matching}'
|
|
28
|
+
Declares_except: '%{binding} %{must} contém instruções diferentes de %{target}'
|
|
29
|
+
Declares_like: '%{binding} %{must} declarar um identificador semelhante a %{target}'
|
|
30
|
+
Declares_named: '%{binding} %{must} declarar %{target}'
|
|
31
|
+
Declares: '%{binding} %{must} contém declarações'
|
|
32
|
+
DeclaresAttribute_except: '%{binding} %{must} declarar atributos diferentes de %{target}%{matching}'
|
|
33
|
+
DeclaresAttribute_like: '%{binding} %{must} declarar um atributo semelhante a %{target}%{matching}'
|
|
34
|
+
DeclaresAttribute_named: '%{binding} %{must} declarar um atributo %{target}%{matching}'
|
|
35
|
+
DeclaresAttribute: '%{binding} %{must} declarar atributos%{matching}'
|
|
36
|
+
DeclaresClass_except: '%{binding} %{must} declarar classes diferentes para %{target}'
|
|
37
|
+
DeclaresClass_like: '%{binding} %{must} declarar uma classe semelhante a %{target}'
|
|
38
|
+
DeclaresClass_named: '%{binding} %{must} declarar uma classe %{target}'
|
|
39
|
+
DeclaresClass: '%{binding} %{must} declarar classes'
|
|
40
|
+
DeclaresComputation_except: '%{binding} %{must} declarar cálculos diferentes de %{target}'
|
|
41
|
+
DeclaresComputation_like: '%{binding} %{must} declarar uma computação semelhante a %{target}'
|
|
42
|
+
DeclaresComputation_named: '%{binding} %{must} declarar uma computação %{target}'
|
|
43
|
+
DeclaresComputation: '%{binding} %{must} declarar cálculos'
|
|
44
|
+
DeclaresComputationWithArity0_named: '%{target} %{must} declarar parâmetros zero'
|
|
45
|
+
DeclaresComputationWithArity1_named: '%{target} %{must} tem um parâmetro'
|
|
46
|
+
DeclaresComputationWithArity2_named: '%{target} %{must} tem dois parâmetros'
|
|
47
|
+
DeclaresComputationWithArity3_named: '%{target} %{must} tem três parâmetros'
|
|
48
|
+
DeclaresComputationWithArity4_named: '%{target} %{must} tem quatro parâmetros'
|
|
49
|
+
DeclaresComputationWithArity5_named: '%{target} %{must} tem cinco parâmetros'
|
|
50
|
+
DeclaresEntryPoint: '%{binding} %{must} declarar um ponto de entrada%{matching}'
|
|
51
|
+
DeclaresEnumeration_except: '%{binding} %{must} declarar enumerações que não são chamadas %{target}'
|
|
52
|
+
DeclaresEnumeration_like: '%{binding} %{must} declarar uma enumeração de nome semelhante a %{target}'
|
|
53
|
+
DeclaresEnumeration_named: '%{binding} %{must} declarar uma enumeração %{target}'
|
|
54
|
+
DeclaresEnumeration: '%{binding} %{must} declarar enumerações'
|
|
55
|
+
DeclaresFact_except: '%{binding} %{must} declarar fatos diferentes de %{target}'
|
|
56
|
+
DeclaresFact_like: '%{binding} %{must} declarar um fato semelhante a %{target}'
|
|
57
|
+
DeclaresFact_named: '%{binding} %{must} declarar um fato %{target}'
|
|
58
|
+
DeclaresFact: '%{binding} %{must} declarar fatos'
|
|
59
|
+
DeclaresFunction_except: '%{binding} %{must} declarar funções diferentes de %{target}%{matching}'
|
|
60
|
+
DeclaresFunction_like: '%{binding} %{must} declarar uma função semelhante a %{target}%{matching}'
|
|
61
|
+
DeclaresFunction_named: '%{binding} %{must} declarar uma função %{target}%{matching}'
|
|
62
|
+
DeclaresFunction: '%{binding} %{must} deve declarar funções%{matching}'
|
|
63
|
+
DeclaresInterface_except: '%{binding} %{must} declarar interfaces que não são chamadas %{target}%{matching}'
|
|
64
|
+
DeclaresInterface_like: '%{binding} %{must} declarar uma interface de nome semelhante a %{target}%{matching}'
|
|
65
|
+
DeclaresInterface_named: '%{binding} %{must} declarar uma interface %{target}%{matching}'
|
|
66
|
+
DeclaresInterface: '%{binding} %{must} declarar interfaces%{matching}'
|
|
67
|
+
DeclaresMethod_except: '%{binding} %{must} declarar métodos diferentes de %{target}%{matching}'
|
|
68
|
+
DeclaresMethod_like: '%{binding} %{must} declarar um método semelhante a %{target}%{matching}'
|
|
69
|
+
DeclaresMethod_named: '%{binding} %{must} declarar um método %{target}%{matching}'
|
|
70
|
+
DeclaresMethod: '%{binding} %{must} declarar métodos%{matching}'
|
|
71
|
+
DeclaresObject_except: '%{binding} %{must} declarar objetos diferentes de %{target}%{matching}'
|
|
72
|
+
DeclaresObject_like: '%{binding} %{must} declarar um objeto semelhante a %{target}%{matching}'
|
|
73
|
+
DeclaresObject_named: '%{binding} %{must} declarar um objeto %{target}%{matching}'
|
|
74
|
+
DeclaresObject: '%{binding} %{must} declarar objetos%{matching}'
|
|
75
|
+
DeclaresPredicate_except: '%{binding} %{must} declarar predicados diferentes para %{target}%{matching}'
|
|
76
|
+
DeclaresPredicate_like: '%{binding} %{must} declarar um predicado semelhante ao %{target}%{matching}'
|
|
77
|
+
DeclaresPredicate_named: '%{binding} %{must} declarar um predicado %{target}%{matching}'
|
|
78
|
+
DeclaresPredicate: '%{binding} %{must} declarar predicados%{matching}'
|
|
79
|
+
DeclaresProcedure_except: '%{binding} %{must} declarar procedimentos diferentes de %{target}%{matching}'
|
|
80
|
+
DeclaresProcedure_like: '%{binding} %{must} declarar um procedimento semelhante a %{target}%{matching}'
|
|
81
|
+
DeclaresProcedure_named: '%{binding} %{must} declarar um procedimento %{target}%{matching}'
|
|
82
|
+
DeclaresProcedure: '%{binding} %{must} declarar procedimentos%{matching}'
|
|
83
|
+
DeclaresRecursively_named: '%{target} %{must} deve ser declarado recursivamente'
|
|
84
|
+
DeclaresRule_except: '%{binding} %{must} declarar regras diferentes de %{target}'
|
|
85
|
+
DeclaresRule_like: '%{binding} %{must} declarar uma regra semelhante a %{target}'
|
|
86
|
+
DeclaresRule_named: '%{binding} %{must} declarar uma regra %{target}'
|
|
87
|
+
DeclaresRule: '%{binding} %{must} deve declarar regras'
|
|
88
|
+
DeclaresStyle_except: '%{binding} %{must} declarar um estilo diferentes de %{target}'
|
|
89
|
+
DeclaresStyle_like: '%{binding} %{must} declarar um estilo semelhante a %{target}'
|
|
90
|
+
DeclaresStyle_named: '%{binding} %{must} declarar um estilo %{target}'
|
|
91
|
+
DeclaresStyle: '%{binding} %{must} declarar um estilo'
|
|
92
|
+
DeclaresSuperclass_except: '%{binding} %{must} declarar uma superclasse diferente de %{target}'
|
|
93
|
+
DeclaresSuperclass_like: '%{binding} %{must} declarar uma superclasse semelhante a %{target}'
|
|
94
|
+
DeclaresSuperclass_named: '%{binding} %{must} declarar uma superclasse %{target}'
|
|
95
|
+
DeclaresSuperclass: '%{binding} %{must} declarar uma superclasse'
|
|
96
|
+
DeclaresTag_except: '%{binding} %{must} declarar uma etiqueta diferente de %{target}'
|
|
97
|
+
DeclaresTag_like: '%{binding} %{must} declarar uma etiqueta similar a %{target}'
|
|
98
|
+
DeclaresTag_named: '%{binding} %{must} declarar uma etiqueta %{target}'
|
|
99
|
+
DeclaresTag: '%{binding} %{must} declarar uma etiqueta'
|
|
100
|
+
DeclaresTypeAlias_except: '%{binding} %{must} declarar sinônimos de tipo diferente de %{target}'
|
|
101
|
+
DeclaresTypeAlias_like: '%{binding} %{must} declarar um sinônimo de tipo similar a %{target}'
|
|
102
|
+
DeclaresTypeAlias_named: '%{binding} %{must} declarar um sinônimo do tipo %{target}'
|
|
103
|
+
DeclaresTypeAlias: '%{binding} %{must} declarar o tipo de sinônimos'
|
|
104
|
+
DeclaresTypeSignature_except: '%{binding} %{must} declarar assinaturas de tipos diferentes de %{target}'
|
|
105
|
+
DeclaresTypeSignature_like: '%{binding} %{must} declarar uma assinatura para algo semelhante %{target}'
|
|
106
|
+
DeclaresTypeSignature_named: '%{binding} %{must} declarar uma assinatura %{target}'
|
|
107
|
+
DeclaresTypeSignature: '%{binding} %{must} excluir assinaturas de tipo'
|
|
108
|
+
DeclaresVariable_except: '%{binding} %{must} declarar variáveis diferentes de %{target}%{matching}'
|
|
109
|
+
DeclaresVariable_like: '%{binding} %{must} declarar uma variável semelhante a %{target}%{matching}'
|
|
110
|
+
DeclaresVariable_named: '%{binding} %{must} declarar uma variável %{target}%{matching}'
|
|
111
|
+
DeclaresVariable: '%{binding} %{must} deve declarar variáveis%{matching}'
|
|
112
|
+
DiscardsExceptions: '%{binding} está silenciosamente ignorando exceções'
|
|
113
|
+
DoesConsolePrint: '%{binding} está fazendo impressões na tela'
|
|
114
|
+
DoesNilTest: '%{binding} faz comparações contra <i>%{keyword_null}</i>'
|
|
115
|
+
DoesNullTest: '%{binding} faz comparações contra <i>%{keyword_null}</i>'
|
|
116
|
+
DoesTypeTest: '%{binding} faz comparações contra strings'
|
|
117
|
+
HasAssignmentReturn: '%{binding} retorna o resultado de uma tarefa'
|
|
118
|
+
HasCodeDuplication: '%{binding} tem código repetido'
|
|
119
|
+
HasEmptyIfBranches: '%{binding} tem vazio <i>%{keyword_if}</i> ramos'
|
|
120
|
+
HasLongParameterList: '%{binding} tem muitos parâmetros. Você pode estar perdendo uma abstração.'
|
|
121
|
+
HasMisspelledBindings: '%{binding} está incorreto. Verifique a ortografia e tente não usar abreviaturas'
|
|
122
|
+
HasMisspelledIdentifiers: '%{binding} está incorreto. Verifique a ortografia e tente não usar abreviaturas'
|
|
123
|
+
HasRedundantBooleanComparison: '%{binding} faz comparações booleanas desnecessárias'
|
|
124
|
+
HasRedundantGuards: '%{binding} possui protetores desnecessários'
|
|
125
|
+
HasRedundantIf: '%{binding} tem desnecessário ifs'
|
|
126
|
+
HasRedundantLambda: '%{binding} possui lambdas desnecessários'
|
|
127
|
+
HasRedundantLocalVariableReturn: '%{binding} usa variáveis locais desnecessárias; você pode retornar a expressão diretamente'
|
|
128
|
+
HasRedundantParameter: '%{binding} possui parâmetros desnecessários (pode ser removido por ponto-livre)'
|
|
129
|
+
HasRedundantReduction: '%{binding} usa <i>%{keyword_is}</i>, mas não executa cálculos'
|
|
130
|
+
HasTooManyMethods: '%{binding} tem muitos métodos'
|
|
131
|
+
HasTooShortBindings: '%{binding} é um identificador muito curto'
|
|
132
|
+
HasTooShortIdentifiers: '%{binding} é um identificador muito curto'
|
|
133
|
+
HasUnreachableCode: '%{binding} tem código inacessível'
|
|
134
|
+
HasWrongCaseBindings: '%{binding} não respeita a convenção de nomenclatura'
|
|
135
|
+
HasWrongCaseIdentifiers: '%{binding} não respeita a convenção de nomenclatura'
|
|
136
|
+
Implements_except: '%{binding} %{must} implementar interfaces diferentes de %{target}'
|
|
137
|
+
Implements_like: '%{binding} %{must} implementar interfaces semelhantes a %{target}'
|
|
138
|
+
Implements_named: '%{binding} %{must} implementar %{target}'
|
|
139
|
+
Implements: '%{binding} %{must} implementar interfaces'
|
|
140
|
+
Inherits_except: '%{binding} %{must} declarar uma superclasse diferente de %{target}'
|
|
141
|
+
Inherits_like: '%{binding} %{must} declarar uma superclasse semelhante a %{target}'
|
|
142
|
+
Inherits_named: '%{binding} %{must} declarar uma superclasse %{target}'
|
|
143
|
+
Inherits: '%{binding} %{must} declarar uma superclasse'
|
|
144
|
+
Instantiates_except: '%{binding} %{must} instanciar classes diferentes de %{target}'
|
|
145
|
+
Instantiates_like: '%{binding} %{must} instanciar classes semelhantes a %{target}'
|
|
146
|
+
Instantiates_named: '%{binding} %{must} instantiate %{target}'
|
|
147
|
+
Instantiates: '%{binding} %{must} instanciar objetos'
|
|
148
|
+
IsLongCode: '%{binding} é muito longo. Tente delegar mais'
|
|
149
|
+
OverridesEqualOrHashButNotBoth: '%{binding} redefine os métodos <i>equals</i> ou <i>hash </i>, mas não ambos'
|
|
150
|
+
Raises_except: '%{binding} %{must} lançar exceções diferentes de %{target}'
|
|
151
|
+
Raises_like: '%{binding} %{must} lançar exceções semelhantes a %{target}'
|
|
152
|
+
Raises_named: '%{binding} %{must} launch %{target}'
|
|
153
|
+
Raises: '%{binding} %{must} lançar exceções'
|
|
154
|
+
Rescues_except: '%{binding} %{must} capturar exceções que não sejam %{target}'
|
|
155
|
+
Rescues_like: '%{binding} %{must} capturar exceções semelhantes a %{target}'
|
|
156
|
+
Rescues_named: '%{binding} %{must} capture %{target}'
|
|
157
|
+
Rescues: '%{binding} %{must} capturar exceções'
|
|
158
|
+
Returns: '%{binding} %{must} retornar%{matching}'
|
|
159
|
+
ReturnsNil: '%{binding} retorna nulo, o que é uma prática ruim'
|
|
160
|
+
ReturnsNull: '%{binding} retorna nulo, o que é uma prática ruim'
|
|
161
|
+
SourceContains_named: 'a solução %{must} usar %{target}'
|
|
162
|
+
SourceEquals_named: 'a solução %{must} ser igual a %{target}'
|
|
163
|
+
SourceEqualsIgnoreSpaces_named: 'a solução %{must} ser igual a %{target}'
|
|
164
|
+
SourceRepeats_named: 'a solução %{must} usar %{target} mais de uma vez'
|
|
165
|
+
TypesAs_named: '%{binding} %{must} é do tipo %{target}'
|
|
166
|
+
TypesAs: '%{binding} %{must} tem tipo'
|
|
167
|
+
TypesReturnAs_named: '%{binding} %{must} tem tipo de valor de retorno %{target}'
|
|
168
|
+
TypesReturnAs: '%{binding} %{must} tem tipo de valor de retorno'
|
|
169
|
+
Uses_except: '%{binding} %{must} delegar algo diferente para %{target}'
|
|
170
|
+
Uses_like: '%{binding} %{must} delegar algo semelhante ao %{target}'
|
|
171
|
+
Uses_named: '%{binding} %{must} usar %{target}'
|
|
172
|
+
Uses: '%{binding} %{must} delegar'
|
|
173
|
+
UsesAnonymousVariable: '%{binding} %{must} usar uma variável anônima'
|
|
174
|
+
UsesComposition: '%{binding} %{must} usar a composição'
|
|
175
|
+
UsesComprehension: '%{binding} %{must} usar listas pelo entendimento'
|
|
176
|
+
UsesConditional: '%{binding} %{must} usar conditional'
|
|
177
|
+
UsesCut: '%{binding} usa o operador !, que é uma má prática'
|
|
178
|
+
UsesDyamicPolymorphism: '%{binding} %{must} usar polimorfismo'
|
|
179
|
+
UsesDynamicMethodOverload: '%{binding} %{must} usar sobrecarga'
|
|
180
|
+
UsesExceptionHandling: '%{binding} %{must} executar o tratamento de exceção'
|
|
181
|
+
UsesExceptions: '%{binding} %{must} usar exceções'
|
|
182
|
+
UsesFail: '%{binding} usa <i>%{keyword_fail}</li>, o que é uma prática ruim'
|
|
183
|
+
UsesFindall: '%{binding} %{must} usar <i>%{keyword_findall}</i>'
|
|
184
|
+
UsesForall: '%{binding} %{must} usar <i>%{keyword_forall}</i>'
|
|
185
|
+
UsesFor: '%{binding} %{must} usar <i>%{keyword_for}</i>%{matching}'
|
|
186
|
+
UsesForeach: '%{binding} %{must} usar <i>%{keyword_foreach}</i>%{matching}'
|
|
187
|
+
UsesGuards: '%{binding} %{must} usar guardas%{matching}'
|
|
188
|
+
UsesIf: '%{binding} %{must} usar <i>%{keyword_if}</i>%{matching}'
|
|
189
|
+
UsesInheritance: '%{binding} %{must} usar herança'
|
|
190
|
+
UsesLambda: '%{binding} %{must} usar expressões lambda%{matching}'
|
|
191
|
+
UsesLoop: '%{binding} %{must} usar um loop%{matching}'
|
|
192
|
+
UsesLogic: '%{binding} %{must} usar expressões booleanas'
|
|
193
|
+
UsesMath: '%{binding} %{must} usar expressões matemáticas'
|
|
194
|
+
UsesMixins: '%{binding} %{must} usar mixins'
|
|
195
|
+
UsesNot: '%{binding} %{must} usar <i>%{keyword_not}</i>'
|
|
196
|
+
UsesObjectComposition: '%{binding} %{must} usar composição'
|
|
197
|
+
UsesPatternMatching: '%{binding} %{must} usar o padrão de correspondência'
|
|
198
|
+
UsesRepeat: '%{binding} %{must} usar <i>%{keyword_repeat}</i>%{matching}'
|
|
199
|
+
UsesRepeatOf: '%{binding} %{must} usar uma <i>%{keyword_repeat}</i> de %{target}'
|
|
200
|
+
UsesStaticMethodOverload: '%{binding} %{must} usar sobrecarga'
|
|
201
|
+
UsesStaticPolymorphism: '%{binding} %{must} usar polimorfismo'
|
|
202
|
+
UsesSwitch: '%{binding} %{must} usar um <i>%{keyword_switch}</i>'
|
|
203
|
+
UsesTemplateMethod: '%{binding} %{must} usar um _template method_'
|
|
204
|
+
UsesUnificationOperator: '%{binding} usa o operador de unificação (=)'
|
|
205
|
+
UsesWhile: '%{binding} %{must} usar um <i>%{keyword_while}</i>%{matching}'
|
data/lib/mulang.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'mumukit/core'
|
|
2
2
|
require 'open3'
|
|
3
3
|
|
|
4
4
|
require_relative './mulang/version'
|
|
5
5
|
|
|
6
|
+
I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
|
|
7
|
+
|
|
6
8
|
module Mulang
|
|
7
9
|
def self.bin_path
|
|
8
10
|
File.join(__dir__, '..', 'bin', 'mulang')
|
|
@@ -16,5 +18,7 @@ module Mulang
|
|
|
16
18
|
end
|
|
17
19
|
end
|
|
18
20
|
|
|
21
|
+
require_relative './mulang/inspection'
|
|
22
|
+
require_relative './mulang/expectation'
|
|
19
23
|
require_relative './mulang/code'
|
|
20
24
|
require_relative './mulang/language'
|
data/lib/mulang/code.rb
CHANGED
|
@@ -21,10 +21,29 @@ module Mulang
|
|
|
21
21
|
Mulang.analyse analysis(spec)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
def expect(binding='*', inspection)
|
|
25
|
+
expectation = {binding: binding, inspection: inspection}
|
|
26
|
+
Mulang::Expectation.parse expectation
|
|
27
|
+
expectation_results_for(analyse(expectations: [expectation])).first['result']
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def custom_expect(edl)
|
|
31
|
+
expectation_results_for(analyse(customExpectations: edl))
|
|
32
|
+
.map { |e| [e['expectation']['inspection'], e['result']] }
|
|
33
|
+
.to_h
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
alias query expect
|
|
37
|
+
alias custom_query custom_expect
|
|
38
|
+
|
|
24
39
|
def self.native(language_name, content)
|
|
25
40
|
new Mulang::Language::Native.new(language_name), content
|
|
26
41
|
end
|
|
27
42
|
|
|
43
|
+
def self.native!(*args)
|
|
44
|
+
native(*args).tap { |it| it.expect('Parses') }
|
|
45
|
+
end
|
|
46
|
+
|
|
28
47
|
def self.external(content, &tool)
|
|
29
48
|
new Mulang::Language::External.new(&tool), content
|
|
30
49
|
end
|
|
@@ -32,5 +51,12 @@ module Mulang
|
|
|
32
51
|
def self.ast(ast)
|
|
33
52
|
new Mulang::Language::External.new, ast
|
|
34
53
|
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def expectation_results_for(result)
|
|
58
|
+
raise result['reason'] if result['tag'] == 'AnalysisFailed'
|
|
59
|
+
result['expectationResults']
|
|
60
|
+
end
|
|
35
61
|
end
|
|
36
62
|
end
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
class Mulang::Expectation
|
|
2
|
+
|
|
3
|
+
SMELLS = %w(DiscardsExceptions DoesConsolePrint DoesNilTest DoesNullTest DoesTypeTest
|
|
4
|
+
HasAssignmentReturn HasCodeDuplication HasEmptyIfBranches HasLongParameterList
|
|
5
|
+
HasMisspelledBindings HasMisspelledIdentifiers
|
|
6
|
+
HasRedundantBooleanComparison HasRedundantGuards HasRedundantIf
|
|
7
|
+
HasRedundantLambda HasRedundantLocalVariableReturn HasRedundantParameter
|
|
8
|
+
HasRedundantReduction HasTooManyMethods HasTooShortBindings HasTooShortIdentifiers HasUnreachableCode
|
|
9
|
+
HasWrongCaseBinding HasWrongCaseIdentifiers IsLongCode OverridesEqualOrHashButNotBoth
|
|
10
|
+
ReturnsNil ReturnsNull UsesCut UsesFail UsesUnificationOperator)
|
|
11
|
+
|
|
12
|
+
attr_accessor :binding, :inspection
|
|
13
|
+
|
|
14
|
+
def initialize(binding, inspection)
|
|
15
|
+
@binding = binding
|
|
16
|
+
@inspection = inspection
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def check!
|
|
20
|
+
raise "Wrong binding in #{to_h}" unless binding?
|
|
21
|
+
raise "Wrong inspection #{to_h}" unless inspection?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def translate(keywords = nil)
|
|
25
|
+
Mulang::Expectation::I18n.translate self, keywords
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def to_h
|
|
29
|
+
{binding: binding, inspection: inspection.to_s}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.guess_type(expectation)
|
|
33
|
+
if expectation[:inspection] =~ /(Not\:)?Has.*/ && !has_smell?(expectation[:inspection])
|
|
34
|
+
V0
|
|
35
|
+
else
|
|
36
|
+
V2
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.has_smell?(smell)
|
|
41
|
+
SMELLS.include? smell
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.parse(expectation)
|
|
45
|
+
guess_type(expectation).new(
|
|
46
|
+
expectation[:binding],
|
|
47
|
+
Mulang::Inspection.parse(expectation[:inspection]))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.valid?(expectation)
|
|
51
|
+
!!Mulang::Inspection.parse(expectation['inspection']) rescue false
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class V0 < Mulang::Expectation
|
|
55
|
+
INSPECTIONS = %w(HasBinding HasTypeDeclaration HasTypeSignature HasVariable HasArity HasDirectRecursion
|
|
56
|
+
HasComposition HasComprehension HasForeach HasIf HasGuards HasConditional HasLambda HasRepeat HasWhile
|
|
57
|
+
HasUsage HasAnonymousVariable HasNot HasForall HasFindall)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def binding?
|
|
61
|
+
binding.present?
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def inspection?
|
|
65
|
+
inspection.present? && INSPECTIONS.include?(inspection.type)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def as_v2
|
|
69
|
+
if has? 'Binding' then as_v2_declare ''
|
|
70
|
+
elsif has? 'TypeDeclaration' then as_v2_declare 'TypeAlias'
|
|
71
|
+
elsif has? 'TypeSignature' then as_v2_declare 'TypeSignature'
|
|
72
|
+
elsif has? 'Variable' then as_v2_declare 'Variable'
|
|
73
|
+
elsif has? 'Arity' then as_v2_declare "ComputationWithArity#{inspection.target.value}"
|
|
74
|
+
elsif has? 'DirectRecursion' then as_v2_declare "Recursively"
|
|
75
|
+
elsif has? 'Usage'
|
|
76
|
+
V2.new binding, new_inspection('Uses', Mulang::Inspection::Target.named(inspection.target.value))
|
|
77
|
+
else as_v2_use
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def has?(simple_type)
|
|
82
|
+
inspection.type == "Has#{simple_type}"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def as_v2_use
|
|
86
|
+
V2.new binding, new_inspection(inspection.type.gsub('Has', 'Uses'), nil)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def as_v2_declare(simple_type)
|
|
90
|
+
V2.new '*', new_inspection("Declares#{simple_type}", Mulang::Inspection::Target.named(binding))
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def new_inspection(type, target)
|
|
94
|
+
Mulang::Inspection.new(type, target, negated: inspection.negated?)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class V2 < Mulang::Expectation
|
|
99
|
+
def binding?
|
|
100
|
+
true
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def inspection?
|
|
104
|
+
true
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def as_v2
|
|
108
|
+
self
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
require_relative './expectation/i18n'
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
module Mulang::Expectation::I18n
|
|
2
|
+
class << self
|
|
3
|
+
DEFAULT_KEYWORDS = {
|
|
4
|
+
keyword_fail: :fail,
|
|
5
|
+
keyword_false: :false,
|
|
6
|
+
keyword_findall: :findall,
|
|
7
|
+
keyword_for: :for,
|
|
8
|
+
keyword_forall: :forall,
|
|
9
|
+
keyword_foreach: :foreach,
|
|
10
|
+
keyword_if: :if,
|
|
11
|
+
keyword_is: :is,
|
|
12
|
+
keyword_not: :not,
|
|
13
|
+
keyword_null: :null,
|
|
14
|
+
keyword_repeat: :repeat,
|
|
15
|
+
keyword_switch: :switch,
|
|
16
|
+
keyword_true: :true,
|
|
17
|
+
keyword_while: :while,
|
|
18
|
+
keyword_yield: :yield
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
def translate(e, keywords = nil)
|
|
22
|
+
e = e.as_v2
|
|
23
|
+
key = key_for e.binding, e.inspection
|
|
24
|
+
::I18n.t key, translation_params(e, keywords)
|
|
25
|
+
rescue
|
|
26
|
+
'<unknown expectation>'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
alias t translate
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def translation_params(e, keywords)
|
|
34
|
+
with_keywords keywords,
|
|
35
|
+
binding: t_binding(e.binding),
|
|
36
|
+
target: t_target(e.inspection),
|
|
37
|
+
must: t_must(e.inspection),
|
|
38
|
+
matching: t_matching(keywords, e.inspection)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def key_for(binding, inspection)
|
|
42
|
+
"mulang.inspection.#{inspection.type}#{inspection.target ? inspection.target.i18n_suffix : nil}"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def t_binding(binding)
|
|
46
|
+
binding == '*' ? ::I18n.t("mulang.expectation.solution") : "<strong>#{Mulang::Inspection.parse_binding_name binding}</strong>"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def t_must(parsed)
|
|
50
|
+
::I18n.t("mulang.expectation.#{parsed.negated? ? 'must_not' : 'must' }")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def t_target(parsed)
|
|
54
|
+
"<strong>#{parsed.target.value}</strong>" if parsed.target
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def t_matching(keywords, parsed)
|
|
58
|
+
::I18n.t("mulang.expectation.#{parsed.matcher.type}", with_keywords(keywords, value: parsed.matcher.value)) if parsed.matcher
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def with_keywords(keywords, params)
|
|
62
|
+
params.merge(DEFAULT_KEYWORDS).merge(keywords || {})
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module Mulang
|
|
2
|
+
class Inspection
|
|
3
|
+
module Compacted
|
|
4
|
+
def as_json(*args)
|
|
5
|
+
super(*args).compact
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
include Mulang::Inspection::Compacted
|
|
10
|
+
|
|
11
|
+
REGEXP = Regexp.new %q{
|
|
12
|
+
^(?<negation>Not:)?
|
|
13
|
+
(?<type>[^:]+)
|
|
14
|
+
(
|
|
15
|
+
:(?<matcher>WithLiteral|WithNonliteral|WithLogic|WithMath|WithFalse|WithNil|WithTrue) |
|
|
16
|
+
:(?<matcher>WithChar|WithNumber|WithString|WithSymbol):(?<value>[^:]+) |
|
|
17
|
+
:(?<target>[^:]+)(:(?<matcher>[^:]+)(:(?<value>[^:]+))?)?
|
|
18
|
+
)?$}.gsub(/\s/, '')
|
|
19
|
+
|
|
20
|
+
attr_accessor :type, :target, :matcher, :negated
|
|
21
|
+
alias negated? negated
|
|
22
|
+
|
|
23
|
+
def initialize(type, target, negated: false, matcher: nil)
|
|
24
|
+
@type = type
|
|
25
|
+
@target = target
|
|
26
|
+
@negated = negated
|
|
27
|
+
@matcher = matcher
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def to_s
|
|
31
|
+
"#{negated_to_s}#{type}#{target_to_s}"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def negated_to_s
|
|
35
|
+
negated ? 'Not:' : nil
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def target_to_s
|
|
39
|
+
target ? ":#{target.to_s}" : nil
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.parse_binding_name(binding_s)
|
|
43
|
+
if binding_s.start_with? 'Intransitive:'
|
|
44
|
+
binding_s[13..-1]
|
|
45
|
+
else
|
|
46
|
+
binding_s
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.parse(inspection_s)
|
|
51
|
+
match = REGEXP.match inspection_s
|
|
52
|
+
raise "Invalid inspection #{inspection_s}" unless match
|
|
53
|
+
Inspection.new(
|
|
54
|
+
match['type'],
|
|
55
|
+
Mulang::Inspection::Target.parse(match['target']),
|
|
56
|
+
matcher: Mulang::Inspection::Matcher.parse(match['matcher'], match['value']),
|
|
57
|
+
negated: match['negation'].present?)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
require_relative './inspection/target'
|
|
63
|
+
require_relative './inspection/matcher'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class Mulang::Inspection::Matcher
|
|
2
|
+
include Mulang::Inspection::Compacted
|
|
3
|
+
|
|
4
|
+
TYPES = %w(WithChar WithFalse WithLiteral WithLogic WithMath WithNil WithNonliteral WithNumber WithString WithSymbol WithTrue)
|
|
5
|
+
|
|
6
|
+
attr_accessor :type, :value
|
|
7
|
+
|
|
8
|
+
def initialize(type, value=nil)
|
|
9
|
+
@type = type
|
|
10
|
+
@value = value
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.parse(type, value)
|
|
14
|
+
return nil unless type
|
|
15
|
+
raise "Invalid matcher #{type}" unless type.in? TYPES
|
|
16
|
+
new type.underscore.to_sym, value
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
class Mulang::Inspection::Target
|
|
2
|
+
include Mulang::Inspection::Compacted
|
|
3
|
+
|
|
4
|
+
attr_accessor :type, :value
|
|
5
|
+
|
|
6
|
+
def initialize(type, value=nil)
|
|
7
|
+
@type = type
|
|
8
|
+
@value = value
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.parse(target_s)
|
|
12
|
+
if target_s.blank?
|
|
13
|
+
nil
|
|
14
|
+
elsif target_s == '*'
|
|
15
|
+
anyone
|
|
16
|
+
elsif target_s.start_with? '^'
|
|
17
|
+
new :except, target_tail(target_s)
|
|
18
|
+
elsif target_s.start_with? '~'
|
|
19
|
+
new :like, target_tail(target_s)
|
|
20
|
+
elsif target_s.start_with? '='
|
|
21
|
+
named target_tail(target_s)
|
|
22
|
+
else
|
|
23
|
+
unknown target_s
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def to_s
|
|
28
|
+
case type
|
|
29
|
+
when :anyone
|
|
30
|
+
'*'
|
|
31
|
+
when :except
|
|
32
|
+
"^#{value}"
|
|
33
|
+
when :like
|
|
34
|
+
"~#{value}"
|
|
35
|
+
when :named
|
|
36
|
+
"=#{value}"
|
|
37
|
+
else
|
|
38
|
+
value
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def i18n_suffix
|
|
43
|
+
case type
|
|
44
|
+
when :anyone
|
|
45
|
+
nil
|
|
46
|
+
when :except
|
|
47
|
+
"_except"
|
|
48
|
+
when :like
|
|
49
|
+
"_like"
|
|
50
|
+
else
|
|
51
|
+
"_named"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def self.target_tail(target_s)
|
|
56
|
+
target_s[1..-1]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def self.unknown(value)
|
|
60
|
+
new(:unknown, value)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def self.named(value)
|
|
64
|
+
new(:named, value)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def self.anyone
|
|
68
|
+
new(:anyone)
|
|
69
|
+
end
|
|
70
|
+
end
|
data/lib/mulang/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,29 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mulang
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.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: 2019-
|
|
11
|
+
date: 2019-09-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: mumukit-core
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">"
|
|
18
25
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.
|
|
26
|
+
version: '1.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: codeclimate-test-reporter
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
20
34
|
type: :development
|
|
21
35
|
prerelease: false
|
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
37
|
requirements:
|
|
24
|
-
- - "
|
|
38
|
+
- - ">="
|
|
25
39
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
40
|
+
version: '0'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: activesupport
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -76,8 +90,16 @@ files:
|
|
|
76
90
|
- bin/console
|
|
77
91
|
- bin/mulang
|
|
78
92
|
- bin/setup
|
|
93
|
+
- lib/locales/en.yml
|
|
94
|
+
- lib/locales/es.yml
|
|
95
|
+
- lib/locales/pt.yml
|
|
79
96
|
- lib/mulang.rb
|
|
80
97
|
- lib/mulang/code.rb
|
|
98
|
+
- lib/mulang/expectation.rb
|
|
99
|
+
- lib/mulang/expectation/i18n.rb
|
|
100
|
+
- lib/mulang/inspection.rb
|
|
101
|
+
- lib/mulang/inspection/matcher.rb
|
|
102
|
+
- lib/mulang/inspection/target.rb
|
|
81
103
|
- lib/mulang/language.rb
|
|
82
104
|
- lib/mulang/version.rb
|
|
83
105
|
homepage: https://github.com/mumuki/mulang
|
|
@@ -100,7 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
100
122
|
- !ruby/object:Gem::Version
|
|
101
123
|
version: '0'
|
|
102
124
|
requirements: []
|
|
103
|
-
|
|
125
|
+
rubyforge_project:
|
|
126
|
+
rubygems_version: 2.7.7
|
|
104
127
|
signing_key:
|
|
105
128
|
specification_version: 4
|
|
106
129
|
summary: Gem wrapper for mulang tool
|