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
dfe11ad2
Commit
dfe11ad2
authored
1 year ago
by
joel.vonderwe
Committed by
michael.minelli
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add profiles/gate options for sonar
parent
32c4b92f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts
+11
-3
11 additions, 3 deletions
...mmander/assignment/subcommands/AssignmentCreateCommand.ts
NodeApp/src/managers/DojoBackendManager.ts
+4
-2
4 additions, 2 deletions
NodeApp/src/managers/DojoBackendManager.ts
with
15 additions
and
5 deletions
NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts
+
11
−
3
View file @
dfe11ad2
...
@@ -9,9 +9,10 @@ import * as Gitlab from '@gitbeaker/rest';
...
@@ -9,9 +9,10 @@ import * as Gitlab from '@gitbeaker/rest';
import
TextStyle
from
'
../../../types/TextStyle.js
'
;
import
TextStyle
from
'
../../../types/TextStyle.js
'
;
import
Config
from
'
../../../config/Config
'
;
import
Config
from
'
../../../config/Config
'
;
import
SharedSonarManager
from
'
../../../shared/managers/SharedSonarManager
'
;
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
}
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
[]
}
class
AssignmentCreateCommand
extends
CommanderCommand
{
class
AssignmentCreateCommand
extends
CommanderCommand
{
...
@@ -21,6 +22,8 @@ class AssignmentCreateCommand extends CommanderCommand {
...
@@ -21,6 +22,8 @@ class AssignmentCreateCommand extends CommanderCommand {
private
templateIdOrNamespace
:
string
|
null
=
null
;
private
templateIdOrNamespace
:
string
|
null
=
null
;
private
assignment
!
:
Assignment
;
private
assignment
!
:
Assignment
;
private
sonar
:
boolean
=
false
;
private
sonar
:
boolean
=
false
;
private
sonarGate
:
string
|
undefined
=
undefined
;
private
sonarProfiles
:
string
[]
=
[];
protected
defineCommand
()
{
protected
defineCommand
()
{
this
.
command
this
.
command
...
@@ -34,7 +37,9 @@ class AssignmentCreateCommand extends CommanderCommand {
...
@@ -34,7 +37,9 @@ class AssignmentCreateCommand extends CommanderCommand {
.
action
(
this
.
commandAction
.
bind
(
this
));
.
action
(
this
.
commandAction
.
bind
(
this
));
if
(
SharedConfig
.
sonar
.
enabled
)
{
if
(
SharedConfig
.
sonar
.
enabled
)
{
this
.
command
.
requiredOption
(
'
-s, --sonar
'
,
'
add sonar to the code checking process for exercises derived from the assignment
'
);
this
.
command
.
requiredOption
(
'
-s, --sonar
'
,
'
add sonar to the code checking process for exercises derived from the assignment
'
)
.
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
}));
}
}
}
}
...
@@ -56,6 +61,9 @@ class AssignmentCreateCommand extends CommanderCommand {
...
@@ -56,6 +61,9 @@ class AssignmentCreateCommand extends CommanderCommand {
throw
new
Error
();
throw
new
Error
();
}
}
assignmentGetSonarSpinner
.
succeed
(
`Sonar is supported by the server`
);
assignmentGetSonarSpinner
.
succeed
(
`Sonar is supported by the server`
);
this
.
sonarGate
=
options
.
gate
;
this
.
sonarProfiles
=
options
.
profile
??
[];
}
}
const
assignmentGetSpinner
:
ora
.
Ora
=
ora
(
'
Checking assignment name availability
'
).
start
();
const
assignmentGetSpinner
:
ora
.
Ora
=
ora
(
'
Checking assignment name availability
'
).
start
();
...
@@ -103,7 +111,7 @@ class AssignmentCreateCommand extends CommanderCommand {
...
@@ -103,7 +111,7 @@ class AssignmentCreateCommand extends CommanderCommand {
private
async
createAssignment
(
options
:
CommandOptions
)
{
private
async
createAssignment
(
options
:
CommandOptions
)
{
console
.
log
(
TextStyle
.
BLOCK
(
'
Please wait while we are creating the assignment (approximately 10 seconds)...
'
));
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
.
assignment
=
await
DojoBackendManager
.
createAssignment
(
options
.
name
,
options
.
language
,
this
.
members
!
,
this
.
templateIdOrNamespace
,
this
.
sonar
,
this
.
sonarGate
,
this
.
sonarProfiles
);
const
oraInfo
=
(
message
:
string
)
=>
{
const
oraInfo
=
(
message
:
string
)
=>
{
ora
({
ora
({
...
...
This diff is collapsed.
Click to expand it.
NodeApp/src/managers/DojoBackendManager.ts
+
4
−
2
View file @
dfe11ad2
...
@@ -247,7 +247,7 @@ class DojoBackendManager {
...
@@ -247,7 +247,7 @@ class DojoBackendManager {
}
}
}
}
public
async
createAssignment
(
name
:
string
,
language
:
string
,
members
:
Array
<
Gitlab
.
UserSchema
>
,
templateIdOrNamespace
:
string
|
null
,
sonar
:
boolean
=
false
,
verbose
:
boolean
=
true
):
Promise
<
Assignment
>
{
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
>
{
const
spinner
:
ora
.
Ora
=
ora
(
'
Creating assignment...
'
);
const
spinner
:
ora
.
Ora
=
ora
(
'
Creating assignment...
'
);
if
(
verbose
)
{
if
(
verbose
)
{
...
@@ -259,7 +259,9 @@ class DojoBackendManager {
...
@@ -259,7 +259,9 @@ class DojoBackendManager {
name
:
name
,
name
:
name
,
language
:
language
,
language
:
language
,
members
:
JSON
.
stringify
(
members
),
members
:
JSON
.
stringify
(
members
),
useSonar
:
String
(
sonar
)
useSonar
:
String
(
sonar
),
sonarGate
:
sonarGate
??
''
,
sonarProfiles
:
JSON
.
stringify
(
sonarProfiles
),
},
templateIdOrNamespace
?
{
template
:
templateIdOrNamespace
}
:
{}));
},
templateIdOrNamespace
?
{
template
:
templateIdOrNamespace
}
:
{}));
if
(
verbose
)
{
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