From 04d38e3271c80dc57a3704af6b5055b286c0a130 Mon Sep 17 00:00:00 2001 From: dominik003 Date: Mon, 22 Jan 2024 17:04:25 +0100 Subject: [PATCH] fix: Apply pre-commit changes --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docs.yml | 4 ++-- .github/workflows/lint.yml | 12 ++++++------ .github/workflows/push.yml | 6 +++--- .github/workflows/tests.yml | 6 +++--- .pre-commit-config.yaml | 4 ++-- .../pipeline-runs/service/pipeline-run.service.ts | 10 +++------- .../model-detail/git-model.service.ts | 7 +++---- .../move-model/move-model.component.ts | 14 ++++++-------- .../project-metadata/project-metadata.component.ts | 4 ++-- .../project-audit-log.component.ts | 4 +++- .../service/project-audit-log.service.ts | 6 +++--- .../project-users/service/project-user.service.ts | 9 ++++----- .../app/services/settings/t4c-instance.service.ts | 5 ++--- .../create-readonly-session.component.ts | 4 ++-- .../service/t4c-repos/t4c-repo.service.ts | 6 +++--- 16 files changed, 48 insertions(+), 55 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5c9799ce72..fc737ec80b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 20c1cffebc..1e376be278 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -9,8 +9,8 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: "3.11" - run: pip install mkdocs-material diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4205a897af..f9befdcd04 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,7 @@ jobs: name: Validate helm chart with linter and kubernetes yaml schemas steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install helm uses: azure/setup-helm@v3 - name: Install go @@ -34,13 +34,13 @@ jobs: run: | helm template ./helm | kubeconform -strict pre-commit: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - cache: pip - cache-dependency-path: ./backend/pyproject.toml + # cache: pip + # cache-dependency-path: ./backend/pyproject.toml python-version: "3.11" - name: Install pre-commit run: |- diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 81f59b2819..2ebb8c887b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -31,10 +31,10 @@ jobs: steps: - name: Checkout repository if: ${{ matrix.name != 'frontend' && matrix.name != 'backend' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checkout repository if: ${{ matrix.name == 'frontend' || matrix.name == 'backend' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Fetch version @@ -74,7 +74,7 @@ jobs: name: Install chart in kind cluster steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install helm uses: azure/setup-helm@v3 - name: Extract metadata for Docker diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e593f03793..41bc656254 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,11 +15,11 @@ jobs: name: Run pytest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: cache: pip cache-dependency-path: ./backend/pyproject.toml @@ -40,7 +40,7 @@ jobs: name: Run frontend karma tests steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-node@v3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 173579ff2d..a2c835d239 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -148,8 +148,8 @@ repos: - "@typescript-eslint/parser@^6.19.0" - "eslint-plugin-unused-imports@^3.0.0" - "eslint-plugin-deprecation@^2.0.0" - - "eslint-plugin-tailwindcss@^3.13.1" - args: ["--fix"] + - "eslint-plugin-tailwindcss@3.13.1" + args: ["--fix", "--config", "./frontend/.eslintrc.js"] types: [] exclude: '.+\.spec(-helper)?\.ts$' types_or: ["html", "ts"] diff --git a/frontend/src/app/projects/models/backup-settings/pipeline-runs/service/pipeline-run.service.ts b/frontend/src/app/projects/models/backup-settings/pipeline-runs/service/pipeline-run.service.ts index 5dc2db1937..ba8b18e8e0 100644 --- a/frontend/src/app/projects/models/backup-settings/pipeline-runs/service/pipeline-run.service.ts +++ b/frontend/src/app/projects/models/backup-settings/pipeline-runs/service/pipeline-run.service.ts @@ -125,13 +125,9 @@ export class PipelineRunService { this.setPipelineRunPageStatusToLoading(page); this.http - .get>( - `${this.urlFactory( - projectSlug, - modelSlug, - pipelineID, - )}?page=${page}&size=${size}`, - ) + .get< + Page + >(`${this.urlFactory(projectSlug, modelSlug, pipelineID)}?page=${page}&size=${size}`) .subscribe((pipelineRuns) => { const pipelineRunPages = this._pipelineRunPages.getValue(); pipelineRunPages.pages[page - 1] = pipelineRuns; diff --git a/frontend/src/app/projects/project-detail/model-overview/model-detail/git-model.service.ts b/frontend/src/app/projects/project-detail/model-overview/model-detail/git-model.service.ts index 04c760add5..8061562933 100644 --- a/frontend/src/app/projects/project-detail/model-overview/model-detail/git-model.service.ts +++ b/frontend/src/app/projects/project-detail/model-overview/model-detail/git-model.service.ts @@ -26,10 +26,9 @@ export class GitModelService { loadGitModels(project_slug: string, model_slug: string): void { this.http - .get>( - this.BACKEND_URL_PREFIX + - `/projects/${project_slug}/models/${model_slug}/modelsources/git`, - ) + .get< + Array + >(this.BACKEND_URL_PREFIX + `/projects/${project_slug}/models/${model_slug}/modelsources/git`) .subscribe((gitModels) => this._gitModels.next(gitModels)); } diff --git a/frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.ts b/frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.ts index 3fdb334a9d..20c08eaeec 100644 --- a/frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.ts +++ b/frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.ts @@ -41,9 +41,8 @@ export class MoveModelComponent { ) { this.projectService.loadProjectsForRole('manager'); this.filteredProjects$ = projectService.projects$.pipe( - map( - (projects) => - projects?.filter((project) => project.slug !== data.projectSlug), + map((projects) => + projects?.filter((project) => project.slug !== data.projectSlug), ), ); } @@ -85,11 +84,10 @@ export class MoveModelComponent { return this.filteredProjects$; } return this.filteredProjects$.pipe( - map( - (projects) => - projects?.filter((project) => - project.slug.toLowerCase().includes(this.search.toLowerCase()), - ), + map((projects) => + projects?.filter((project) => + project.slug.toLowerCase().includes(this.search.toLowerCase()), + ), ), ); } diff --git a/frontend/src/app/projects/project-detail/project-metadata/project-metadata.component.ts b/frontend/src/app/projects/project-detail/project-metadata/project-metadata.component.ts index 85ac1d11a3..a6a3ecda83 100644 --- a/frontend/src/app/projects/project-detail/project-metadata/project-metadata.component.ts +++ b/frontend/src/app/projects/project-detail/project-metadata/project-metadata.component.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Router } from '@angular/router'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; @@ -24,7 +24,7 @@ import { templateUrl: './project-metadata.component.html', styleUrls: ['./project-metadata.component.css'], }) -export class ProjectMetadataComponent { +export class ProjectMetadataComponent implements OnInit { project?: Project; canDelete = false; diff --git a/frontend/src/app/projects/project-detail/project-users/project-audit-log/project-audit-log.component.ts b/frontend/src/app/projects/project-detail/project-users/project-audit-log/project-audit-log.component.ts index ef53996fa7..e48920c1bf 100644 --- a/frontend/src/app/projects/project-detail/project-users/project-audit-log/project-audit-log.component.ts +++ b/frontend/src/app/projects/project-detail/project-users/project-audit-log/project-audit-log.component.ts @@ -4,9 +4,11 @@ */ import { + AfterViewInit, Component, ElementRef, Inject, + OnInit, QueryList, ViewChildren, } from '@angular/core'; @@ -20,7 +22,7 @@ import { ProjectAuditLogService } from 'src/app/projects/project-detail/project- styleUrls: ['./project-audit-log.component.css'], }) @UntilDestroy() -export class ProjectAuditLogComponent { +export class ProjectAuditLogComponent implements OnInit, AfterViewInit { pageSize = 25; pageSizeArray = [...Array(this.pageSize).keys()]; diff --git a/frontend/src/app/projects/project-detail/project-users/project-audit-log/service/project-audit-log.service.ts b/frontend/src/app/projects/project-detail/project-users/project-audit-log/service/project-audit-log.service.ts index 1542d9a601..264b3e5f0b 100644 --- a/frontend/src/app/projects/project-detail/project-users/project-audit-log/service/project-audit-log.service.ts +++ b/frontend/src/app/projects/project-detail/project-users/project-audit-log/service/project-audit-log.service.ts @@ -70,9 +70,9 @@ export class ProjectAuditLogService { this.setProjectEventPageStatusToLoading(page); this.http - .get>( - `${environment.backend_url}/projects/${projectSlug}/events?page=${page}&size=${size}`, - ) + .get< + Page + >(`${environment.backend_url}/projects/${projectSlug}/events?page=${page}&size=${size}`) .subscribe((projectEvents) => { const projectHistoryEventPages = this._projectHistoryEventPages.getValue(); diff --git a/frontend/src/app/projects/project-detail/project-users/service/project-user.service.ts b/frontend/src/app/projects/project-detail/project-users/service/project-user.service.ts index 4f3c325a15..4da105f8fe 100644 --- a/frontend/src/app/projects/project-detail/project-users/service/project-user.service.ts +++ b/frontend/src/app/projects/project-detail/project-users/service/project-user.service.ts @@ -50,11 +50,10 @@ export class ProjectUserService { public readonly nonAdminProjectUsers$ = this._projectUsers .asObservable() .pipe( - map( - (projectUsers) => - projectUsers?.filter( - (projectUser) => projectUser.role !== 'administrator', - ), + map((projectUsers) => + projectUsers?.filter( + (projectUser) => projectUser.role !== 'administrator', + ), ), ); diff --git a/frontend/src/app/services/settings/t4c-instance.service.ts b/frontend/src/app/services/settings/t4c-instance.service.ts index 7832642349..bcccffdc78 100644 --- a/frontend/src/app/services/settings/t4c-instance.service.ts +++ b/frontend/src/app/services/settings/t4c-instance.service.ts @@ -67,9 +67,8 @@ export class T4CInstanceService { public readonly t4cInstance$ = this._t4cInstance.asObservable(); public readonly unarchivedT4cInstances$ = this._t4cInstances.pipe( - map( - (t4cInstances) => - t4cInstances?.filter((t4cInstance) => !t4cInstance.is_archived), + map((t4cInstances) => + t4cInstances?.filter((t4cInstance) => !t4cInstance.is_archived), ), ); diff --git a/frontend/src/app/sessions/user-sessions-wrapper/create-session/create-readonly-session/create-readonly-session.component.ts b/frontend/src/app/sessions/user-sessions-wrapper/create-session/create-readonly-session/create-readonly-session.component.ts index 254fb7ec86..40074b0efa 100644 --- a/frontend/src/app/sessions/user-sessions-wrapper/create-session/create-readonly-session/create-readonly-session.component.ts +++ b/frontend/src/app/sessions/user-sessions-wrapper/create-session/create-readonly-session/create-readonly-session.component.ts @@ -103,8 +103,8 @@ export class CreateReadonlySessionComponent implements OnInit { this.toolService.getVersionsForTool(tool.id).subscribe((toolVersions) => { const toolVersionIds = this.models?.map((m) => m.version?.id); - this.toolVersions = toolVersions.filter( - (v) => toolVersionIds?.includes(v.id), + this.toolVersions = toolVersions.filter((v) => + toolVersionIds?.includes(v.id), ); }); } diff --git a/frontend/src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service.ts b/frontend/src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service.ts index 8630394648..1b8551c5e3 100644 --- a/frontend/src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service.ts +++ b/frontend/src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service.ts @@ -39,9 +39,9 @@ export class T4CRepoService { loadRepositories(instanceId: number): void { this.http - .get( - `${this.t4cInstanceService.urlFactory(instanceId)}/repositories/`, - ) + .get< + T4CServerRepository[] + >(`${this.t4cInstanceService.urlFactory(instanceId)}/repositories/`) .subscribe({ next: (repositories) => this._repositories.next(repositories), error: () => this._repositories.next(undefined),