Skip to content

Commit d1a3bab

Browse files
committed
feat(module-programming): show edulint messages directly
1 parent fef63e5 commit d1a3bab

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

src/api/backend/model/moduleProgramming.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface ModuleProgramming {
2222
score: number;
2323
code: string;
2424
default_code: string;
25+
edulint_source_id: string;
2526
last_time?: string;
2627
last_origin?: string;
2728
}

src/app/components/tasks/task-module/task-module-programming/task-module-programming.component.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ <h6 class="report-heading">{{'tasks.module.programming.run-result'|translate}}</
2929
<div class="problems">
3030
{{'tasks.module.programming.lint.problems-found'|translate:{count: lintReport.problems.length} }}
3131
</div>
32+
<div>
33+
<ul>
34+
<li *ngFor="let problem of lintReport.problems">
35+
<div class="problem">
36+
line {{problem.line}}: {{problem.text}}
37+
</div>
38+
</li>
39+
</ul>
40+
</div>
3241
<div>
3342
<a
3443
class="btn btn-ksi w-100"

src/app/components/tasks/task-module/task-module-programming/task-module-programming.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222

2323
.lint-result {
24-
text-align: center;
24+
text-align: left;
2525

2626
.problems {
2727
padding-bottom: $ksi-margin-small;

src/app/components/tasks/task-module/task-module-programming/task-module-programming.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class TaskModuleProgrammingComponent implements OnInit, OnDestroy {
192192

193193
lintCode(): void {
194194
this.linting$ = null;
195-
this.linting$ = this.lint.analyzeCode(this.code.value).pipe(distinct());
195+
this.linting$ = this.lint.analyzeCode(this.code.value, this.module.edulint_source_id).pipe(distinct());
196196
this.linting$.subscribe();
197197
}
198198
}

src/app/services/tasks/edulint.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export class EdulintService {
2727
this.editor = new WebService(this.httpClient, this.url, new Configuration());
2828
}
2929

30-
analyzeCode(code: string): Observable<EdulintReport> {
30+
analyzeCode(code: string, source_id?: string): Observable<EdulintReport> {
3131
code += `\n# edulint: config=${this.config}\n`;
3232

33-
return this.linter.apiCodePost({code}).pipe(
33+
return this.linter.apiCodePost({code, source_id}).pipe(
3434
take(1),
3535
shareReplay(1),
3636
catchError((e) => {

0 commit comments

Comments
 (0)