mumukit 2.36.0 → 2.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/error_pattern.rb +6 -4
- data/lib/mumukit/explainer.rb +8 -2
- data/lib/mumukit/metatest/checker.rb +1 -1
- data/lib/mumukit/templates/mulang_expectations_hook.rb +30 -9
- data/lib/mumukit/templates/with_error_patterns.rb +2 -2
- data/lib/mumukit/templates/with_structured_results.rb +1 -1
- data/lib/mumukit/version.rb +1 -1
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7df39585e9af97eafeaa33f6189749ed29458e5a55ab37cf3339ae4200fc3f97
|
4
|
+
data.tar.gz: 0d272a7e75b9cd754314cdaafac2e3158b3b80374e88099be3633066d0098ef0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d7868073a960f5c0476bb8dd09aa84bb3d3aa1427ea1fef0700c4d664778cb40c60a18f6db212fc641e784839913e17ba23863788c393535b186764e2f44cdb
|
7
|
+
data.tar.gz: ca71c3f73c932143b403e4758e110f1e2f209f15cca3ada46365f95bc4974bef8042939e558ac5e11ef6e280b239dbd5abc48aa836fd8206b6098904b3473141
|
@@ -1,15 +1,17 @@
|
|
1
1
|
module Mumukit
|
2
2
|
class ErrorPattern
|
3
|
-
def initialize(regexp)
|
3
|
+
def initialize(regexp, status: :failed, replace: '')
|
4
4
|
@regexp = regexp
|
5
|
+
@status = status
|
6
|
+
@replacement = replace
|
5
7
|
end
|
6
8
|
|
7
|
-
def matches?(result)
|
8
|
-
@regexp.matches?
|
9
|
+
def matches?(result, status)
|
10
|
+
@status.like?(status) && @regexp.matches?(result)
|
9
11
|
end
|
10
12
|
|
11
13
|
def sanitize(result)
|
12
|
-
result.gsub(@regexp,
|
14
|
+
result.gsub(@regexp, @replacement).strip
|
13
15
|
end
|
14
16
|
|
15
17
|
def transform(result, status)
|
data/lib/mumukit/explainer.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
class Mumukit::Explainer
|
2
|
+
include Mumukit::WithContentType
|
3
|
+
|
2
4
|
def explain(content, test_results)
|
5
|
+
content_type.enumerate(explanations(content, test_results))
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def explanations(content, test_results)
|
3
11
|
explain_methods
|
4
12
|
.map { |selector, key| eval_explain(selector, key, content, test_results) }
|
5
13
|
.compact
|
6
14
|
.map { |explain| I18n.t(explain[:key], explain[:binding]) }
|
7
|
-
.map { |it| "* #{it}" }
|
8
|
-
.join("\n")
|
9
15
|
end
|
10
16
|
|
11
17
|
def eval_explain(selector, key, content, test_results)
|
@@ -64,7 +64,7 @@ module Mumukit::Metatest
|
|
64
64
|
|
65
65
|
# Implementors should override this method if they want access to
|
66
66
|
# the error details and produce more complex test results
|
67
|
-
def build_error_output(builder,
|
67
|
+
def build_error_output(builder, _example, input, error)
|
68
68
|
builder.result = render_error_output input, error.message
|
69
69
|
end
|
70
70
|
|
@@ -2,12 +2,12 @@ require 'mulang'
|
|
2
2
|
|
3
3
|
module Mumukit
|
4
4
|
class Templates::MulangExpectationsHook < Mumukit::Templates::ExpectationsHook
|
5
|
-
LOGIC_SMELLS =
|
6
|
-
FUNCTIONAL_SMELLS =
|
7
|
-
OBJECT_ORIENTED_SMELLS =
|
8
|
-
IMPERATIVE_SMELLS =
|
9
|
-
EXPRESSIVENESS_SMELLS =
|
10
|
-
GENERIC_SMELLS =
|
5
|
+
LOGIC_SMELLS = Mulang::Expectation::LOGIC_SMELLS
|
6
|
+
FUNCTIONAL_SMELLS = Mulang::Expectation::FUNCTIONAL_SMELLS
|
7
|
+
OBJECT_ORIENTED_SMELLS = Mulang::Expectation::OBJECT_ORIENTED_SMELLS
|
8
|
+
IMPERATIVE_SMELLS = Mulang::Expectation::IMPERATIVE_SMELLS
|
9
|
+
EXPRESSIVENESS_SMELLS = Mulang::Expectation::EXPRESSIVENESS_SMELLS
|
10
|
+
GENERIC_SMELLS = Mulang::Expectation::GENERIC_SMELLS
|
11
11
|
|
12
12
|
required :language, 'You have to provide a Mulang-compatible language in order to use this hook'
|
13
13
|
|
@@ -16,14 +16,19 @@ module Mumukit
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def compile_mulang_analysis(request, expectations)
|
19
|
-
mulang_code(request).analysis(
|
19
|
+
mulang_code(request).analysis({
|
20
20
|
expectations: expectations[:ast],
|
21
21
|
customExpectations: expectations[:custom],
|
22
22
|
smellsSet: {
|
23
23
|
tag: 'AllSmells',
|
24
24
|
exclude: (expectations[:exceptions] + default_smell_exceptions)
|
25
25
|
},
|
26
|
-
domainLanguage: domain_language
|
26
|
+
domainLanguage: domain_language
|
27
|
+
}.merge({
|
28
|
+
originalLanguage: original_language,
|
29
|
+
autocorrectionRules: autocorrection_rules.try { |it| positive_and_negative it }.presence,
|
30
|
+
normalizationOptions: normalization_options(request).presence
|
31
|
+
}.compact))
|
27
32
|
end
|
28
33
|
|
29
34
|
def run_mulang_analysis(analysis)
|
@@ -32,7 +37,6 @@ module Mumukit
|
|
32
37
|
raise Mumukit::CompilationError, "Can not handle mulang results for analysis #{analysis}"
|
33
38
|
end
|
34
39
|
|
35
|
-
|
36
40
|
def domain_language
|
37
41
|
{
|
38
42
|
caseStyle: "CamelCase",
|
@@ -41,6 +45,17 @@ module Mumukit
|
|
41
45
|
}
|
42
46
|
end
|
43
47
|
|
48
|
+
def normalization_options(request)
|
49
|
+
request.dig(:settings, :normalization_options) || {}
|
50
|
+
end
|
51
|
+
|
52
|
+
def autocorrection_rules
|
53
|
+
{}
|
54
|
+
end
|
55
|
+
|
56
|
+
def original_language
|
57
|
+
end
|
58
|
+
|
44
59
|
def default_smell_exceptions
|
45
60
|
[]
|
46
61
|
end
|
@@ -76,5 +91,11 @@ module Mumukit
|
|
76
91
|
include Mumukit::Templates::WithCodeSmells
|
77
92
|
end
|
78
93
|
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def positive_and_negative(rules)
|
98
|
+
rules.flat_map { |k, v| [[k, v], ["Not:#{k}", "Not:#{v}"]] }.to_h
|
99
|
+
end
|
79
100
|
end
|
80
101
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Mumukit::Templates
|
2
2
|
module WithErrorPatterns
|
3
3
|
def post_process_file(_file, result, status)
|
4
|
-
error_patterns.
|
5
|
-
super
|
4
|
+
pattern = error_patterns.find { |it| it.matches? result, status }
|
5
|
+
pattern ? pattern.transform(result, status) : super
|
6
6
|
end
|
7
7
|
|
8
8
|
def error_patterns
|
@@ -7,7 +7,7 @@ module Mumukit::Templates::WithStructuredResults
|
|
7
7
|
post_process_unstructured_result(file, result, status)
|
8
8
|
end
|
9
9
|
rescue JSON::ParserError
|
10
|
-
|
10
|
+
post_process_unstructured_result(file, result, :errored)
|
11
11
|
end
|
12
12
|
|
13
13
|
def post_process_unstructured_result(_file, result, status)
|
data/lib/mumukit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.40.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: 2021-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -212,28 +212,34 @@ dependencies:
|
|
212
212
|
requirements:
|
213
213
|
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
215
|
+
version: '6.0'
|
216
|
+
- - ">="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: 6.0.4
|
216
219
|
type: :runtime
|
217
220
|
prerelease: false
|
218
221
|
version_requirements: !ruby/object:Gem::Requirement
|
219
222
|
requirements:
|
220
223
|
- - "~>"
|
221
224
|
- !ruby/object:Gem::Version
|
222
|
-
version: '
|
225
|
+
version: '6.0'
|
226
|
+
- - ">="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: 6.0.4
|
223
229
|
- !ruby/object:Gem::Dependency
|
224
230
|
name: mumukit-inspection
|
225
231
|
requirement: !ruby/object:Gem::Requirement
|
226
232
|
requirements:
|
227
233
|
- - "~>"
|
228
234
|
- !ruby/object:Gem::Version
|
229
|
-
version: '
|
235
|
+
version: '6.0'
|
230
236
|
type: :runtime
|
231
237
|
prerelease: false
|
232
238
|
version_requirements: !ruby/object:Gem::Requirement
|
233
239
|
requirements:
|
234
240
|
- - "~>"
|
235
241
|
- !ruby/object:Gem::Version
|
236
|
-
version: '
|
242
|
+
version: '6.0'
|
237
243
|
- !ruby/object:Gem::Dependency
|
238
244
|
name: mumukit-core
|
239
245
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,22 +272,16 @@ dependencies:
|
|
266
272
|
name: mumukit-content-type
|
267
273
|
requirement: !ruby/object:Gem::Requirement
|
268
274
|
requirements:
|
269
|
-
- - "
|
270
|
-
- !ruby/object:Gem::Version
|
271
|
-
version: '0.2'
|
272
|
-
- - "<"
|
275
|
+
- - "~>"
|
273
276
|
- !ruby/object:Gem::Version
|
274
|
-
version: '
|
277
|
+
version: '1.10'
|
275
278
|
type: :runtime
|
276
279
|
prerelease: false
|
277
280
|
version_requirements: !ruby/object:Gem::Requirement
|
278
281
|
requirements:
|
279
|
-
- - "
|
280
|
-
- !ruby/object:Gem::Version
|
281
|
-
version: '0.2'
|
282
|
-
- - "<"
|
282
|
+
- - "~>"
|
283
283
|
- !ruby/object:Gem::Version
|
284
|
-
version: '
|
284
|
+
version: '1.10'
|
285
285
|
description: Helpers for building a Mumuki Test Server
|
286
286
|
email:
|
287
287
|
- flbulgarelli@yahoo.com.ar
|
@@ -375,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
375
375
|
- !ruby/object:Gem::Version
|
376
376
|
version: '0'
|
377
377
|
requirements: []
|
378
|
-
rubygems_version: 3.0.
|
378
|
+
rubygems_version: 3.0.3
|
379
379
|
signing_key:
|
380
380
|
specification_version: 4
|
381
381
|
summary: Mumuki Test Server Development Kit
|