Skip to content

--auto-regenerate-baseline removes entries for files not included in the run #274

@thomasdesr

Description

@thomasdesr

Hey!

Thank you so much for pydoclint! It's fantastic 🥰

This might be more of a "checking whether this is the intended behavior" than a bug, but I didn't see anything about it in earlier discussions or issues, so I figured I'd open one. I'm also happy to help with a fix if that would be useful.

Description

When running pydoclint with an existing baseline file and --auto-regenerate-baseline=True, the regeneration seems to only look at the files included in that particular run. Because of that, entries for files that weren't part of the invocation end up being removed from the baseline.

Unfortunately, this gets a bit tricky when used with pre-commit, since it defaults to only passing in the modified files to the hook.

Reproduction

  1. Baseline contains entries for a.py and b.py.

  2. Fix a.py.

  3. Run:

    pydoclint --baseline baseline.txt --auto-regenerate-baseline=true a.py
    

    After this, the regenerated baseline no longer includes the b.py entries.

What I expected

My assumption was that auto-regeneration would update only the parts of the baseline related to the files being checked, rather than replacing the baseline entirely based on the current run.

Proposed Fix

One possible approach would be to make --auto-regenerate-baseline update only the relevant entries while leaving the others intact. But I'm not sure whether you'd want to change the default behavior at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions