mumuki-java-runner 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/feedback_hook.rb +76 -2
- data/lib/locales/en.yml +13 -4
- data/lib/locales/es.yml +20 -8
- data/lib/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3e49fce3563aa66a7604c91f88cdd8f1d8410c0531c7c03973cbdb9f86311e8
|
4
|
+
data.tar.gz: 970a07892790c2d723436f3a3cce059345ca8f82d9f3cfefef6b23b89c88843b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f16499caf666e4d009b921f5be08407a5c7be624b1db52bfd4c6d7b2d46ca04f14fb8771f63086988485dd5aadb11e2e4accfbbf9a6a066d174c03ca89186d1
|
7
|
+
data.tar.gz: ab72b1133f8c40c567ed87d08a957615cce92e36b2eff9991460b1899fe5a762a1c836bedcee173474514a63f26f553da48a1215ba14bcbfaffb2fae81f6087c
|
data/lib/feedback_hook.rb
CHANGED
@@ -34,13 +34,32 @@ class JavaFeedbackHook < Mumukit::Hook
|
|
34
34
|
|
35
35
|
def explain_cannot_find_symbol(_, result)
|
36
36
|
(/#{error} cannot find symbol#{near_regex}#{symbol_regex}#{location_regex}/.match result).try do |it|
|
37
|
-
|
37
|
+
symbol = it[2].strip
|
38
|
+
location = it[3].strip
|
39
|
+
|
40
|
+
{near: it[1], symbol: localize_symbol(symbol), at_location: at_location(symbol, location) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def explain_lossy_conversion(_, result)
|
45
|
+
(/#{error} incompatible types: possible lossy conversion from (.*) to (.*)#{near_regex}/.match result).try do |it|
|
46
|
+
{ from: it[1], to: it[2], near: it[3] }
|
38
47
|
end
|
39
48
|
end
|
40
49
|
|
41
50
|
def explain_incompatible_types(_, result)
|
42
51
|
(/#{error} incompatible types: (.*) cannot be converted to (.*)#{near_regex}/.match result).try do |it|
|
43
|
-
|
52
|
+
actual = it[1]
|
53
|
+
expected = it[2]
|
54
|
+
near = it[3]
|
55
|
+
|
56
|
+
{ message: I18n.t(type_incompatibilty_kind(actual, expected), actual: actual, expected: expected, near: near) }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def explain_wrong_constructor_arguments(_, result)
|
61
|
+
(/#{error} constructor (.*) in class (.*) cannot be applied to given types;#{near_regex}/.match result).try do |it|
|
62
|
+
{ class: it[2] }
|
44
63
|
end
|
45
64
|
end
|
46
65
|
|
@@ -56,6 +75,24 @@ class JavaFeedbackHook < Mumukit::Hook
|
|
56
75
|
end
|
57
76
|
end
|
58
77
|
|
78
|
+
def explain_implemented_method_should_be_public(_, result)
|
79
|
+
(/#{error} (.*) in (.*) cannot implement (.*) in (.*)#{near_regex}\n attempting to assign weaker access privileges/.match result).try do |it|
|
80
|
+
{method: it[1], class: it[2], near: it[5]}
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def explain_missing_implementation(_, result)
|
85
|
+
(/#{error} (.*) is not abstract and does not override abstract method (.*) in (.*)#{near_regex}/.match result).try do |it|
|
86
|
+
{down: it[1], method: it[2], up: it[3] }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def explain_missing_return_type(_, result)
|
91
|
+
(/#{error} invalid method declaration; return type required#{near_regex}/.match result).try do |it|
|
92
|
+
{ near: it[1] }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
59
96
|
private
|
60
97
|
|
61
98
|
def start_regex(symbol=' ')
|
@@ -74,6 +111,14 @@ class JavaFeedbackHook < Mumukit::Hook
|
|
74
111
|
start_regex 'location:'
|
75
112
|
end
|
76
113
|
|
114
|
+
def type_incompatibilty_kind(a_type, another)
|
115
|
+
[a_type, another].any? { |it| primitive_types.include?(it) } ? :incompatible_types_primitives : :incompatible_types_classes
|
116
|
+
end
|
117
|
+
|
118
|
+
def primitive_types
|
119
|
+
['byte', 'short', 'int', 'long', 'float', 'double', 'boolean', 'char']
|
120
|
+
end
|
121
|
+
|
77
122
|
def error
|
78
123
|
'[eE]rror:'
|
79
124
|
end
|
@@ -84,5 +129,34 @@ class JavaFeedbackHook < Mumukit::Hook
|
|
84
129
|
end
|
85
130
|
end
|
86
131
|
|
132
|
+
def at_location(symbol, location)
|
133
|
+
symbol_type, _ = parse_symbol symbol
|
134
|
+
return '' if symbol_type == 'class'
|
135
|
+
|
136
|
+
' ' + I18n.t(:at_location, {
|
137
|
+
location: localize_symbol(location)
|
138
|
+
})
|
139
|
+
end
|
140
|
+
|
141
|
+
def localize_symbol(symbol)
|
142
|
+
symbol_type, name, type = parse_symbol symbol
|
143
|
+
i18n_key = "symbol_#{symbol_type}"
|
144
|
+
return "`#{symbol}`" unless I18n.exists? i18n_key
|
145
|
+
|
146
|
+
I18n.t(i18n_key, { name: name }) + localize_of_type(type)
|
147
|
+
end
|
148
|
+
|
149
|
+
def localize_of_type(type)
|
150
|
+
return '' if type.nil?
|
151
|
+
|
152
|
+
' ' + I18n.t(:of_type, type: type)
|
153
|
+
end
|
154
|
+
|
155
|
+
def parse_symbol(result)
|
156
|
+
parts = /^(\w+) ([\w\(\)]+)( of type (\w+))?/.match result
|
157
|
+
return ['', '', ''] if parts.nil?
|
158
|
+
|
159
|
+
[parts[1], parts[2], parts[4]]
|
160
|
+
end
|
87
161
|
end
|
88
162
|
end
|
data/lib/locales/en.yml
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
en:
|
2
|
-
|
3
|
-
|
2
|
+
at_location: "in %{location}"
|
3
|
+
cannot_find_symbol: "Cannot find `%{symbol}` declaration%{at_location}"
|
4
|
+
implemented_method_should_be_public: "Method `%{method}` in class `%{class}` should be public. Check if it has the right visibility near `%{near}`."
|
5
|
+
incompatible_types_classes: "Class `%{actual}` should be a `%{expected}`. Probably an _extends_ or _implements_ is missing near `%{near}`."
|
6
|
+
incompatible_types_primitives: "You are returning a `%{actual}` where a `%{expected}` is needed near `%{near}`"
|
7
|
+
incompatible_types: "%{message}"
|
4
8
|
missing_bracket: "Missing { near `%{near}`. Maybe you misspelled a class or method declaration."
|
9
|
+
missing_implementation: "An implementation of method `%{method}` is missing in class `%{down}`, since it is defined at `%{up}`"
|
10
|
+
missing_parenthesis: "Missing '(' near `%{near}`"
|
5
11
|
missing_parameter_type: "Missing parameter type near `%{near}`"
|
6
|
-
cannot_find_symbol: "Cannot find `%{symbol}` declaration in `%{location}`"
|
7
12
|
missing_return_statement: "There is a method that must return something, but doesn't. Check your code again!"
|
8
|
-
|
13
|
+
missing_return_type: "Missing return type near `%{near}`"
|
14
|
+
missing_semicolon: "Missing ';' near `%{near}`"
|
15
|
+
lossy_conversion: "You are trying to convert a `%{from}` into a `%{to}`, but `%{from}` is more specific, and data may be lost. If you are sure about doing this, add a `(%{to})` to the left side of the expression near `%{near}`."
|
16
|
+
of_type: "of type `%{type}`"
|
9
17
|
unexpected_close_curly: "You have a syntax error. Check if you're missing a `;` or a `{` near line %{line}."
|
10
18
|
unexpected_close_paren: "You have a syntax error. Check if you're missing a `(` or have an extra `)` near line %{line}. Also make sure all parameters declare their types."
|
19
|
+
wrong_constructor_arguments: "Constructor of class `%{class}` doesn't exist or it expects another amount or type of arguments"
|
data/lib/locales/es.yml
CHANGED
@@ -1,10 +1,22 @@
|
|
1
1
|
es:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
at_location: "en %{location}"
|
3
|
+
cannot_find_symbol: "Te falta la definición de %{symbol}%{at_location}"
|
4
|
+
implemented_method_should_be_public: "El método `%{method}` en la clase `%{class}` debería ser público. Revisá si tiene la visibilidad correcta cerca de `%{near}`."
|
5
|
+
incompatible_types_classes: "La clase `%{actual}` debería ser un `%{expected}`. Revisá si no te falta un _extends_ o _implements_ cerca de `%{near}`."
|
6
|
+
incompatible_types_primitives: "Estás devolviendo un `%{actual}` donde se necesitaba un `%{expected}` cerca de `%{near}`"
|
7
|
+
incompatible_types: "%{message}"
|
8
|
+
missing_bracket: "Te falta una `{` cerca de `%{near}`. Fijate si te sobran paréntesis o está mal escrita la declaración de clase o método."
|
9
|
+
missing_implementation: "Te está faltando implementar el método `%{method}` en la clase `%{down}`, ya que está definido en `%{up}`"
|
10
|
+
missing_parenthesis: "Parece que te falta un '(' cerca de `%{near}`"
|
11
|
+
missing_parameter_type: "Parece que te falta el tipo de un parámetro cerca de `%{near}`"
|
7
12
|
missing_return_statement: "Hay un método que debería retornar algo, pero no está retornando nada. ¡Revisá bien tu código!"
|
8
|
-
|
9
|
-
|
10
|
-
|
13
|
+
missing_return_type: "Te falta especificar el tipo de retorno cerca de `%{near}`"
|
14
|
+
missing_semicolon: "Parece que te falta un ';' cerca de `%{near}`"
|
15
|
+
lossy_conversion: "Estás intentando convertir un `%{from}` a un `%{to}`, pero `%{from}` es más específico y se podrían perder datos. Si realmente querés hacerlo, agregá un `(%{to})` a la izquierda de la expresión, cerca de `%{near}`."
|
16
|
+
of_type: "de tipo `%{type}`"
|
17
|
+
symbol_class: "la clase `%{name}`"
|
18
|
+
symbol_method: "método `%{name}`"
|
19
|
+
symbol_variable: "la variable `%{name}`"
|
20
|
+
unexpected_close_curly: "Fijate si no te falta un `;` o una `{` cerca de la línea %{line}."
|
21
|
+
unexpected_close_paren: "Fijate si no te falta un `(` o te sobra un `)` cerca de la línea %{line}. Asegurate también de que todos los parámetros declaren sus tipos."
|
22
|
+
wrong_constructor_arguments: "El constructor de la clase `%{class}` no existe o espera otra cantidad o tipo de argumentos"
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-java-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.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:
|
11
|
+
date: 2019-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|
@@ -128,8 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
|
132
|
-
rubygems_version: 2.7.7
|
131
|
+
rubygems_version: 3.0.2
|
133
132
|
signing_key:
|
134
133
|
specification_version: 4
|
135
134
|
summary: Java Runner for Mumuki
|