mulang 6.0.3 → 6.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/mulang +0 -0
- data/lib/locales/en.yml +2 -1
- data/lib/locales/es.yml +2 -1
- data/lib/locales/pt.yml +3 -2
- data/lib/mulang/code.rb +2 -2
- data/lib/mulang/expectation.rb +5 -4
- data/lib/mulang/language.rb +28 -8
- data/lib/mulang/tokens.rb +5 -0
- 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: 2ddb55128fc13c6d0417645dbda78e8d640c03d78fa5d8a452ae28d486ef7e65
|
4
|
+
data.tar.gz: 300a187a694e85851e4fe740e85be180abb6367cd89907c4b81de67446afcf98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51f27bc26ed11c393979033f3ece7a40ad798fa43ba89c6b4e97e2ac31751ee4311163edcaa65e13bdbf53b717c7b6ab0cb7bcbee5db6a95037f1cf9a607ce25
|
7
|
+
data.tar.gz: cf1d125a4a8dca473f93ad8943c92009ea92e4d330d18826b680954d7236d93d751c36b0d817263a6a92cdb5fe0694ec0766fce022135ecc1e6063f8f883d53c
|
data/bin/mulang
CHANGED
Binary file
|
data/lib/locales/en.yml
CHANGED
@@ -171,8 +171,8 @@ en:
|
|
171
171
|
UsesComprehension: '%{binding} %{must} use comprehensions'
|
172
172
|
UsesConditional: '%{binding} %{must} use conditionals'
|
173
173
|
UsesCut: '%{binding} uses <code>!</li> operator, which is a bad practice'
|
174
|
-
UsesDynamicPolymorphism: '%{binding} %{must} use polymorphism'
|
175
174
|
UsesDynamicMethodOverload: '%{binding} %{must} use overload'
|
175
|
+
UsesDynamicPolymorphism: '%{binding} %{must} use polymorphism'
|
176
176
|
UsesFail: '%{binding} uses <code>%{keyword_Fail}</li>, which is a bad practice'
|
177
177
|
UsesFindall: '%{binding} %{must} use <code>%{keyword_Findall}</code>'
|
178
178
|
UsesForall: '%{binding} %{must} use <code>%{keyword_Forall}</code>'
|
@@ -185,6 +185,7 @@ en:
|
|
185
185
|
UsesLoop: '%{binding} %{must} use a loop%{matching}'
|
186
186
|
UsesMath: '%{binding} %{must} usar math expressions'
|
187
187
|
UsesMixin: '%{binding} %{must} use mixins'
|
188
|
+
UsesNamedSelfReference: '%{binding} should use <code>%{keyword_Self}</code> instead of a global reference'
|
188
189
|
UsesNot: '%{binding} %{must} use not'
|
189
190
|
UsesObjectComposition: '%{binding} %{must} use composition'
|
190
191
|
UsesPatternMatching: '%{binding} %{must} use pattern matching'
|
data/lib/locales/es.yml
CHANGED
@@ -183,8 +183,8 @@ es:
|
|
183
183
|
UsesComprehension: '%{binding} %{must} emplear listas por comprensión'
|
184
184
|
UsesConditional: '%{binding} %{must} utilizar condicionales'
|
185
185
|
UsesCut: '%{binding} usa el operador !, lo cual es una mala práctica'
|
186
|
-
UsesDynamicPolymorphism: '%{binding} %{must} usar polimorfismo'
|
187
186
|
UsesDynamicMethodOverload: '%{binding} %{must} usar sobrecarga'
|
187
|
+
UsesDynamicPolymorphism: '%{binding} %{must} usar polimorfismo'
|
188
188
|
UsesExceptionHandling: '%{binding} %{must} realizar manejo de excepciones'
|
189
189
|
UsesExceptions: '%{binding} %{must} usar excepciones'
|
190
190
|
UsesFail: '%{binding} usa <code>%{keyword_Fail}</li>, lo cual es una mala práctica'
|
@@ -201,6 +201,7 @@ es:
|
|
201
201
|
UsesMath: '%{binding} %{must} usar expresiones matemáticas'
|
202
202
|
UsesMixin: '%{binding} %{must} utilizar mixins'
|
203
203
|
UsesMixins: '%{binding} %{must} usar mixins'
|
204
|
+
UsesNamedSelfReference: '%{binding} debería usar <code>%{keyword_Self}</code> en lugar de una referencia global'
|
204
205
|
UsesNot: '%{binding} %{must} utilizar <code>%{keyword_Not}</code>'
|
205
206
|
UsesObjectComposition: '%{binding} %{must} usar composición'
|
206
207
|
UsesPatternMatching: '%{binding} %{must} utilizar pattern matching'
|
data/lib/locales/pt.yml
CHANGED
@@ -145,7 +145,7 @@ pt:
|
|
145
145
|
Instantiates_named: '%{binding} %{must} instantiate %{target}'
|
146
146
|
Instantiates: '%{binding} %{must} instanciar objetos'
|
147
147
|
IsLongCode: '%{binding} é muito longo. Tente delegar mais'
|
148
|
-
JavaScript#UsesVarInsteadOfLet: '%
|
148
|
+
JavaScript#UsesVarInsteadOfLet: '%{binding} deve usar <code>let</code> em vez de <code>var</code>'
|
149
149
|
OverridesEqualOrHashButNotBoth: '%{binding} redefine os métodos <code>equals</code> ou <code>hash </code>, mas não ambos'
|
150
150
|
Raises_except: '%{binding} %{must} lançar exceções diferentes de %{target}'
|
151
151
|
Raises_like: '%{binding} %{must} lançar exceções semelhantes a %{target}'
|
@@ -175,8 +175,8 @@ pt:
|
|
175
175
|
UsesComprehension: '%{binding} %{must} usar listas pelo entendimento'
|
176
176
|
UsesConditional: '%{binding} %{must} usar conditional'
|
177
177
|
UsesCut: '%{binding} usa o operador !, que é uma má prática'
|
178
|
-
UsesDynamicPolymorphism: '%{binding} %{must} usar polimorfismo'
|
179
178
|
UsesDynamicMethodOverload: '%{binding} %{must} usar sobrecarga'
|
179
|
+
UsesDynamicPolymorphism: '%{binding} %{must} usar polimorfismo'
|
180
180
|
UsesExceptionHandling: '%{binding} %{must} executar o tratamento de exceção'
|
181
181
|
UsesExceptions: '%{binding} %{must} usar exceções'
|
182
182
|
UsesFail: '%{binding} usa <code>%{keyword_Fail}</li>, o que é uma prática ruim'
|
@@ -192,6 +192,7 @@ pt:
|
|
192
192
|
UsesLoop: '%{binding} %{must} usar um loop%{matching}'
|
193
193
|
UsesMath: '%{binding} %{must} usar expressões matemáticas'
|
194
194
|
UsesMixins: '%{binding} %{must} usar mixins'
|
195
|
+
UsesNamedSelfReference: '%{binding} deve usar <code>%{keyword_Self}</code> em vez de uma referência global'
|
195
196
|
UsesNot: '%{binding} %{must} usar <code>%{keyword_Not}</code>'
|
196
197
|
UsesObjectComposition: '%{binding} %{must} usar composição'
|
197
198
|
UsesPatternMatching: '%{binding} %{must} usar o padrão de correspondência'
|
data/lib/mulang/code.rb
CHANGED
data/lib/mulang/expectation.rb
CHANGED
@@ -8,6 +8,7 @@ module Mulang::Expectation
|
|
8
8
|
|
9
9
|
FUNCTIONAL_SMELLS = %w(
|
10
10
|
HasRedundantGuards
|
11
|
+
HasRedundantLambda
|
11
12
|
HasRedundantParameter
|
12
13
|
ShouldUseOtherwise
|
13
14
|
)
|
@@ -15,11 +16,12 @@ module Mulang::Expectation
|
|
15
16
|
OBJECT_ORIENTED_SMELLS = %w(
|
16
17
|
DoesNilTest
|
17
18
|
DoesNullTest
|
19
|
+
DoesTypeTest
|
18
20
|
HasTooManyMethods
|
19
21
|
OverridesEqualOrHashButNotBoth
|
20
22
|
ReturnsNil
|
21
23
|
ReturnsNull
|
22
|
-
|
24
|
+
UsesNamedSelfReference
|
23
25
|
)
|
24
26
|
|
25
27
|
IMPERATIVE_SMELLS = %w(
|
@@ -32,6 +34,7 @@ module Mulang::Expectation
|
|
32
34
|
EXPRESSIVENESS_SMELLS = %w(
|
33
35
|
HasMisspelledBindings
|
34
36
|
HasMisspelledIdentifiers
|
37
|
+
HasTooShortBindings
|
35
38
|
HasTooShortIdentifiers
|
36
39
|
HasWrongCaseBinding
|
37
40
|
HasWrongCaseIdentifiers
|
@@ -46,10 +49,8 @@ module Mulang::Expectation
|
|
46
49
|
HasEqualIfBranches
|
47
50
|
HasLongParameterList
|
48
51
|
HasRedundantBooleanComparison
|
49
|
-
HasRedundantLocalVariableReturn
|
50
52
|
HasRedundantIf
|
51
|
-
|
52
|
-
HasTooShortBindings
|
53
|
+
HasRedundantLocalVariableReturn
|
53
54
|
HasUnreachableCode
|
54
55
|
HasUsageTypos
|
55
56
|
IsLongCode
|
data/lib/mulang/language.rb
CHANGED
@@ -1,11 +1,25 @@
|
|
1
1
|
module Mulang::Language
|
2
|
+
CORE_LANGUAGES = %w(
|
3
|
+
Java
|
4
|
+
JavaScript
|
5
|
+
Prolog
|
6
|
+
Haskell
|
7
|
+
Python
|
8
|
+
Python2
|
9
|
+
Python3
|
10
|
+
Ruby
|
11
|
+
Php
|
12
|
+
C
|
13
|
+
Mulang
|
14
|
+
)
|
15
|
+
|
2
16
|
class Base
|
3
17
|
def identifiers(content, **options)
|
4
18
|
Mulang.analyse(identifiers_analysis(content, **options), **options)['outputIdentifiers'] rescue nil
|
5
19
|
end
|
6
20
|
|
7
21
|
def identifiers_analysis(content, **options)
|
8
|
-
|
22
|
+
build_analysis content, {includeOutputIdentifiers: true}, **options
|
9
23
|
end
|
10
24
|
|
11
25
|
def transformed_asts(content, operations, **options)
|
@@ -13,7 +27,7 @@ module Mulang::Language
|
|
13
27
|
end
|
14
28
|
|
15
29
|
def transformed_asts_analysis(content, operations, **options)
|
16
|
-
|
30
|
+
build_analysis content, {transformationSpecs: operations}, **options
|
17
31
|
end
|
18
32
|
|
19
33
|
def normalization_options(**options)
|
@@ -25,12 +39,10 @@ module Mulang::Language
|
|
25
39
|
end
|
26
40
|
|
27
41
|
def ast_analysis(content, **options)
|
28
|
-
|
42
|
+
build_analysis content, {includeOutputAst: true}, **options
|
29
43
|
end
|
30
44
|
|
31
|
-
|
32
|
-
|
33
|
-
def base_analysis(content, spec, **options)
|
45
|
+
def build_analysis(content, spec, **options)
|
34
46
|
{
|
35
47
|
sample: sample(content),
|
36
48
|
spec: {
|
@@ -57,6 +69,10 @@ module Mulang::Language
|
|
57
69
|
content: content
|
58
70
|
}
|
59
71
|
end
|
72
|
+
|
73
|
+
def core_name
|
74
|
+
@name
|
75
|
+
end
|
60
76
|
end
|
61
77
|
|
62
78
|
class External < Base
|
@@ -82,8 +98,12 @@ module Mulang::Language
|
|
82
98
|
}
|
83
99
|
end
|
84
100
|
|
85
|
-
def
|
86
|
-
super.deep_merge(spec: {originalLanguage:
|
101
|
+
def build_analysis(*)
|
102
|
+
super.deep_merge(spec: {originalLanguage: core_name}.compact)
|
103
|
+
end
|
104
|
+
|
105
|
+
def core_name
|
106
|
+
@name.in?(CORE_LANGUAGES) ? name : nil
|
87
107
|
end
|
88
108
|
|
89
109
|
private
|
data/lib/mulang/tokens.rb
CHANGED
@@ -92,6 +92,7 @@ module Mulang
|
|
92
92
|
keyword_ForEach: 'for',
|
93
93
|
keyword_Interface: 'interface',
|
94
94
|
keyword_Switch: 'switch',
|
95
|
+
keyword_Self: 'this',
|
95
96
|
operator_And: '&&',
|
96
97
|
operator_Divide: '/',
|
97
98
|
operator_Equal: 'equal',
|
@@ -123,6 +124,7 @@ module Mulang
|
|
123
124
|
keyword_If: 'if',
|
124
125
|
keyword_Return: 'return',
|
125
126
|
keyword_While: 'while',
|
127
|
+
keyword_Self: 'this',
|
126
128
|
operator_And: '&&',
|
127
129
|
operator_Divide: '/',
|
128
130
|
operator_Equal: '===',
|
@@ -155,6 +157,7 @@ module Mulang
|
|
155
157
|
keyword_If: 'if',
|
156
158
|
keyword_Return: 'return',
|
157
159
|
keyword_While: 'while',
|
160
|
+
keyword_Self: 'self',
|
158
161
|
operator_And: 'and',
|
159
162
|
operator_Divide: '/',
|
160
163
|
operator_Equal: '==',
|
@@ -188,6 +191,7 @@ module Mulang
|
|
188
191
|
keyword_ForEach: 'for',
|
189
192
|
keyword_Include: 'include',
|
190
193
|
keyword_Switch: 'case',
|
194
|
+
keyword_Self: 'self',
|
191
195
|
operator_And: '&&',
|
192
196
|
operator_Divide: '/',
|
193
197
|
operator_Equal: '==',
|
@@ -220,6 +224,7 @@ module Mulang
|
|
220
224
|
keyword_If: 'if',
|
221
225
|
keyword_Return: 'return',
|
222
226
|
keyword_While: 'while',
|
227
|
+
keyword_Self: 'this',
|
223
228
|
operator_And: '&&',
|
224
229
|
operator_Divide: '/',
|
225
230
|
operator_Equal: '==',
|
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: 6.0.
|
4
|
+
version: 6.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit-core
|