Skip to content

Handle unsupported code/dependencies files when FawltyDeps run with explicit list of files #502

@mknorps

Description

@mknorps

Problem statement

When FawltyDeps run with explicit list of files (as it is for pre-commit hooks, see #499) it raises an error for unsupported formats of code or dependencies files.

Solution ideas

  1. Instead of raising error when FD traverse mechanism encounters an unparsable file, we could emit a warning or just skip the non-matching file.
  2. For explicitly given files we could add a step to sort them to ones that may contain dependency declarations and code.

Explanation: Settings object

Run FawltyDeps on FawltyDeps with printing the settings object build from input arguments.

Without explicit list of files

fawltydeps --generate-toml-config

# Copy this TOML section into your pyproject.toml to configure FawltyDeps
# (default values are commented)
[tool.fawltydeps]
# actions = ['check_undeclared', 'check_unused']
# output_format = 'human_summary'
code = ['fawltydeps']
deps = ['pyproject.toml']
# pyenvs = ['.']
# ignore_undeclared = []
ignore_unused = ['actionlint-py', 'codespell', 'hypothesis', 'mkdocs', 'mkdocs-material', 'mypy', 'nox', 'poetry-plugin-export', 'pytest', 'ruff', 'types-PyYAML', 'uv']
...

With explicit list of files

fawltydeps pyproject.toml fawltydeps --generate-toml-config

# Copy this TOML section into your pyproject.toml to configure FawltyDeps
# (default values are commented)
[tool.fawltydeps]
# actions = ['check_undeclared', 'check_unused']
# output_format = 'human_summary'
code = ['fawltydeps', 'pyproject.toml']
deps = ['fawltydeps', 'pyproject.toml']
pyenvs = ['fawltydeps', 'pyproject.toml']
# ignore_undeclared = []
ignore_unused = ['actionlint-py', 'codespell', 'hypothesis', 'mkdocs', 'mkdocs-material', 'mypy', 'nox', 'poetry-plugin-export', 'pytest', 'ruff', 'types-PyYAML', 'uv']
...

BUT running FawltyDeps with this command:

fawltydeps pyproject.toml fawltydeps   

results in:

fawltydeps: error: Supported formats are .py and .ipynb; Cannot parse code: pyproject.toml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions