From 0cbd0e94668231935317f1d35bad3fcd20e0fd35 Mon Sep 17 00:00:00 2001 From: R-Palazzo <116157184+R-Palazzo@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:56:59 -0400 Subject: [PATCH] Fix lint during dependency workflow (#435) --- .github/workflows/dependency_checker.yml | 1 + copulas/__init__.py | 5 +---- copulas/multivariate/vine.py | 3 +-- pyproject.toml | 26 ++++++++++++++++++------ tests/large_scale_evaluation.py | 4 ++-- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dependency_checker.yml b/.github/workflows/dependency_checker.yml index 7900502e..589ce20d 100644 --- a/.github/workflows/dependency_checker.yml +++ b/.github/workflows/dependency_checker.yml @@ -16,6 +16,7 @@ jobs: run: | python -m pip install .[dev] make check-deps OUTPUT_FILEPATH=latest_requirements.txt + make fix-lint - name: Create pull request id: cpr uses: peter-evans/create-pull-request@v4 diff --git a/copulas/__init__.py b/copulas/__init__.py index bcb2504f..5580fe07 100644 --- a/copulas/__init__.py +++ b/copulas/__init__.py @@ -69,10 +69,7 @@ def _find_addons(): try: addon = entry_point.load() except Exception as e: # pylint: disable=broad-exception-caught - msg = ( - f'Failed to load "{entry_point.name}" from "{entry_point.value}" ' - f'with error:\n{e}' - ) + msg = f'Failed to load "{entry_point.name}" from "{entry_point.value}" with error:\n{e}' warnings.warn(msg) continue diff --git a/copulas/multivariate/vine.py b/copulas/multivariate/vine.py index 99a46891..b9612cf6 100644 --- a/copulas/multivariate/vine.py +++ b/copulas/multivariate/vine.py @@ -76,8 +76,7 @@ class VineCopula(Multivariate): def __init__(self, vine_type, random_state=None): if sys.version_info > (3, 8): warnings.warn( - 'Vines have not been fully tested on Python >= 3.8 and might ' - 'produce wrong results.' + 'Vines have not been fully tested on Python >= 3.8 and might produce wrong results.' ) self.random_state = validate_random_state(random_state) diff --git a/pyproject.toml b/pyproject.toml index a3bda7ac..ceef9fdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -182,7 +182,8 @@ exclude = [ ".git", "__pycache__", ".ipynb_checkpoints", - "*.ipynb" + "*.ipynb", + "tasks.py", ] [tool.ruff.lint] @@ -192,14 +193,23 @@ select = [ # Pycodestyle "E", "W", - "D200", + # pydocstyle + "D", # isort "I001", + # print statements + "T201", + # pandas-vet + "PD", + # numpy 2.0 + "NPY201" ] ignore = [ - "E501", + # pydocstyle "D107", # Missing docstring in __init__ "D417", # Missing argument descriptions in the docstring, this is a bug from pydocstyle: https://github.com/PyCQA/pydocstyle/issues/449 + "PD901", + "PD101", ] [tool.ruff.format] @@ -209,14 +219,18 @@ preview = true docstring-code-format = true docstring-code-line-length = "dynamic" -[tool.ruff.lint.pep8-naming] -extend-ignore-names = ["X", "C", "X_padded", "Y", "Y_padded"] - [tool.ruff.lint.isort] known-first-party = ["copulas"] +lines-between-types = 0 [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "E402", "F403", "F405", "E501", "I001"] +"errors.py" = ["D105"] +"tests/**.py" = ["D"] [tool.ruff.lint.pydocstyle] convention = "google" + +[tool.ruff.lint.pycodestyle] +max-doc-length = 100 +max-line-length = 100 diff --git a/tests/large_scale_evaluation.py b/tests/large_scale_evaluation.py index 0a5d6471..3caf4b29 100644 --- a/tests/large_scale_evaluation.py +++ b/tests/large_scale_evaluation.py @@ -236,7 +236,7 @@ def _get_parser(): '-s', '--sample', type=int, - help=('Limit the test to a number of datasets (sampled randomly)' ' specified by SAMPLE.'), + help=('Limit the test to a number of datasets (sampled randomly) specified by SAMPLE.'), ) parser.add_argument('-r', '--max-rows', type=int, help='Limit the number of rows per dataset.') parser.add_argument( @@ -285,7 +285,7 @@ def main(): results = run_evaluation(model_names, dataset_names, args.max_rows, args.max_columns) - print(tabulate.tabulate(results, tablefmt='github', headers=results.columns, showindex=False)) + print(tabulate.tabulate(results, tablefmt='github', headers=results.columns, showindex=False)) # noqa if args.output_path: LOGGER.info('Saving report to %s', args.output_path)