diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 44a306e..1f379b3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # Fix end of files - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.4.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -9,38 +9,21 @@ repos: args: - '--fix=lf' - # Remove unused imports/variables - - repo: https://github.com/myint/autoflake - rev: v1.4 + # Lint and format + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.1.4 hooks: - - id: autoflake - args: - - "--in-place" - - "--remove-all-unused-imports" - - "--remove-unused-variables" - - "--exclude=__init__.py" - - # Sort imports - - repo: https://github.com/pycqa/isort - rev: "5.12.0" - hooks: - - id: isort - args: ["--profile", "black"] + # Run the linter. + - id: ruff + args: [ --fix ] - # Black formatting - - repo: https://github.com/psf/black - rev: 22.3.0 - hooks: - - id: black - - # Lint files - - repo: https://github.com/pycqa/flake8 - rev: "3.9.0" - hooks: - - id: flake8 + # Run the formatter. + - id: ruff-format + # Static type-checking with mypy - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.3.0' + rev: 'v1.10.0' hooks: - id: mypy additional_dependencies: [] diff --git a/libqfieldsync/offline_converter.py b/libqfieldsync/offline_converter.py index 8d9ebd2..5cb8d90 100644 --- a/libqfieldsync/offline_converter.py +++ b/libqfieldsync/offline_converter.py @@ -93,7 +93,6 @@ def __init__( create_basemap: bool = True, dirs_to_copy: Optional[Dict[str, bool]] = None, ): - super(OfflineConverter, self).__init__(parent=None) self.__max_task_progress = 0 self.__convertor_progress = None # for processing feedback diff --git a/libqfieldsync/project_checker.py b/libqfieldsync/project_checker.py index decdc6e..66c0c52 100644 --- a/libqfieldsync/project_checker.py +++ b/libqfieldsync/project_checker.py @@ -39,7 +39,6 @@ def __init__( class ProjectCheckerFeedback: - tr = QObject().tr def __init__(self) -> None: @@ -63,7 +62,6 @@ def add(self, feedback: Feedback): class ProjectChecker: - tr = QObject().tr class CheckConfig(TypedDict): diff --git a/libqfieldsync/utils/exceptions.py b/libqfieldsync/utils/exceptions.py index ce1cc93..65c8ed1 100644 --- a/libqfieldsync/utils/exceptions.py +++ b/libqfieldsync/utils/exceptions.py @@ -51,6 +51,5 @@ def __init__(self, message, exception=None, long_message=None, tag="QFieldSync") class NoProjectFoundError(QFieldSyncError): def __init__(self, message, exception=None, long_message=None, tag="QFieldSync"): - # Call the base class constructor with the parameters it needs super(NoProjectFoundError, self).__init__(message, exception, long_message, tag)