Skip to content

Commit

Permalink
Ci/ruff (#2592)
Browse files Browse the repository at this point in the history
Ci/ruff

If I have to rebase this once again, I'll die rebasing…

Reviewed-by: Nikola Forró
Reviewed-by: Laura Barcziová
Reviewed-by: Matej Focko
  • Loading branch information
softwarefactory-project-zuul[bot] authored Oct 22, 2024
2 parents dad4f62 + 47b45d8 commit d613336
Show file tree
Hide file tree
Showing 208 changed files with 6,252 additions and 4,669 deletions.
18 changes: 6 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ repos:
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
Expand All @@ -35,14 +31,6 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
args:
- --max-line-length=100
- --per-file-ignores=files/packit.wsgi:F401,E402
- --extend-ignore=E701 # conflicting with black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
Expand Down Expand Up @@ -128,3 +116,9 @@ repos:
- LICENSE_HEADER.txt
- --comment-style
- "#"
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.291
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
10 changes: 3 additions & 7 deletions alembic/env.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
from logging.config import fileConfig

from alembic import context
from sqlalchemy import engine_from_config
from sqlalchemy import pool

from typing import TYPE_CHECKING

from packit_service.models import Base
from packit_service.models import get_pg_url
from sqlalchemy import engine_from_config, pool

from alembic import context
from packit_service.models import Base, get_pg_url

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "002ab85fa213"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@
import enum
from datetime import datetime
from typing import TYPE_CHECKING
from packit_service.models import ProjectAndEventsConnector

import sqlalchemy as sa
from alembic import op
from sqlalchemy import (
JSON,
Boolean,
Column,
DateTime,
Enum,
ForeignKey,
Integer,
JSON,
String,
Text,
orm,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship

from alembic import op
from packit_service.models import ProjectAndEventsConnector

if TYPE_CHECKING:
if TYPE_CHECKING: # noqa: SIM108
Base = object
else:
Base = declarative_base()
Expand Down Expand Up @@ -203,10 +203,12 @@ class SRPMBuildModel(ProjectAndEventsConnector, Base):
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"srpm_builds", sa.Column("build_finished_time", sa.DateTime(), nullable=True)
"srpm_builds",
sa.Column("build_finished_time", sa.DateTime(), nullable=True),
)
op.add_column(
"srpm_builds", sa.Column("build_start_time", sa.DateTime(), nullable=True)
"srpm_builds",
sa.Column("build_start_time", sa.DateTime(), nullable=True),
)
op.add_column("srpm_builds", sa.Column("commit_sha", sa.String(), nullable=True))
op.add_column("srpm_builds", sa.Column("copr_build_id", sa.String(), nullable=True))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "1bc90fcab3e1"
Expand Down
2 changes: 1 addition & 1 deletion alembic/versions/242a0cdb6d23_create_oshscanmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "242a0cdb6d23"
Expand Down
2 changes: 1 addition & 1 deletion alembic/versions/258490f6e667_initial_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "258490f6e667"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "28beb389d27a"
Expand All @@ -20,7 +20,8 @@
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"copr_builds", sa.Column("task_accepted_time", sa.DateTime(), nullable=True)
"copr_builds",
sa.Column("task_accepted_time", sa.DateTime(), nullable=True),
)
# ### end Alembic commands ###

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "2ad985cecd79"
Expand All @@ -20,7 +20,8 @@
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"project_events", sa.Column("packages_config", sa.JSON(), nullable=True)
"project_events",
sa.Column("packages_config", sa.JSON(), nullable=True),
)
# ### end Alembic commands ###

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "2fdbdcd581f5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "307a4c43ae47"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "31111f804dec"
Expand All @@ -20,7 +20,8 @@
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"git_projects", sa.Column("onboarded_downstream", sa.Boolean(), nullable=True)
"git_projects",
sa.Column("onboarded_downstream", sa.Boolean(), nullable=True),
)
# ### end Alembic commands ###

Expand Down
38 changes: 29 additions & 9 deletions alembic/versions/320c791746f0_more_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "320c791746f0"
Expand All @@ -26,17 +26,29 @@ def upgrade():
unique=False,
)
op.create_index(
op.f("ix_git_branches_project_id"), "git_branches", ["project_id"], unique=False
op.f("ix_git_branches_project_id"),
"git_branches",
["project_id"],
unique=False,
)
op.drop_column("git_projects", "https_url")
op.create_index(
op.f("ix_job_triggers_trigger_id"), "job_triggers", ["trigger_id"], unique=False
op.f("ix_job_triggers_trigger_id"),
"job_triggers",
["trigger_id"],
unique=False,
)
op.create_index(
op.f("ix_pipelines_copr_build_id"), "pipelines", ["copr_build_id"], unique=False
op.f("ix_pipelines_copr_build_id"),
"pipelines",
["copr_build_id"],
unique=False,
)
op.create_index(
op.f("ix_pipelines_koji_build_id"), "pipelines", ["koji_build_id"], unique=False
op.f("ix_pipelines_koji_build_id"),
"pipelines",
["koji_build_id"],
unique=False,
)
op.create_index(
op.f("ix_pipelines_propose_downstream_run_id"),
Expand All @@ -45,10 +57,16 @@ def upgrade():
unique=False,
)
op.create_index(
op.f("ix_pipelines_srpm_build_id"), "pipelines", ["srpm_build_id"], unique=False
op.f("ix_pipelines_srpm_build_id"),
"pipelines",
["srpm_build_id"],
unique=False,
)
op.create_index(
op.f("ix_pipelines_test_run_id"), "pipelines", ["test_run_id"], unique=False
op.f("ix_pipelines_test_run_id"),
"pipelines",
["test_run_id"],
unique=False,
)
op.create_index(
op.f("ix_project_issues_project_id"),
Expand Down Expand Up @@ -79,7 +97,8 @@ def downgrade():
op.drop_index(op.f("ix_pipelines_test_run_id"), table_name="pipelines")
op.drop_index(op.f("ix_pipelines_srpm_build_id"), table_name="pipelines")
op.drop_index(
op.f("ix_pipelines_propose_downstream_run_id"), table_name="pipelines"
op.f("ix_pipelines_propose_downstream_run_id"),
table_name="pipelines",
)
op.drop_index(op.f("ix_pipelines_koji_build_id"), table_name="pipelines")
op.drop_index(op.f("ix_pipelines_copr_build_id"), table_name="pipelines")
Expand All @@ -90,6 +109,7 @@ def downgrade():
)
op.drop_index(op.f("ix_git_branches_project_id"), table_name="git_branches")
op.drop_index(
op.f("ix_copr_build_targets_commit_sha"), table_name="copr_build_targets"
op.f("ix_copr_build_targets_commit_sha"),
table_name="copr_build_targets",
)
# ### end Alembic commands ###
1 change: 0 additions & 1 deletion alembic/versions/376bdebc4180_update_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from alembic import op


# revision identifiers, used by Alembic.
revision = "376bdebc4180"
down_revision = "3aa397e3adac"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "3aa397e3adac"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from alembic import op


# revision identifiers, used by Alembic.
revision = "3de8647515ae"
down_revision = "99841c3f8ba8"
Expand All @@ -22,14 +21,14 @@ def upgrade():

def downgrade():
op.execute(
"ALTER TYPE syncreleasetargetstatus RENAME TO syncreleasetargetstatus_old"
"ALTER TYPE syncreleasetargetstatus RENAME TO syncreleasetargetstatus_old",
)
op.execute(
"CREATE TYPE syncreleasetargetstatus AS ENUM "
"('queued', 'running', 'error', 'retry', 'submitted')"
"('queued', 'running', 'error', 'retry', 'submitted')",
)
op.execute(
"ALTER TABLE sync_release_run_targets "
"ALTER COLUMN status TYPE syncreleasetargetstatus USING status::syncreleasetargetstatus"
"ALTER COLUMN status TYPE syncreleasetargetstatus USING status::syncreleasetargetstatus",
)
op.execute("DROP TYPE syncreleasetargetstatus_old")
4 changes: 2 additions & 2 deletions alembic/versions/4033221ea50c_rename_jobtriggermodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def upgrade():
op.execute("ALTER SEQUENCE job_triggers_id_seq RENAME TO project_events_id_seq")
op.execute("ALTER INDEX job_triggers_pkey RENAME TO project_events_pkey")
op.execute(
"ALTER INDEX ix_job_triggers_trigger_id RENAME TO ix_project_events_event_id"
"ALTER INDEX ix_job_triggers_trigger_id RENAME TO ix_project_events_event_id",
)

op.alter_column("pipelines", "job_trigger_id", new_column_name="project_event_id")
Expand All @@ -45,7 +45,7 @@ def downgrade():
op.execute("ALTER SEQUENCE project_events_id_seq RENAME TO job_triggers_id_seq")
op.execute("ALTER INDEX project_events_pkey RENAME TO job_triggers_pkey")
op.execute(
"ALTER INDEX ix_project_events_event_id RENAME TO ix_job_triggers_trigger_id"
"ALTER INDEX ix_project_events_event_id RENAME TO ix_job_triggers_trigger_id",
)

op.alter_column("pipelines", "project_event_id", new_column_name="job_trigger_id")
Expand Down
7 changes: 5 additions & 2 deletions alembic/versions/4292b00185bf_whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "4292b00185bf"
Expand Down Expand Up @@ -36,7 +36,10 @@ def upgrade():
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_whitelist_account_name"), "whitelist", ["account_name"], unique=False
op.f("ix_whitelist_account_name"),
"whitelist",
["account_name"],
unique=False,
)
# ### end Alembic commands ###

Expand Down
Loading

0 comments on commit d613336

Please sign in to comment.