mumukit-inspection 3.2.2 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c005d5902532da87f612d5903ece6b7c98bc7a5f2fdcc7f76b281cfd6e3d1e4
4
- data.tar.gz: 0c68ea92915d099b433311e0d11ac4844e31a12161cf254d724935190d11c661
3
+ metadata.gz: feb649a8c2e6d1b9b769beb9cf4ecd42667993067d23e4b8a2c40ae1dba781c2
4
+ data.tar.gz: 52e00995250243165bff626c312c5a0d5d9d8c52d48f6d24e8f030327a09e871
5
5
  SHA512:
6
- metadata.gz: 3f99058bb1ac09069318fa6df9d837c976ed892ec932155a238b5a8a006991049e7707f0c1d7aab9078ed68da1abdf58f4d405821a61cbe651a2b990757d89e6
7
- data.tar.gz: 316e9fc94470f3acdda0f723ae0b40435713814bcc461218cd96b8d0b80d6db31ba24b0de6ae2af9723389606e168b0f2de35301879dbf0eff42a1fd30e2eca4
6
+ metadata.gz: 7d06c4c283362b4df27c9e460281b58301846eb2644cd3565d9a60a9ab4e41b5cbf251e15cf2b6c75dbde7a0a34e429af2d2cd63f98f77eab7d9263a41ca4a12
7
+ data.tar.gz: eeba96816dcbfb20a276fc7df07c88f0c4c20009e16479859c22750025707d917b86a9a015347ec01d39a9047476b41f230021e17e881c7a3a759bf1c897263d
@@ -80,25 +80,28 @@ en:
80
80
  expectation_DeclaresVariable_except: '%{binding} %{must} declare variables distinct from %{target}'
81
81
  expectation_DeclaresVariable_like: '%{binding} %{must} declare a variable similar to %{target}'
82
82
  expectation_DeclaresVariable_named: '%{binding} %{must} declare a variable %{target}'
83
- expectation_DoesNullTest: '%{binding} does null tests'
83
+ expectation_DoesNilTest: '%{binding} does <i>%{keyword_null}</i> tests'
84
+ expectation_DoesNullTest: '%{binding} does <i>%{keyword_null}</i> tests'
84
85
  expectation_DoesTypeTest: '%{binding} string type tests'
85
86
  expectation_HasAssignmentReturn: '%{binding} returns the result of an assignment'
86
87
  expectation_HasCodeDuplication: '%{binding} has code duplication'
87
- expectation_HasEmptyIfBranches: '%{binding} has empty if branches'
88
+ expectation_HasEmptyIfBranches: '%{binding} has empty <i>%{keyword_if}</i> branches'
88
89
  expectation_HasMisspelledBindings: '%{binding} is misspelled'
89
90
  expectation_HasRedundantBooleanComparison: '%{binding} makes unnecesary boolean comparisons'
90
91
  expectation_HasRedundantGuards: '%{binding} has unnecessary guards'
91
- expectation_HasRedundantIf: '%{binding} has unnecessary ifs'
92
+ expectation_HasRedundantIf: '%{binding} has unnecessary <i>%{keyword_if}</i>s'
92
93
  expectation_HasRedundantLambda: '%{binding} has unnecessary lambdas'
93
94
  expectation_HasRedundantLocalVariableReturn: '%{binding} has unnecesary local variables; please try returning the expression directly'
94
95
  expectation_HasRedundantParameter: '%{binding} has unnecessary parameters, that can be removed using point-free'
95
- expectation_HasRedundantReduction: '%{binding} uses <i>is</i>, but it does not artihmetic.'
96
+ expectation_HasRedundantReduction: '%{binding} uses <i>%{keyword_is}</i>, but it does not artihmetic.'
96
97
  expectation_HasTooShortBindings: '%{binding} is a too short identifier'
98
+ expectation_HasUnreachableCode: '%{binding} has unreachable code.'
97
99
  expectation_HasWrongCaseBindings: '%{binding} does not honor case conventions'
98
100
  expectation_IsLongCode: '%{binding} is too long'
99
101
  expectation_must: must
100
102
  expectation_must_not: must not
101
- expectation_ReturnsNull: '%{binding} retuns null, which is a bad practice'
103
+ expectation_ReturnsNil: '%{binding} retuns <i>%{keyword_null}</i>, which is a bad practice'
104
+ expectation_ReturnsNull: '%{binding} retuns <i>%{keyword_null}</i>, which is a bad practice'
102
105
  expectation_solution: solution
103
106
  expectation_TypesAs: '%{binding} %{must} type'
104
107
  expectation_TypesAs_named: '%{binding} %{must} type as %{target}'
@@ -111,17 +114,17 @@ en:
111
114
  expectation_UsesComprehension: '%{binding} %{must} use comprehensions'
112
115
  expectation_UsesConditional: '%{binding} %{must} use conditionals'
113
116
  expectation_UsesCut: '%{binding} uses <i>!</li> operator, which is a bad practice'
114
- expectation_UsesFail: '%{binding} uses <i>fail</li>, which is a bad practice'
115
- expectation_UsesFindall: '%{binding} %{must} use findall'
116
- expectation_UsesForall: '%{binding} %{must} use forall'
117
- expectation_UsesForeach: '%{binding} %{must} use foreach'
117
+ expectation_UsesFail: '%{binding} uses <i>%{keyword_fail}</li>, which is a bad practice'
118
+ expectation_UsesFindall: '%{binding} %{must} use <i>%{keyword_findall}</i>'
119
+ expectation_UsesForall: '%{binding} %{must} use <i>%{keyword_forall}</i>'
120
+ expectation_UsesForeach: '%{binding} %{must} use <i>%{keyword_foreach}</i>'
118
121
  expectation_UsesGuards: '%{binding} %{must} use guards'
119
- expectation_UsesIf: '%{binding} %{must} use if'
122
+ expectation_UsesIf: '%{binding} %{must} use <i>%{keyword_if}</i>'
120
123
  expectation_UsesLambda: '%{binding} %{must} use lambda expressions'
121
124
  expectation_UsesNot: '%{binding} %{must} use not'
122
125
  expectation_UsesPatternMatching: '%{binding} %{must} use pattern matching'
123
- expectation_UsesRepeat: '%{binding} %{must} use repeat'
124
- expectation_UsesRepeatOf: '%{binding} %{must} use repeat'
125
- expectation_UsesSwitch: '%{binding} %{must} use a switch'
126
+ expectation_UsesRepeat: '%{binding} %{must} use <i>%{keyword_repeat}</i>'
127
+ expectation_UsesRepeatOf: '%{binding} %{must} use <i>%{keyword_repeat}</i>'
128
+ expectation_UsesSwitch: '%{binding} %{must} use a <i>%{keyword_switch}</i>'
126
129
  expectation_UsesUnificationOperator: '%{binding} uses the unification operator (=)'
127
- expectation_UsesWhile: '%{binding} %{must} use while'
130
+ expectation_UsesWhile: '%{binding} %{must} use <i>%{keyword_while}</i>'
@@ -94,11 +94,12 @@ es:
94
94
  expectation_DeclaresVariable_named: '%{binding} %{must} declarar una variable %{target}'
95
95
  expectation_DiscardsExceptions: '%{binding} está ignorando exceptiones silenciosamiente.'
96
96
  expectation_DoesConsolePrint: '%{binding} está realizando impresiones por pantalla.'
97
- expectation_DoesNullTest: '%{binding} hace comparaciones contra <i>null</i>'
97
+ expectation_DoesNilTest: '%{binding} hace comparaciones contra <i>%{keyword_null}</i>'
98
+ expectation_DoesNullTest: '%{binding} hace comparaciones contra <i>%{keyword_null}</i>'
98
99
  expectation_DoesTypeTest: '%{binding} hace comparaciones contra strings'
99
100
  expectation_HasAssignmentReturn: '%{binding} devuelve el resultado de una asignación'
100
101
  expectation_HasCodeDuplication: '%{binding} tiene código repetido'
101
- expectation_HasEmptyIfBranches: '%{binding} tiene ramas de <i>if</i> vacías'
102
+ expectation_HasEmptyIfBranches: '%{binding} tiene ramas de <i>%{keyword_if}</i> vacías'
102
103
  expectation_HasMisspelledBindings: '%{binding} está mal escrito. Revisá la ortografía y procurá no usar abreviaturas'
103
104
  expectation_HasMisspelledIdentifiers: '%{binding} está mal escrito. Revisá la ortografía y procurá no usar abreviaturas'
104
105
  expectation_HasRedundantBooleanComparison: '%{binding} hace comparaciones booleanas innecesarias'
@@ -107,9 +108,10 @@ es:
107
108
  expectation_HasRedundantLambda: '%{binding} tiene lambdas innecesarias'
108
109
  expectation_HasRedundantLocalVariableReturn: '%{binding} usa variables locales innecesarias; podés retornar directamente la expresión'
109
110
  expectation_HasRedundantParameter: '%{binding} tiene parámetros innecesarios (se pueden eliminar mediante point-free)'
110
- expectation_HasRedundantReduction: '%{binding} usa <i>is</i>, pero no realiza cálculos.'
111
+ expectation_HasRedundantReduction: '%{binding} usa <i>%{keyword_is}</i>, pero no realiza cálculos.'
111
112
  expectation_HasTooShortBindings: '%{binding} es un identificador muy corto'
112
113
  expectation_HasTooShortIdentifiers: '%{binding} es un identificador muy corto'
114
+ expectation_HasUnreachableCode: '%{binding} tiene código inalcanzable.'
113
115
  expectation_HasWrongCaseBindings: '%{binding} no respeta la convención de nombres'
114
116
  expectation_HasWrongCaseIdentifiers: '%{binding} no respeta la convención de nombres'
115
117
  expectation_Implements: '%{binding} %{must} implementar intefaces'
@@ -135,6 +137,7 @@ es:
135
137
  expectation_Rescues_except: '%{binding} %{must} capturar excepciones diferentes a %{target}'
136
138
  expectation_Rescues_like: '%{binding} %{must} capturar excepciones parecidas a %{target}'
137
139
  expectation_Rescues_named: '%{binding} %{must} capturar %{target}'
140
+ expectation_ReturnsNil: '%{binding} retorna null, lo cual es una mala práctica'
138
141
  expectation_ReturnsNull: '%{binding} retorna null, lo cual es una mala práctica'
139
142
  expectation_solution: la solución
140
143
  expectation_TypesAs: '%{binding} %{must} tipar'
@@ -150,19 +153,19 @@ es:
150
153
  expectation_UsesCut: '%{binding} usa el operador !, lo cual es una mala práctica'
151
154
  expectation_UsesExceptionHandling: '%{binding} %{must} realizar manejo de exceptiones'
152
155
  expectation_UsesExceptions: '%{binding} %{must} usar exceptiones'
153
- expectation_UsesFail: '%{binding} usa <i>fail</li>, lo cual es una mala práctica'
154
- expectation_UsesFindall: '%{binding} %{must} utilizar <i>findall</i>'
155
- expectation_UsesForall: '%{binding} %{must} utilizar <i>forall</i>'
156
- expectation_UsesForeach: '%{binding} %{must} usar <i>foreach</i>'
156
+ expectation_UsesFail: '%{binding} usa <i>%{keyword_fail}</li>, lo cual es una mala práctica'
157
+ expectation_UsesFindall: '%{binding} %{must} utilizar <i>%{keyword_findall}</i>'
158
+ expectation_UsesForall: '%{binding} %{must} utilizar <i>%{keyword_forall}</i>'
159
+ expectation_UsesForeach: '%{binding} %{must} usar <i>%{keyword_foreach}</i>'
157
160
  expectation_UsesGuards: '%{binding} %{must} usar guardas'
158
- expectation_UsesIf: '%{binding} %{must} usar <i>if</i>'
161
+ expectation_UsesIf: '%{binding} %{must} usar <i>%{keyword_if}</i>'
159
162
  expectation_UsesInheritance: '%{binding} %{must} usar herencia'
160
163
  expectation_UsesLambda: '%{binding} %{must} emplear expresiones lambda'
161
164
  expectation_UsesMixins: '%{binding} %{must} usar mixins'
162
- expectation_UsesNot: '%{binding} %{must} utilizar <i>not</i>'
165
+ expectation_UsesNot: '%{binding} %{must} utilizar <i>%{keyword_not}</i>'
163
166
  expectation_UsesPatternMatching: '%{binding} %{must} utilizar pattern matching'
164
- expectation_UsesRepeat: '%{binding} %{must} usar <i>repeat</i>'
165
- expectation_UsesRepeatOf: '%{binding} %{must} usar un <i>repeat</i> de %{target}'
166
- expectation_UsesSwitch: '%{binding} %{must} utilizar un <i>switch</i>'
167
+ expectation_UsesRepeat: '%{binding} %{must} usar <i>%{keyword_repeat}</i>'
168
+ expectation_UsesRepeatOf: '%{binding} %{must} usar un <i>%{keyword_repeat}</i> de %{target}'
169
+ expectation_UsesSwitch: '%{binding} %{must} utilizar un <i>%{keyword_switch}</i>'
167
170
  expectation_UsesUnificationOperator: '%{binding} usa el operador de unificación (=)'
168
- expectation_UsesWhile: '%{binding} %{must} utilizar un <i>while</i>'
171
+ expectation_UsesWhile: '%{binding} %{must} utilizar un <i>%{keyword_while}</i>'
@@ -24,7 +24,7 @@ pt:
24
24
  expectation_DeclaresComputation_except: '%{binding} %{must} declarar cálculos diferentes de %{target}'
25
25
  expectation_DeclaresComputation_like: '%{binding} %{must} declarar uma computação semelhante a %{target}'
26
26
  expectation_DeclaresComputation_named: '%{binding} %{must} declarar uma computação %{target}'
27
- expectation_HasEmptyIfBranches: '%{binding} tem vazio <i>if</i> ramos'
27
+ expectation_HasEmptyIfBranches: '%{binding} tem vazio <i>%{keyword_if}</i> ramos'
28
28
  expectation_DeclaresComputationWithArity0_named: '%{target} %{must} declarar parâmetros zero'
29
29
  expectation_DeclaresComputationWithArity1_named: '%{target} %{must} tem um parâmetro'
30
30
  expectation_DeclaresComputationWithArity2_named: '%{target} %{must} tem dois parâmetros'
@@ -95,7 +95,8 @@ pt:
95
95
  expectation_DeclaresVariable_named: '%{binding} %{must} declarar uma variável %{target}'
96
96
  expectation_DiscardsExceptions: '%{binding} está silenciosamente ignorando exceções.'
97
97
  expectation_DoesConsolePrint: '%{binding} está fazendo impressões na tela.'
98
- expectation_DoesNullTest: '%{binding} faz comparações contra <i>null</i>'
98
+ expectation_DoesNilTest: '%{binding} faz comparações contra <i>%{keyword_null}</i>'
99
+ expectation_DoesNullTest: '%{binding} faz comparações contra <i>%{keyword_null}</i>'
99
100
  expectation_DoesTypeTest: '%{binding} faz comparações contra strings'
100
101
  expectation_HasAssignmentReturn: '%{binding} retorna o resultado de uma tarefa'
101
102
  expectation_HasCodeDuplication: '%{binding} tem código repetido'
@@ -107,9 +108,11 @@ pt:
107
108
  expectation_HasRedundantLambda: '%{binding} possui lambdas desnecessários'
108
109
  expectation_HasRedundantLocalVariableReturn: '%{binding} usa variáveis ​​locais desnecessárias; você pode retornar a expressão diretamente'
109
110
  expectation_HasRedundantParameter: '%{binding} possui parâmetros desnecessários (pode ser removido por ponto-livre)'
110
- expectation_HasRedundantReduction: '%{binding} usa <i>is</i>, mas não executa cálculos.'
111
+ expectation_HasRedundantReduction: '%{binding} usa <i>%{keyword_is}</i>, mas não executa cálculos.'
111
112
  expectation_HasTooShortBindings: '%{binding} é um identificador muito curto'
112
113
  expectation_HasTooShortIdentifiers: '%{binding} é um identificador muito curto'
114
+ expectation_HasTooShortIdentifiers: '%{binding} é um identificador muito curto'
115
+ expectation_HasUnreachableCode: '%{binding} tem código inacessível.'
113
116
  expectation_HasWrongCaseBindings: '%{binding} não respeita a convenção de nomenclatura'
114
117
  expectation_HasWrongCaseIdentifiers: '%{binding} não respeita a convenção de nomenclatura'
115
118
  expectation_Implements: '%{binding} %{must} implementar interfaces'
@@ -135,6 +138,7 @@ pt:
135
138
  expectation_Rescues_except: '%{binding} %{must} capturar exceções que não sejam %{target}'
136
139
  expectation_Rescues_like: '%{binding} %{must} capturar exceções semelhantes a %{target}'
137
140
  expectation_Rescues_named: '%{binding} %{must} capture %{target}'
141
+ expectation_ReturnsNil: '%{binding} retorna nulo, o que é uma prática ruim'
138
142
  expectation_ReturnsNull: '%{binding} retorna nulo, o que é uma prática ruim'
139
143
  expectation_solution: 'a solução'
140
144
  expectation_TypesAs: '%{binding} %{must} tem tipo'
@@ -150,20 +154,20 @@ pt:
150
154
  expectation_UsesCut: '%{binding} usa o operador !, que é uma má prática'
151
155
  expectation_UsesExceptionHandling: '%{binding} %{must} executar o tratamento de exceção'
152
156
  expectation_UsesExceptions: '%{binding} %{must} usar exceções'
153
- expectation_UsesFail: '%{binding} usa <i>fail</li>, o que é uma prática ruim'
154
- expectation_UsesFindall: '%{binding} %{must} usar <i>findall</i>'
155
- expectation_UsesForall: '%{binding} %{must} usar <i>forall</i>'
156
- expectation_UsesForeach: '%{binding} %{must} usar <i>foreach</i>'
157
+ expectation_UsesFail: '%{binding} usa <i>%{keyword_fail}</li>, o que é uma prática ruim'
158
+ expectation_UsesFindall: '%{binding} %{must} usar <i>%{keyword_findall}</i>'
159
+ expectation_UsesForall: '%{binding} %{must} usar <i>%{keyword_forall}</i>'
160
+ expectation_UsesForeach: '%{binding} %{must} usar <i>%{keyword_foreach}</i>'
157
161
  expectation_UsesGuards: '%{binding} %{must} usar guardas'
158
- expectation_UsesIf: '%{binding} %{must} usar <i>if</i>'
162
+ expectation_UsesIf: '%{binding} %{must} usar <i>%{keyword_if}</i>'
159
163
  expectation_UsesInheritance: '%{binding} %{must} usar herança'
160
164
  expectation_UsesLambda: '%{binding} %{must} usar expressões lambda'
161
165
  expectation_UsesMixins: '%{binding} %{must} usar mixins'
162
- expectation_UsesNot: '%{binding} %{must} usar <i>not</i>'
166
+ expectation_UsesNot: '%{binding} %{must} usar <i>%{keyword_not}</i>'
163
167
  expectation_UsesPatternMatching: '%{binding} %{must} usar o padrão de correspondência'
164
- expectation_UsesRepeat: '%{binding} %{must} usar <i>repeat</i>'
165
- expectation_UsesRepeatOf: '%{binding} %{must} usar uma <i>repeat</i> de %{target}'
166
- expectation_UsesSwitch: '%{binding} %{must} usar um switch'
168
+ expectation_UsesRepeat: '%{binding} %{must} usar <i>%{keyword_repeat}</i>'
169
+ expectation_UsesRepeatOf: '%{binding} %{must} usar uma <i>%{keyword_repeat}</i> de %{target}'
170
+ expectation_UsesSwitch: '%{binding} %{must} usar um <i>%{keyword_switch}</i>'
167
171
  expectation_UsesUnificationOperator: '%{binding} usa o operador de unificação (=)'
168
- expectation_UsesWhile: '%{binding} %{must} usar um <i>while</i>'
172
+ expectation_UsesWhile: '%{binding} %{must} usar um <i>%{keyword_while}</i>'
169
173
 
@@ -3,7 +3,8 @@ class Mumukit::Inspection::Expectation
3
3
  SMELLS = %w(HasAssignmentReturn HasCodeDuplication HasEmptyIfBranches HasMisspelledIdentifiers
4
4
  HasRedundantBooleanComparison HasRedundantGuards HasRedundantIf
5
5
  HasRedundantLambda HasRedundantLocalVariableReturn HasRedundantParameter
6
- HasRedundantReduction HasTooShortIdentifiers HasWrongCaseIdentifiers)
6
+ HasRedundantReduction HasTooShortIdentifiers HasWrongCaseIdentifiers
7
+ HasUnreachableCode)
7
8
 
8
9
  attr_accessor :binding, :inspection
9
10
 
@@ -17,8 +18,8 @@ class Mumukit::Inspection::Expectation
17
18
  raise "Wrong inspection #{to_h}" unless inspection?
18
19
  end
19
20
 
20
- def translate
21
- Mumukit::Inspection::I18n.translate self
21
+ def translate(keywords = nil)
22
+ Mumukit::Inspection::I18n.translate self, keywords
22
23
  end
23
24
 
24
25
  def to_h
@@ -1,12 +1,23 @@
1
1
  module Mumukit::Inspection::I18n
2
2
  class << self
3
- def translate(e)
3
+ DEFAULT_KEYWORDS = {
4
+ keyword_null: :null,
5
+ keyword_if: :if,
6
+ keyword_is: :is,
7
+ keyword_fail: :fail,
8
+ keyword_findall: :findall,
9
+ keyword_forall: :forall,
10
+ keyword_foreach: :foreach,
11
+ keyword_not: :not,
12
+ keyword_repeat: :repeat,
13
+ keyword_switch: :switch,
14
+ keyword_while: :while,
15
+ }
16
+
17
+ def translate(e, keywords = nil)
4
18
  e = e.as_v2
5
19
  key = key_for e.binding, e.inspection
6
- ::I18n.t key,
7
- binding: t_binding(e.binding),
8
- target: t_target(e.inspection),
9
- must: t_must(e.inspection)
20
+ ::I18n.t key, translation_params(e, keywords)
10
21
  rescue
11
22
  '<unknown expectation>'
12
23
  end
@@ -15,6 +26,14 @@ module Mumukit::Inspection::I18n
15
26
 
16
27
  private
17
28
 
29
+ def translation_params(e, keywords)
30
+ {
31
+ binding: t_binding(e.binding),
32
+ target: t_target(e.inspection),
33
+ must: t_must(e.inspection)
34
+ }.merge(DEFAULT_KEYWORDS).merge(keywords || {})
35
+ end
36
+
18
37
  def key_for(binding, inspection)
19
38
  "expectation_#{inspection.type}#{inspection.target ? inspection.target.i18n_suffix : nil }"
20
39
  end
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  class Inspection
3
- VERSION = '3.2.2'
3
+ VERSION = '3.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-inspection
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-30 00:00:00.000000000 Z
11
+ date: 2018-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit-core