Skip to content

Commit

Permalink
Replace flake8 with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
wylee committed Dec 9, 2022
1 parent f3ccd69 commit 5e42108
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 17 deletions.
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

8 changes: 4 additions & 4 deletions commands.py
Expand Up @@ -40,9 +40,9 @@ def activate_venv(root="./.venv"):
os.environ["VIRTUAL_ENV"] = os.path.abspath(venv_root)
for path in glob.glob(venv_site_packages):
sys.path.insert(0, path)
sys.stderr.write(f"activated\n")
sys.stderr.write("activated\n")
return True
sys.stderr.write(f"FAILED\n")
sys.stderr.write("FAILED\n")
return False

if not activate_venv():
Expand Down Expand Up @@ -147,7 +147,7 @@ def install_completion(
if overwrite:
printer.info(f"Overwriting:\n {destination}")
else:
confirm(f"File exists. Overwrite?", abort_on_unconfirmed=True)
confirm("File exists. Overwrite?", abort_on_unconfirmed=True)

_copy_file(source, destination, template=template_type, context=template_context)
printer.info(f"Installed; remember to:\n source {destination}")
Expand Down Expand Up @@ -241,7 +241,7 @@ def lint(
):
result = local(
(
"flake8",
"ruff",
".",
"--ignore=" if disable_ignore else None,
"--disable-noqa" if disable_noqa else None,
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Expand Up @@ -29,10 +29,10 @@ rich = ">=10"
toml = ">=0.10"
"com.wyattbaldwin.cached_property" = "^1.0"

[tool.poetry.dev-dependencies]
black = { version = "*", allow-prereleases = true }
[tool.poetry.group.dev.dependencies]
black = "*"
coverage = "*"
flake8 = "<3.8"
ruff = "*"
Sphinx = "*"
tox = "*"
twine = "*"
Expand All @@ -51,6 +51,9 @@ target-version = ["py36"]
[tool.make-release.args]
test-command = "run test"

[tool.ruff]
ignore = [ "F722", "F821" ]

[tool.runcommands.globals]
package = "runcommands"
distribution = "{{ package }}"
Expand Down
2 changes: 1 addition & 1 deletion src/runcommands/args.py
Expand Up @@ -464,7 +464,7 @@ def convert_value(self, value: str):
elif value in ("0", "false"):
return False
if self.is_bool:
raise ValueError(f"Bool value must be one of 1, true, 0, or false")
raise ValueError("Bool value must be one of 1, true, 0, or false")
converter = self.add_argument_args[1]["type"]
value = converter(value)
return value
Expand Down
2 changes: 1 addition & 1 deletion src/runcommands/commands/__init__.py
@@ -1,4 +1,4 @@
# flake8: noqa: F401
# ruff: noqa: F401
from .copy_file import copy_file
from .git_version import git_version
from .local import local
Expand Down
9 changes: 8 additions & 1 deletion src/runcommands/util/misc.py
Expand Up @@ -45,7 +45,14 @@ def flatten_args(args: list, join=False, *, empty=(None, [], (), "")) -> list:
[]
>>> flatten_args([(), (), [(), ()]])
[]
>>> flatten_args(['executable', '--flag' if True else None, ('--option', 'value'), [None]])
>>> flatten_args(
... [
... 'executable',
... '--flag' if True else None,
... ('--option', 'value'),
... [None],
... ]
... )
['executable', '--flag', '--option', 'value']
>>> flatten_args(['executable', '--option', 0])
['executable', '--option', '0']
Expand Down
5 changes: 4 additions & 1 deletion src/runcommands/util/path.py
Expand Up @@ -83,7 +83,10 @@ def asset_path(path, format_kwargs={}, keep_slash=False):
True
>>> asset_path('runcommands.util:path.py') == file_path
True
>>> asset_path('runcommands.util:{name}.py', format_kwargs={'name': 'path'}) == file_path
>>> asset_path(
... 'runcommands.util:{name}.py',
... format_kwargs={'name': 'path'}
... ) == file_path
True
>>> asset_path('runcommands.util:dir/') == (dir_name + '/dir')
True
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Expand Up @@ -5,8 +5,8 @@ isolated_build = true
[testenv]
deps =
.
flake8<3.8
ruff
com.wyattbaldwin.make_release
commands =
python -m unittest discover .
flake8 .
ruff .

0 comments on commit 5e42108

Please sign in to comment.