Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: "change of tack" lint doesn't catch common variants #711

Open
hippietrail opened this issue Feb 18, 2025 · 0 comments
Open

bug: "change of tack" lint doesn't catch common variants #711

hippietrail opened this issue Feb 18, 2025 · 0 comments
Labels

Comments

@hippietrail
Copy link
Contributor

Describe the bug
"Change tact" in the present is flagged but not other common variants.
Acceptable verb inflections: changed, changes, changing
Wrong noun variants: tacks, tacts
Acceptable phrase variants: change of tack, changes of tack
Wrong phrase variants: change(s) of tact, change(s) of tacts, change(s) of tacks

To Reproduce
Steps to reproduce the behavior:

  1. Copy and paste these lines (not all variants are included):
    Let's change tack.
    Let's change tact.
    Let's change tacks.
    I changed tack.
    I changed tact.
    I changed tacks.
    He changes tack.
    He changes tact.
    He changes tacks.
    Changing tack is tricky.
    Changing tact is tricky.
    Changing tacks is tricky.
    A change of tack.
    A change of tact.
    A change of tacks.

Expected behavior
2. Every line with "tact" or "tacks" should be flagged. But only the first one is.
Image

Platform
VS Code, Windsurf

Examples
Here's some from GitHub:

  • Whether it's her change of tact on Instagram ...
  • I've changed tact for my layout and ...
  • So I changed tacks, and
  • ... and so forth, before changing tact.
  • ... change tacks and abandon this plan.
  • ... to be discarded if we changed tact.
  • ... changes tacks and tries to explain it in a common sense way.

Some from elsewhere:

Additional context
Here are some unit tests to add to phrase_corrections.rs - (These don't cover all variants.)

    #[test]
    fn change_tack_present() {
        assert_lint_count("Let's change tack", ChangeTack::default(), 0);
    }

    #[test]
    fn change_tact_present() {
        assert_suggestion_result("Let's change tact", ChangeTack::default(), "Let's change tack");
    }

    #[test]
    fn change_tacks_present() {
        assert_suggestion_result("Let's change tacks", ChangeTack::default(), "Let's change tack");
    }

    #[test]
    fn change_tack_past() {
        assert_lint_count("I changed tack", ChangeTack::default(), 0);
    }

    #[test]
    fn change_tact_past() {
        assert_suggestion_result("I changed tact", ChangeTack::default(), "I changed tack");
    }

    #[test]
    fn change_tacks_past() {
        assert_suggestion_result("I changed tacks", ChangeTack::default(), "I changed tack");
    }

    #[test]
    fn change_tack_3rd_person() {
        assert_lint_count("He changed tack", ChangeTack::default(), 0);
    }

    #[test]
    fn change_tact_3rd_person() {
        assert_suggestion_result("He changed tact", ChangeTack::default(), "He changed tack");
    }

    #[test]
    fn change_tacks_3rd_person() {
        assert_suggestion_result("He changed tacks", ChangeTack::default(), "He changed tack");
    }

    #[test]
    fn change_tack_continuous() {
        assert_lint_count("Changing tack is tricky", ChangeTack::default(), 0);
    }

    #[test]
    fn change_tact_continuous() {
        assert_suggestion_result("Changing tact is tricky", ChangeTack::default(), "Changing tack is tricky");
    }

    #[test]
    fn change_tacks_continuous() {
        assert_suggestion_result("Changing tacks is tricky", ChangeTack::default(), "Changing tack is tricky");
    }

    #[test]
    fn change_of_tack() {
        assert_lint_count("A change of tack", ChangeTack::default(), 0);
    }

    #[test]
    fn change_of_tact() {
        assert_suggestion_result("A change of tact", ChangeTack::default(), "A change of tack");
    }

    #[test]
    fn change_of_tacks() {
        assert_suggestion_result("A change of tacks", ChangeTack::default(), "A change of tack");
    }
@hippietrail hippietrail added the bug Something isn't working label Feb 18, 2025
@grantlemons grantlemons added harper-core linting enhancement New feature or request and removed bug Something isn't working labels Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants