mumuki-java-runner 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a541271b702736638069bec61f59aabb4c448fc
4
- data.tar.gz: aaa46fb1556615c7c8690527c58c31f986371254
3
+ metadata.gz: eb6f56fb668bf395fa18377baae1206f11ad7576
4
+ data.tar.gz: cad91894bc082f9919f538b8609c1a7ed6dfec91
5
5
  SHA512:
6
- metadata.gz: 599d52e7d4669ac2a7ac3cf470bfa6ad3fb545ecd76bea143b4ba89cae42f2c3017fa675503f50cd954d83965cdc7f9d7a92bcb48b9ae2267cf7c04e402d767a
7
- data.tar.gz: 8f298391002b59499a250c594fd15ef65d7d06a0d3fafa6be0e49d75ecf90c5dc7b429665991a76c2f33946c3c6ff3e540ab80c604d9929b4b3d77fafa02a194
6
+ metadata.gz: 918bcabdcbcc2568ccc22aec4674919e3093a8c285d4c342ce144b3be68c70c445930f662ef5dcf42f3ad1f806d850ae2f12e7ef97b5345f1c383c3b9c72bf00
7
+ data.tar.gz: d4bcec43802f5d4b1880cec12e676e724a5cef6d67b11457131316938757b6f8f3e018847669429c96ceb078fbf4f0a6bbee325967edd9f739cbf903176417fd
@@ -0,0 +1,11 @@
1
+ class JavaExpectationsHook < Mumukit::Templates::MulangExpectationsHook
2
+ include_smells true
3
+
4
+ def language
5
+ 'Java'
6
+ end
7
+
8
+ def default_smell_exceptions
9
+ LOGIC_SMELLS + FUNCTIONAL_SMELLS
10
+ end
11
+ end
@@ -0,0 +1,58 @@
1
+ class JavaFeedbackHook < Mumukit::Hook
2
+ def run!(request, results)
3
+ content = request.content
4
+ test_results = results.test_results[0]
5
+
6
+ JavaExplainer.new.explain(content, test_results) if test_results.is_a? String
7
+ end
8
+
9
+ class JavaExplainer < Mumukit::Explainer
10
+
11
+ def explain_missing_semicolon(_, result)
12
+ missing_character result, ';'
13
+ end
14
+
15
+ def explain_missing_parenthesis(_, result)
16
+ missing_character result, '\('
17
+ end
18
+
19
+ def explain_missing_bracket(_, result)
20
+ missing_character result, '\{'
21
+ end
22
+
23
+ def explain_cannot_find_symbol(_, result)
24
+ (/#{error} cannot find symbol#{near_regex}#{symbol_regex}#{location_regex}/.match result).try do |it|
25
+ {near: it[1], symbol: it[2].strip, location: it[3].strip}
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def start_regex(symbol=' ')
32
+ /.*[\t \n]*#{symbol}*(.*)/
33
+ end
34
+
35
+ def near_regex
36
+ /#{start_regex}\n[ \t]+\^/
37
+ end
38
+
39
+ def symbol_regex
40
+ start_regex 'symbol:'
41
+ end
42
+
43
+ def location_regex
44
+ start_regex 'location:'
45
+ end
46
+
47
+ def error
48
+ '[eE]rror:'
49
+ end
50
+
51
+ def missing_character(result, character)
52
+ (/#{error} '#{character}' expected#{near_regex}/.match result).try do |it|
53
+ {near: it[1]}
54
+ end
55
+ end
56
+
57
+ end
58
+ end
data/lib/java_runner.rb CHANGED
@@ -1,10 +1,15 @@
1
1
  require 'mumukit'
2
2
 
3
+ I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
4
+
3
5
  Mumukit.runner_name = 'java'
4
6
  Mumukit.configure do |config|
5
7
  config.docker_image = 'mumuki/mumuki-junit-worker'
8
+ config.content_type = 'markdown'
6
9
  end
7
10
 
8
11
  require_relative './version'
9
12
  require_relative './test_hook'
10
13
  require_relative './metadata_hook'
14
+ require_relative './expectations_hook'
15
+ require_relative './feedback_hook'
@@ -0,0 +1,5 @@
1
+ en:
2
+ missing_semicolon: "Missing ';' near `%{near}`"
3
+ missing_parenthesis: "Missing '(' near `%{near}`"
4
+ missing_bracket: "Missing { near `%{near}`. Maybe you misspelled a class or method declaration."
5
+ cannot_find_symbol: "Cannot find `%{symbol}` declaration in `%{location}`"
@@ -0,0 +1,5 @@
1
+ es:
2
+ missing_semicolon: "Parece que falta un ';' cerca de `%{near}`"
3
+ missing_parenthesis: "Parece que falta un '(' cerca de `%{near}`"
4
+ missing_bracket: "Se esperaba una { cerca de `%{near}`. Fijate si tal vez, introdujiste un paréntesis de más o está mal escrita la declaración de clase o método."
5
+ cannot_find_symbol: "No se encontró la definición de `%{symbol}` en `%{location}`"
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JavaVersionHook
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
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.1.0
4
+ version: 1.2.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: 2017-07-19 00:00:00.000000000 Z
11
+ date: 2017-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.5'
19
+ version: '2.10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.5'
26
+ version: '2.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -101,7 +101,11 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - lib/expectations_hook.rb
105
+ - lib/feedback_hook.rb
104
106
  - lib/java_runner.rb
107
+ - lib/locales/en.yml
108
+ - lib/locales/es.yml
105
109
  - lib/metadata_hook.rb
106
110
  - lib/test_hook.rb
107
111
  - lib/version.rb