Skip to content

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

Closed
@hippietrail

Description

@hippietrail

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");
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions