Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoCLI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
UI
DojoCLI
Commits
f4ed114b
Commit
f4ed114b
authored
10 months ago
by
joel.vonderwe
Committed by
michael.minelli
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
Add allowSonarFailure feature
parent
677d512e
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#38943
passed
1 month ago
Stage: code_quality
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts
+3
-2
3 additions, 2 deletions
...mmander/assignment/subcommands/AssignmentCreateCommand.ts
NodeApp/src/managers/DojoBackendManager.ts
+8
-7
8 additions, 7 deletions
NodeApp/src/managers/DojoBackendManager.ts
with
11 additions
and
9 deletions
NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts
+
3
−
2
View file @
f4ed114b
...
...
@@ -12,7 +12,7 @@ import SharedSonarManager from '../../../shared/managers/SharedSonarManager';
import
{
Option
}
from
'
commander
'
;
type
CommandOptions
=
{
name
:
string
,
language
:
string
,
template
?:
string
,
members_id
?:
Array
<
number
>
,
members_username
?:
Array
<
string
>
,
clone
?:
string
|
boolean
,
sonar
?:
boolean
,
gate
?:
string
,
profile
?:
string
[]
}
type
CommandOptions
=
{
name
:
string
,
language
:
string
,
template
?:
string
,
members_id
?:
Array
<
number
>
,
members_username
?:
Array
<
string
>
,
clone
?:
string
|
boolean
,
sonar
?:
boolean
,
sonarStrict
:
boolean
,
gate
?:
string
,
profile
?:
string
[]
}
class
AssignmentCreateCommand
extends
CommanderCommand
{
...
...
@@ -39,6 +39,7 @@ class AssignmentCreateCommand extends CommanderCommand {
if
(
SharedConfig
.
sonar
.
enabled
)
{
this
.
command
.
requiredOption
(
'
-s, --sonar
'
,
'
add sonar to the code checking process for assignment and exercises
'
)
.
requiredOption
(
'
-d, --no-sonar
'
,
'
disable sonar for the code checking process for assignment and exercises
'
)
.
addOption
(
new
Option
(
'
--sonar-strict
'
,
'
force the sonar gate to pass to validate the exercise results
'
).
default
(
false
).
implies
({
sonar
:
true
}))
.
addOption
(
new
Option
(
'
-g, --gate <gate>
'
,
'
quality gate for sonar
'
).
implies
({
sonar
:
true
}))
.
addOption
(
new
Option
(
'
-p, --profile <profile...>
'
,
'
quality profiles for sonar
'
).
default
([]).
implies
({
sonar
:
true
}));
}
...
...
@@ -126,7 +127,7 @@ class AssignmentCreateCommand extends CommanderCommand {
private
async
createAssignment
(
options
:
CommandOptions
)
{
console
.
log
(
TextStyle
.
BLOCK
(
'
Please wait while we are creating the assignment (approximately 10 seconds)...
'
));
this
.
assignment
=
await
DojoBackendManager
.
createAssignment
(
options
.
name
,
options
.
language
,
this
.
members
!
,
this
.
templateIdOrNamespace
,
this
.
sonar
,
this
.
sonarGate
,
this
.
sonarProfiles
);
this
.
assignment
=
await
DojoBackendManager
.
createAssignment
(
options
.
name
,
options
.
language
,
this
.
members
!
,
this
.
templateIdOrNamespace
,
this
.
sonar
,
!
options
.
sonarStrict
,
this
.
sonarGate
,
this
.
sonarProfiles
);
const
oraInfo
=
(
message
:
string
)
=>
{
ora
({
...
...
This diff is collapsed.
Click to expand it.
NodeApp/src/managers/DojoBackendManager.ts
+
8
−
7
View file @
f4ed114b
...
...
@@ -250,7 +250,7 @@ class DojoBackendManager {
}
}
public
async
createAssignment
(
name
:
string
,
language
:
string
,
members
:
Array
<
Gitlab
.
UserSchema
>
,
templateIdOrNamespace
:
string
|
null
,
sonar
:
boolean
=
false
,
sonarGate
:
string
|
undefined
=
undefined
,
sonarProfiles
:
string
[]
=
[],
verbose
:
boolean
=
true
):
Promise
<
Assignment
>
{
public
async
createAssignment
(
name
:
string
,
language
:
string
,
members
:
Array
<
Gitlab
.
UserSchema
>
,
templateIdOrNamespace
:
string
|
null
,
sonar
:
boolean
=
false
,
allowSonarFailure
:
boolean
=
false
,
sonarGate
:
string
|
undefined
=
undefined
,
sonarProfiles
:
string
[]
=
[],
verbose
:
boolean
=
true
):
Promise
<
Assignment
>
{
const
spinner
:
ora
.
Ora
=
ora
(
'
Creating assignment...
'
);
if
(
verbose
)
{
...
...
@@ -259,12 +259,13 @@ class DojoBackendManager {
try
{
const
response
=
await
axios
.
post
<
DojoBackendResponse
<
Assignment
>>
(
DojoBackendHelper
.
getApiUrl
(
ApiRoute
.
ASSIGNMENT_CREATE
),
Object
.
assign
({
name
:
name
,
language
:
language
,
members
:
JSON
.
stringify
(
members
),
useSonar
:
String
(
sonar
),
sonarGate
:
sonarGate
??
''
,
sonarProfiles
:
JSON
.
stringify
(
sonarProfiles
)
name
:
name
,
language
:
language
,
members
:
JSON
.
stringify
(
members
),
useSonar
:
String
(
sonar
),
allowSonarFailure
:
String
(
allowSonarFailure
),
sonarGate
:
sonarGate
??
''
,
sonarProfiles
:
JSON
.
stringify
(
sonarProfiles
),
},
templateIdOrNamespace
?
{
template
:
templateIdOrNamespace
}
:
{}));
if
(
verbose
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment