Skip to content

Commit

Permalink
ENH: add display as allowed function name (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer authored Aug 5, 2024
1 parent bd6d69b commit 563570c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/compwa_policy/check_dev_files/ruff.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def _update_ruff_config(
do(__update_ruff_format_settings, pyproject)
do(__update_ruff_lint_settings, pyproject)
do(__update_per_file_ignores, pyproject, has_notebooks)
if has_notebooks:
do(__update_flake8_builtins, pyproject)
do(__update_isort_settings, pyproject)
do(__update_pydocstyle_settings, pyproject)
do(__remove_nbqa, precommit, pyproject)
Expand Down Expand Up @@ -475,6 +477,18 @@ def ___get_existing_nbqa_ignores(pyproject: Pyproject) -> set[str]:
}


def __update_flake8_builtins(pyproject: ModifiablePyproject) -> None:
# cspell:ignore ignorelist
settings = pyproject.get_table("tool.ruff.lint.flake8-builtins", create=True)
key = "builtins-ignorelist"
allowed_modules = sorted({"display", *settings.get(key, [])})
minimal_settings = {key: to_toml_array(allowed_modules)}
if not complies_with_subset(settings, minimal_settings):
settings.update(minimal_settings)
msg = "Updated Ruff flake8-builtins settings"
pyproject.append_to_changelog(msg)


def __update_isort_settings(pyproject: ModifiablePyproject) -> None:
settings = pyproject.get_table("tool.ruff.lint.isort", create=True)
minimal_settings = {"split-on-trailing-comma": False}
Expand Down

0 comments on commit 563570c

Please sign in to comment.