Skip to content

Redundant sort test #3359

Closed as not planned
Closed as not planned

Description

@korverdev

I wanted to create an issue to discuss with the maintainers of this repo before I went ahead and deleted a test, but it appears this project is using both a Pre-Commit hook called file-contents-sorter and a test called test_dictionary_sorting() to enforce dictionaries have been sorted.

If I'm not missing anything, since Pre-Commit is enforced as a CI check before merge, the test_dictionary_sorting() test can be deleted. If that's accurate, I can get a PR in deleting the test.

Activity

  1. DimitriPapadopoulos commented on Feb 16, 2024

    @DimitriPapadopoulos
    Collaborator

    Both were added in #2973. I think the explanation is in a comment:

    [...] this is now enforced by the pre-commit hook, and is checked when make check-dictionaries is run.

    Can you have a look?

  2. korverdev commented on Feb 17, 2024

    @korverdev
    ContributorAuthor

    Truth be told, I'm not really following what they're trying to say. Are we sure they were aware that Pre-Commit is enforced as a CI check? From what I can tell, there's really no need to have both.

  3. DimitriPapadopoulos commented on Feb 18, 2024

    @DimitriPapadopoulos
    Collaborator

    The Makefile distinguishes between check-dictionaries implemented in actual tests:

    codespell/Makefile

    Lines 13 to 21 in edef040

    check-dictionaries:
    @for dictionary in ${DICTIONARIES}; do \
    if grep -E -n "^\s*$$|\s$$|^\s" $$dictionary; then \
    echo "Dictionary $$dictionary contains leading/trailing whitespace and/or blank lines. Trim with 'make trim-dictionaries'"; \
    exit 1; \
    fi; \
    done
    @if command -v pytest > /dev/null; then \
    pytest codespell_lib/tests/test_dictionary.py; \

    and sort-dictionaries implemented using pre-commit:

    codespell/Makefile

    Lines 27 to 28 in edef040

    sort-dictionaries:
    pre-commit run --all-files file-contents-sorter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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