mumukit 2.37.1 → 2.42.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 +4 -4
- data/lib/locales/en.yml +2 -1
- data/lib/locales/es-CL.yml +2 -1
- data/lib/locales/es.yml +2 -1
- data/lib/locales/pt.yml +2 -1
- data/lib/mumukit/error_pattern.rb +6 -4
- data/lib/mumukit/isolated_environment.rb +8 -9
- data/lib/mumukit/metatest/interactive_checker.rb +18 -4
- data/lib/mumukit/templates/mulang_expectations_hook.rb +30 -9
- data/lib/mumukit/templates/try_hook.rb +9 -1
- 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 +14 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13101751c0e9c513185940d8bc107133d1615fbb308b134c1d355673f99ad2a1
|
|
4
|
+
data.tar.gz: ba07a835f81ec89e070c0fefe7b9907bc7ecb5a100ff6d9b5c05577ecabda72b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2842baf00a47c75db0161f2a5bccbf293740c46310a845b219d983d081c314743573091550074b9c9ea174a894c273cd018b19dfeaf893e00b75c4019684482
|
|
7
|
+
data.tar.gz: 51618512772abaa8542ae5f58ea6a01b13f724fda80256baad645d1390cf99c647023d933a51823c27412d5de92e4eb925a9b2f198c2ea789fdeef6ea057aa9f
|
data/lib/locales/en.yml
CHANGED
|
@@ -6,7 +6,7 @@ en:
|
|
|
6
6
|
interactive:
|
|
7
7
|
check_last_query_equals: "query should be '%{expected}' but was '%{actual}'"
|
|
8
8
|
check_last_query_fails: "query should fail but it passed"
|
|
9
|
-
check_last_query_matches: "query does not match
|
|
9
|
+
check_last_query_matches: "query does not match regexp %{regexp}"
|
|
10
10
|
check_last_query_outputs: "query output should be '%{expected}' but was '%{actual}'"
|
|
11
11
|
check_last_query_includes: "query output should include '%{expected}' but was '%{actual}'"
|
|
12
12
|
check_last_query_like: "query output should be like '%{expected}' but was '%{actual}'"
|
|
@@ -15,3 +15,4 @@ en:
|
|
|
15
15
|
check_query_outputs: "query '%{query}' output should be '%{expected}' but was '%{actual}'"
|
|
16
16
|
check_query_passes: "query '%{query}' should pass but it failed"
|
|
17
17
|
goal_passed: "goal was met successfully"
|
|
18
|
+
check_queries_match: "All the required queries must be executed"
|
data/lib/locales/es-CL.yml
CHANGED
|
@@ -6,7 +6,7 @@ es-CL:
|
|
|
6
6
|
interactive:
|
|
7
7
|
check_last_query_equals: "La consulta debería ser '%{expected}' pero fue '%{actual}'"
|
|
8
8
|
check_last_query_fails: "La consulta debería fallar pero pasó"
|
|
9
|
-
check_last_query_matches: "La consulta no cumple con la expresión regular %{
|
|
9
|
+
check_last_query_matches: "La consulta no cumple con la expresión regular %{regexp}"
|
|
10
10
|
check_last_query_outputs: "La consulta debería devolver '%{expected}' pero devolvió '%{actual}'"
|
|
11
11
|
check_last_query_includes: "La consulta debería incluir '%{expected}' pero devolvió '%{actual}'"
|
|
12
12
|
check_last_query_like: "La consulta debería ser como '%{expected}' pero devolvió '%{actual}'"
|
|
@@ -15,3 +15,4 @@ es-CL:
|
|
|
15
15
|
check_query_outputs: "La consulta '%{query}' debería devolver '%{expected}' pero devolvió '%{actual}'"
|
|
16
16
|
check_query_passes: "La consulta '%{query}' debería pasar pero falló"
|
|
17
17
|
goal_passed: "El objetivo se cumplió exitosamente"
|
|
18
|
+
check_queries_match: "Se deben realizar todas las consultas solicitadas"
|
data/lib/locales/es.yml
CHANGED
|
@@ -6,7 +6,7 @@ es:
|
|
|
6
6
|
interactive:
|
|
7
7
|
check_last_query_equals: "La consulta debería ser '%{expected}' pero fue '%{actual}'"
|
|
8
8
|
check_last_query_fails: "La consulta debería fallar pero pasó"
|
|
9
|
-
check_last_query_matches: "La consulta no cumple con la expresión regular %{
|
|
9
|
+
check_last_query_matches: "La consulta no cumple con la expresión regular %{regexp}"
|
|
10
10
|
check_last_query_outputs: "La consulta debería devolver '%{expected}' pero devolvió '%{actual}'"
|
|
11
11
|
check_last_query_includes: "La consulta debería incluir '%{expected}' pero devolvió '%{actual}'"
|
|
12
12
|
check_last_query_like: "La consulta debería ser como '%{expected}' pero devolvió '%{actual}'"
|
|
@@ -14,4 +14,5 @@ es:
|
|
|
14
14
|
check_query_fails: "La consulta '%{query}' debería fallar pero pasó"
|
|
15
15
|
check_query_outputs: "La consulta '%{query}' debería devolver '%{expected}' pero devolvió '%{actual}'"
|
|
16
16
|
check_query_passes: "La consulta '%{query}' debería pasar pero falló"
|
|
17
|
+
check_queries_match: "Se deben realizar todas las consultas solicitadas"
|
|
17
18
|
goal_passed: "El objetivo se cumplió exitosamente"
|
data/lib/locales/pt.yml
CHANGED
|
@@ -6,7 +6,7 @@ pt:
|
|
|
6
6
|
interactive:
|
|
7
7
|
check_last_query_equals: "a consulta deve ser '%{expected}' mas foi '%{actual}'"
|
|
8
8
|
check_last_query_fails: "a consulta deve falhar, mas passou"
|
|
9
|
-
check_last_query_matches: "A consulta não corresponde a regex %{
|
|
9
|
+
check_last_query_matches: "A consulta não corresponde a regex %{regexp}"
|
|
10
10
|
check_last_query_outputs: "O resultado da consulta deve ser '%{expected}', mas foi '%{actual}'"
|
|
11
11
|
check_last_query_includes: "O resultado da consulta deve incluir '%{expected}', mas foi '%{actual}'"
|
|
12
12
|
check_last_query_like: "O resultado da consulta deve ser como '%{expected}', mas foi '%{actual}'"
|
|
@@ -14,4 +14,5 @@ pt:
|
|
|
14
14
|
check_query_fails: "a consulta '%{query}' deve falhar, mas passou"
|
|
15
15
|
check_query_outputs: "a consulta '%{query}' deve ser '%{expected}', mas foi '%{actual}'"
|
|
16
16
|
check_query_passes: "a consulta '%{query}' deve passar, mas falhou"
|
|
17
|
+
check_queries_match: "Todas as consultas solicitadas devem ser feitas"
|
|
17
18
|
goal_passed: "O objetivo foi alcançado com sucesso"
|
|
@@ -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.
|
|
9
|
+
def matches?(result, status)
|
|
10
|
+
@status.like?(status) && @regexp.match?(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)
|
|
@@ -11,22 +11,21 @@ module Mumukit
|
|
|
11
11
|
dirnames = filenames.map { |it| Pathname.new(it).dirname }.uniq
|
|
12
12
|
|
|
13
13
|
binds = dirnames.map { |it| "#{it}:#{it}" }
|
|
14
|
-
volumes = Hash[dirnames.map { |it| [[it, {}]] }]
|
|
15
14
|
|
|
16
15
|
command = yield(*filenames)
|
|
17
16
|
command = command.split if command.is_a? String
|
|
18
17
|
|
|
19
|
-
configure_container! command, binds
|
|
18
|
+
configure_container! command, binds
|
|
20
19
|
end
|
|
21
20
|
|
|
22
|
-
def configure_container!(command, binds
|
|
21
|
+
def configure_container!(command, binds)
|
|
23
22
|
self.container = Docker::Container.create(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
image: Mumukit.config.docker_image,
|
|
24
|
+
cmd: command,
|
|
25
|
+
hostConfig: {
|
|
26
|
+
binds: binds
|
|
27
|
+
},
|
|
28
|
+
networkDisabled: true)
|
|
30
29
|
end
|
|
31
30
|
|
|
32
31
|
def run!
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
module Mumukit::Metatest
|
|
2
2
|
class InteractiveChecker < Checker
|
|
3
3
|
|
|
4
|
-
def initialize(request)
|
|
4
|
+
def initialize(request, strip_mode: :left_and_right)
|
|
5
5
|
@request = request
|
|
6
|
+
@strip_mode = strip_mode
|
|
6
7
|
end
|
|
7
8
|
|
|
8
9
|
def check_last_query_equals(_result, goal)
|
|
9
10
|
expected = goal[:value]
|
|
10
|
-
actual =
|
|
11
|
+
actual = query
|
|
11
12
|
fail_t :check_last_query_equals, expected: expected, actual: actual unless expected == actual
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def check_last_query_matches(_result, goal)
|
|
15
|
-
|
|
16
|
-
fail_t :check_last_query_matches,
|
|
16
|
+
regexp = goal[:regexp]
|
|
17
|
+
fail_t :check_last_query_matches, regexp: regexp.inspect unless query.match?(regexp)
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
def check_last_query_fails(result, _goal)
|
|
20
21
|
fail_t :check_last_query_fails unless result[:query][:status].failed?
|
|
21
22
|
end
|
|
22
23
|
|
|
24
|
+
def check_queries_match(result, goal)
|
|
25
|
+
queries = [query] + @request.cookie.to_a
|
|
26
|
+
fail_t :check_queries_match unless goal[:regexps].all? do |regexp|
|
|
27
|
+
queries.any? { |query| query.match? regexp }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
23
31
|
def check_last_query_outputs(result, goal)
|
|
24
32
|
compare_last_query_by(:check_last_query_outputs, result, goal) { |expected, actual| expected == actual }
|
|
25
33
|
end
|
|
@@ -72,5 +80,11 @@ module Mumukit::Metatest
|
|
|
72
80
|
a_string.delete(" \t\r\n").downcase
|
|
73
81
|
end
|
|
74
82
|
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
def query
|
|
86
|
+
query_s = @request.query.to_s
|
|
87
|
+
@strip_mode == :right_only ? query_s.rstrip : query_s.strip
|
|
88
|
+
end
|
|
75
89
|
end
|
|
76
90
|
end
|
|
@@ -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
|
|
@@ -4,7 +4,7 @@ module Mumukit
|
|
|
4
4
|
request_goal = request.goal.with_indifferent_access
|
|
5
5
|
|
|
6
6
|
@goal = {postconditions: [[request_goal[:kind], request_goal]]}
|
|
7
|
-
@checker =
|
|
7
|
+
@checker = checker_for request
|
|
8
8
|
super request
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -14,6 +14,14 @@ module Mumukit
|
|
|
14
14
|
[check_results[2], check_results[1], structured_results[:query]]
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
def checker_for(request)
|
|
18
|
+
Metatest::InteractiveChecker.new request, **checker_options
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def checker_options
|
|
22
|
+
{}
|
|
23
|
+
end
|
|
24
|
+
|
|
17
25
|
required :to_structured_results
|
|
18
26
|
end
|
|
19
27
|
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.42.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-05-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -156,14 +156,14 @@ dependencies:
|
|
|
156
156
|
requirements:
|
|
157
157
|
- - "~>"
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: 1.
|
|
159
|
+
version: '1.25'
|
|
160
160
|
type: :runtime
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
|
164
164
|
- - "~>"
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: 1.
|
|
166
|
+
version: '1.25'
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
168
|
name: excon
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -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
|