Skip to content

Commit

Permalink
feat(module-programming): show edulint messages directly
Browse files Browse the repository at this point in the history
  • Loading branch information
esoadamo committed Sep 4, 2024
1 parent fef63e5 commit d1a3bab
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/api/backend/model/moduleProgramming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface ModuleProgramming {
score: number;
code: string;
default_code: string;
edulint_source_id: string;
last_time?: string;
last_origin?: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ <h6 class="report-heading">{{'tasks.module.programming.run-result'|translate}}</
<div class="problems">
{{'tasks.module.programming.lint.problems-found'|translate:{count: lintReport.problems.length} }}
</div>
<div>
<ul>
<li *ngFor="let problem of lintReport.problems">
<div class="problem">
line {{problem.line}}: {{problem.text}}
</div>
</li>
</ul>
</div>
<div>
<a
class="btn btn-ksi w-100"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}

.lint-result {
text-align: center;
text-align: left;

.problems {
padding-bottom: $ksi-margin-small;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class TaskModuleProgrammingComponent implements OnInit, OnDestroy {

lintCode(): void {
this.linting$ = null;
this.linting$ = this.lint.analyzeCode(this.code.value).pipe(distinct());
this.linting$ = this.lint.analyzeCode(this.code.value, this.module.edulint_source_id).pipe(distinct());
this.linting$.subscribe();
}
}
4 changes: 2 additions & 2 deletions src/app/services/tasks/edulint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export class EdulintService {
this.editor = new WebService(this.httpClient, this.url, new Configuration());
}

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

return this.linter.apiCodePost({code}).pipe(
return this.linter.apiCodePost({code, source_id}).pipe(
take(1),
shareReplay(1),
catchError((e) => {
Expand Down

0 comments on commit d1a3bab

Please sign in to comment.