Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): use the ruff snap #4939

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ lxc exec snapcraft-dev -- sudo -iu ubuntu bash

Import your keys (`ssh-import-id`) and add a `Host` entry to your ssh config if you are interested in [Code's](https://snapcraft.io/code) [Remote-SSH](https://code.visualstudio.com/docs/remote/ssh) plugin.

### Tooling

We use a large number of tools for our project. Most of these are installed for
you with tox, but you'll need to install:

- Python 3.10 (default on Ubuntu 22.04, available on Ubuntu 24.04 through the
[deadsnakes](https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa) PPA) with setuptools.
- [tox](https://tox.wiki) version 3.8 or later
- [pyright](https://github.com/microsoft/pyright) (also available via snap: `snap install pyright`)
- [ruff](https://github.com/astral/ruff) (also available via snap: `snap install ruff`)
- [ShellCheck](https://www.shellcheck.net/) (also available via snap: `snap install shellcheck`)

### Testing

See the [Testing guide](TESTING.md).
Expand Down
6 changes: 4 additions & 2 deletions snapcraft/commands/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ def _validate(self, parsed_args: argparse.Namespace) -> None:
retcode=77,
)

def _run(self, parsed_args: argparse.Namespace, **kwargs: Any) -> int | None:
def _run( # noqa: PLR0915 [too-many-statements]
self, parsed_args: argparse.Namespace, **kwargs: Any
) -> int | None:
"""Run the remote-build command.

:param parsed_args: Snapcraft's argument namespace.
Expand Down Expand Up @@ -237,7 +239,7 @@ def _run(self, parsed_args: argparse.Namespace, **kwargs: Any) -> int | None:
emit.progress("Cancelling builds.")
builder.cancel_builds()
returncode = 0
except Exception:
except Exception: # noqa: BLE001 [blind-except]
returncode = 1 # General error on any other exception
if returncode != 75: # TimeoutError
emit.progress("Cleaning up")
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/meta/test_appstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def test_appstream_with_malformed_links(self):
assert metadata.contact == ["rrroschan@gmail.com"]
assert metadata.donation == ["https://www.buymeacoffee.com/alainm23"]
assert metadata.website == ["https://hello.com"]
assert metadata.source_code == None
assert metadata.source_code is None
assert metadata.issues == ["https://github.com/alainm23/planify/issues"]

def test_appstream_parse_error(self):
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ allowlist_externals:
ruff: ruff
commands =
black: black {tty:--color} {posargs} .
ruff: ruff --fix --respect-gitignore setup.py snapcraft tests tools
ruff: ruff --fix --config snapcraft_legacy/ruff.toml snapcraft_legacy tests/legacy
ruff: ruff check --fix --respect-gitignore setup.py snapcraft tests tools
ruff: ruff check --fix --config snapcraft_legacy/ruff.toml snapcraft_legacy tests/legacy
codespell: codespell --toml {tox_root}/pyproject.toml --write-changes {posargs}

[docs] # Sphinx documentation configuration
Expand Down
Loading