diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f69f34d1..b409547c 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,32 +9,14 @@ 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 diff --git a/qfieldsync/__init__.py b/qfieldsync/__init__.py index 3150acca..dbd1d545 100644 --- a/qfieldsync/__init__.py +++ b/qfieldsync/__init__.py @@ -24,11 +24,9 @@ from __future__ import absolute_import -import os import pathlib import sys -import qgis.utils src_dir = pathlib.Path(__file__).parent.resolve() diff --git a/qfieldsync/core/cloud_api.py b/qfieldsync/core/cloud_api.py index e5b4cb24..05040fc6 100644 --- a/qfieldsync/core/cloud_api.py +++ b/qfieldsync/core/cloud_api.py @@ -115,7 +115,6 @@ def from_reply(reply: QNetworkReply) -> Optional[CloudException]: class CloudNetworkAccessManager(QObject): - token_changed = pyqtSignal() login_finished = pyqtSignal() logout_success = pyqtSignal() @@ -726,7 +725,6 @@ def __init__(self, reply: QNetworkReply): class CloudProjectsCache(QObject): - projects_started = pyqtSignal() projects_updated = pyqtSignal() projects_error = pyqtSignal(str) diff --git a/qfieldsync/core/cloud_converter.py b/qfieldsync/core/cloud_converter.py index 4374fd1c..bd6560e3 100644 --- a/qfieldsync/core/cloud_converter.py +++ b/qfieldsync/core/cloud_converter.py @@ -42,7 +42,6 @@ def __init__( project: QgsProject, export_dirname: str, ): - super(CloudConverter, self).__init__(parent=None) self.project = project self.__layers = list() diff --git a/qfieldsync/core/cloud_transferrer.py b/qfieldsync/core/cloud_transferrer.py index 440149ec..0d821444 100644 --- a/qfieldsync/core/cloud_transferrer.py +++ b/qfieldsync/core/cloud_transferrer.py @@ -400,7 +400,6 @@ def _on_logout_success(self) -> None: class FileTransfer(QObject): - progress = pyqtSignal(int, int) finished = pyqtSignal() diff --git a/qfieldsync/gui/cloud_transfer_dialog.py b/qfieldsync/gui/cloud_transfer_dialog.py index 43118813..da51b940 100644 --- a/qfieldsync/gui/cloud_transfer_dialog.py +++ b/qfieldsync/gui/cloud_transfer_dialog.py @@ -183,9 +183,7 @@ def showEvent(self, event: QShowEvent) -> None: else: self.show_project_local_dir_selection() else: - if ( - self.network_manager.projects_cache.is_currently_open_project_cloud_local - ): + if self.network_manager.projects_cache.is_currently_open_project_cloud_local: reply = self.network_manager.projects_cache.refresh() reply.finished.connect(lambda: self.show_project_compatibility_page()) diff --git a/qfieldsync/tests/__init__.py b/qfieldsync/tests/__init__.py index a5e1e58a..d2c04fe3 100644 --- a/qfieldsync/tests/__init__.py +++ b/qfieldsync/tests/__init__.py @@ -19,9 +19,10 @@ ***************************************************************************/ """ +# TODO check if this file should have any contents at all??? # import qgis libs so that ve set the correct sip api version -import pkgutil +import pkgutil # pylint: disable=W0611 # NOQA import qgis # pylint: disable=W0611 # NOQA -import qfieldsync +import qfieldsync # pylint: disable=W0611 # NOQA