feat(core): support additional initialisms (#2198)
Some checks are pending
Binaries / harper-cli - macOS-aarch64 (push) Waiting to run
Binaries / harper-cli - Linux-aarch64-GNU (push) Waiting to run
Binaries / harper-cli - Linux-aarch64-musl (push) Waiting to run
Binaries / harper-cli - macOS-x86_64 (push) Waiting to run
Binaries / harper-cli - Linux-x86_64-GNU (push) Waiting to run
Binaries / harper-cli - Linux-x86_64-musl (push) Waiting to run
Binaries / harper-cli - Windows-x86_64 (push) Waiting to run
Binaries / harper-ls - macOS-aarch64 (push) Waiting to run
Binaries / harper-ls - Linux-aarch64-GNU (push) Waiting to run
Binaries / harper-ls - Linux-aarch64-musl (push) Waiting to run
Binaries / harper-ls - macOS-x86_64 (push) Waiting to run
Binaries / harper-ls - Linux-x86_64-GNU (push) Waiting to run
Binaries / harper-ls - Linux-x86_64-musl (push) Waiting to run
Binaries / harper-ls - Windows-x86_64 (push) Waiting to run
Build Web / build-web (push) Waiting to run
Chrome Plugin / chrome-plugin (push) Waiting to run
Just Checks / just check-js (push) Waiting to run
Just Checks / just check-rust (push) Waiting to run
Just Checks / just test-chrome-plugin (push) Waiting to run
Just Checks / just test-firefox-plugin (push) Waiting to run
Just Checks / just test-harperjs (push) Waiting to run
Just Checks / just test-obsidian (push) Waiting to run
VS Code Plugin / alpine-arm64 (push) Waiting to run
VS Code Plugin / alpine-x64 (push) Waiting to run
VS Code Plugin / darwin-arm64 (push) Waiting to run
VS Code Plugin / linux-armhf (push) Waiting to run
Just Checks / just test-rust (push) Waiting to run
Just Checks / just test-vscode (push) Waiting to run
VS Code Plugin / darwin-x64 (push) Waiting to run
VS Code Plugin / linux-arm64 (push) Waiting to run
VS Code Plugin / linux-x64 (push) Waiting to run
VS Code Plugin / win32-arm64 (push) Waiting to run
VS Code Plugin / win32-x64 (push) Waiting to run
WordPress Plugin / wp-plugin (push) Waiting to run

phrase_corrections was updated to do not use 'IIRC', but `IIRC` instead.
This change avoids triggering a lint warning when using the initialism
in the RedundantIIRC rule.
This commit is contained in:
ccoVeille 2025-11-19 20:09:09 +01:00 committed by GitHub
parent 36df3b9505
commit 5a21c570fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 81 additions and 1 deletions

View file

@ -29,6 +29,14 @@ pub fn lint_group() -> LintGroup {
"ToBeHonest" => ("tbh", "to be honest"),
"AsFarAsIKnow" => ("afaik", "as far as I know"),
"Really" => ("rly", "really"),
"ExplainLikeImFive" => ("eli5", "explain like i'm five"),
"ForWhatItsWorth" => ("fwiw", "for what it's worth"),
"IDontKnow" => ("idk", "I don't know"),
"IfIRecallCorrectly" => ("iirc", "if I recall correctly"),
"IfYouKnowYouKnow" => ("iykyk", "if you know, you know"),
"InCaseYouMissedIt" => ("icymi", "in case you missed it"),
"InRealLife" => ("irl", "in real life"),
"PleaseTakeALook" => ("ptal", "please take a look"),
});
group.set_all_rules_to(Some(true));
@ -127,4 +135,76 @@ mod tests {
"As far as i know, we don't currently have an issue for it.",
);
}
#[test]
fn corrects_eli5() {
assert_suggestion_result(
"Can you eli5 how this works?",
lint_group(),
"Can you explain like i'm five how this works?",
);
}
#[test]
fn corrects_fwiw() {
assert_suggestion_result(
"Fwiw, I think it's a good idea.",
lint_group(),
"For what it's worth, I think it's a good idea.",
);
}
#[test]
fn corrects_idk() {
assert_suggestion_result(
"Idk if I'll make it to the party.",
lint_group(),
"I don't know if I'll make it to the party.",
);
}
#[test]
fn corrects_iirc() {
assert_suggestion_result(
"Iirc, the event starts at 6 PM.",
lint_group(),
"If i recall correctly, the event starts at 6 PM.",
);
}
#[test]
fn corrects_iykyk() {
assert_suggestion_result(
"Iykyk, this place is amazing.",
lint_group(),
"If you know, you know, this place is amazing.",
);
}
#[test]
fn corrects_icymi() {
assert_suggestion_result(
"Icymi, the deadline is tomorrow.",
lint_group(),
"In case you missed it, the deadline is tomorrow.",
);
}
#[test]
fn corrects_irl() {
assert_suggestion_result(
"We should meet irl sometime.",
lint_group(),
"We should meet in real life sometime.",
);
}
#[test]
fn corrects_ptal() {
assert_suggestion_result(
"Ptal at the document I sent.",
lint_group(),
"Please take a look at the document I sent.",
);
}
}

View file

@ -935,7 +935,7 @@ pub fn lint_group() -> LintGroup {
"RedundantIIRC" => (
["if IIRC", "IIRC correctly"], ["IIRC"],
"`IIRC` already means 'if I recall correctly', so adding 'if' or 'correctly' is redundant.",
"Flags redundant use of 'if' or 'correctly' with 'IIRC', since 'IIRC' already stands for 'if I recall correctly'.",
"Flags redundant use of 'if' or 'correctly' with `IIRC`, since `IIRC` already stands for 'if I recall correctly'.",
LintKind::Redundancy
),
"RifeWith" => (