-
Notifications
You must be signed in to change notification settings - Fork 111
feat(core): implement "despite of" lint #531
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
Conversation
Implements Automattic#500 but fails `lint_descriptions_are_clean`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks good! Some edits are required. Once we're done here, I'd like to make it the example in the documentation.
} | ||
|
||
fn description(&self) -> &'static str { | ||
"Don\"t use \"despite of\". Both \"despite\" and \"in spite of\" are correct English." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You used a double-apostrophe rather than a single apostrophe here.
The failing test checks that your description does not include any errors that Harper can detect. In this particular case, it's complaining about the stuff you have in quotes. This is a known issue that I plan to resolve soon. For now, just wrap them in backticks (`) without the quotes.
In other words, replace Both \"despite\" and
with Both `despite` and
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never heard them called "double apostrophe" before but good catch on the one in "don't"!
.unwrap() | ||
.is_uppercase(); | ||
|
||
// generate suggestion based on case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can achieve similar behavior by using Suggestion::replace_with_match_case
.
If the function's description is confusing, take a look at the source for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm more confused by some struct names than function names so far. And just finding what I can use where.
|
||
impl Default for DespiteOf { | ||
fn default() -> Self { | ||
let mut pattern = WordPatternGroup::default(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right that the ThatWhich
linter is a poor example.
A slightly better constructor would define the pattern as:
// "aco" stands for "any capitalization of"
let pattern = SequencePattern::aco("despite").then_whitespace().t_aco("of");
Using the WordPatternGroup
here is somewhat redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't know what the alternatives are and find the existing linters hard to compare and extrapolate from. It would help new contributors a lot if some subset of them were considered “exemplars” and copiously commented. Enough to illustrate the common alternatives. Especially if you want to attract people that know less Rust than me. The new docs are helping a lot already though.
Sorry I guess I have to manually click "Ready for review" again here after I commit the requested changes? |
Looks great. I might come back in here and add comments to make it one of several models for the documentation. In the meantime, I'm gonna merge it. |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [Automattic/harper/harper-ls](https://github.com/Automattic/harper) | minor | `v0.18.1` -> `v0.19.1` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>Automattic/harper (Automattic/harper/harper-ls)</summary> ### [`v0.19.1`](https://github.com/Automattic/harper/releases/tag/v0.19.1) [Compare Source](Automattic/harper@v0.18.1...v0.19.1) #### What's Changed The biggest change in this version: the ability to ignore lints. This is some pretty new code, so we hope to hear from you all to see how we can improve it. - feat: issue templates by [@​elijah-potter](https://github.com/elijah-potter) in Automattic/harper#539 - feat(core): even more holidays by [@​hippietrail](https://github.com/hippietrail) in Automattic/harper#533 - feat(core): implement "despite of" lint by [@​hippietrail](https://github.com/hippietrail) in Automattic/harper#531 - feat(html): condense spaces like most HTML parsers by [@​elijah-potter](https://github.com/elijah-potter) in Automattic/harper#546 - Ignore Lints by [@​elijah-potter](https://github.com/elijah-potter) in Automattic/harper#529 - fix(core): [#​548](Automattic/harper#548) `you` is not a verb by [@​elijah-potter](https://github.com/elijah-potter) in Automattic/harper#551 - docs: mention [#​536](Automattic/harper#536) on installation pages by [@​elijah-potter](https://github.com/elijah-potter) in Automattic/harper#538 - Site fixes and updates by [@​elijah-potter](https://github.com/elijah-potter) in Automattic/harper#552 - feat(core): created framework for correcting common phrases by [@​elijah-potter](https://github.com/elijah-potter) in Automattic/harper#550 - feat(core): condense multi-token Latin words and phrases by [@​elijah-potter](https://github.com/elijah-potter) in Automattic/harper#473 **Full Changelog**: Automattic/harper@v0.18.1...v0.19.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjEuNiIsInVwZGF0ZWRJblZlciI6IjM5LjE2MS42IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Implements #500 but fails
lint_descriptions_are_clean
I don't understand why that is or what it means, so just a draft PR sadly.
Running the tests in
despite_of.rs
from VS Code they all pass butjust test
fails: