Add new invalid_markdown_table rustdoc lint - #159583
Conversation
This comment has been minimized.
This comment has been minimized.
045f5a3 to
6fd9b1b
Compare
|
Applied comments. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
|
2nd try. Let's do an FCP.
|
|
@Urgau has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
| ```rust | ||
| //! | col1 | | ||
| //! | ---- | | ||
| //! | `code_with(|arg| arg)` | |
There was a problem hiding this comment.
Wow TIL that this is how GFM works. Very strange design...
There was a problem hiding this comment.
Yeah I was super confused as well.
|
Minor nits about the implementation, but massive approval for the lint in concept! |
|
Definitely in favor of the lint itself, but I wonder if we should have a more generic lint name and then we group together this and any related (current or future) lints about Markdown gotchas? E.g. we have For example, it could be On a related note, my feeling with #158709 is that additions of new cases to an existing warn-by-default lint do not require FCP since they are not part of stability guarantees, but please let me know if you disagree. |
|
@camelid: Very fair point. I think having a lint group for all such lints is a good idea. As for the current lint name, I'll rename it as |
6fd9b1b to
52c8615
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
52c8615 to
a88e74a
Compare
|
This pull request was unapproved. This PR was contained in a rollup (#160661), which was unapproved. |
This comment has been minimized.
This comment has been minimized.
The essential problem is that, with this table: ```text one | ----| a | b | c a | b | a | b a | ``` And this logic: ```rust let too_many_pipes = divider_count > expected_cells + 1; ``` `expected_cells + 1` winds up as 2, so you get this warning: ```text error: unused content after last table cell --> $DIR/invalid_markdown_table.rs:81:14 | LL | //! a | b | c | ^^^^^^ this content is discarded error: unused content after last table cell --> $DIR/invalid_markdown_table.rs:83:14 | LL | //! a | b | | ^^^^ this content is discarded error: unused content after last table cell --> $DIR/invalid_markdown_table.rs:85:14 | LL | //! a | b | ^^ this content is discarded ``` We really want our warning to give the suggest-escaping flow, like this: ```text error: table row has too many columns --> $DIR/invalid_markdown_table.rs:81:13 | LL | //! a | b | c | ^ any content after this column divider is discarded | = help: to escape `|` characters in tables, add a `\` before them like `\|` error: table row has too many columns --> $DIR/invalid_markdown_table.rs:83:13 | LL | //! a | b | | ^ any content after this column divider is discarded | = help: to escape `|` characters in tables, add a `\` before them like `\|` error: unused content after last table cell --> $DIR/invalid_markdown_table.rs:85:14 | LL | //! a | b | ^^ this content is discarded ``` By only scanning the text between the end of the last cell and the row, instead of doing the entire row, we don't have to re-implement as much of pulldown-cmark's logic.
3c70378 to
df734af
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r=Urgau,notriddle,camelid rollup |
…able_cell, r=Urgau,notriddle,camelid Add new `invalid_markdown_table` rustdoc lint Fixes rust-lang#159186. r? @Urgau
…able_cell, r=Urgau,notriddle,camelid Add new `invalid_markdown_table` rustdoc lint Fixes rust-lang#159186. r? @Urgau
…able_cell, r=Urgau,notriddle,camelid Add new `invalid_markdown_table` rustdoc lint Fixes rust-lang#159186. r? @Urgau
…uwer Rollup of 6 pull requests Successful merges: - #155499 (stabilize never type) - #161294 (add crashtests [6/N]) - #161050 (Only use dlltool.exe on MinGW if -Cdlltool is passed) - #159583 (Add new `invalid_markdown_table` rustdoc lint) - #161098 (PassWrapper: handle LLVM 24 change in function types) - #161661 (Don't treat slashes as path seps after drive letters in verbatim paths)
…able_cell, r=Urgau,notriddle,camelid Add new `invalid_markdown_table` rustdoc lint Fixes rust-lang#159186. r? @Urgau
…uwer Rollup of 5 pull requests Successful merges: - #161294 (add crashtests [6/N]) - #161050 (Only use dlltool.exe on MinGW if -Cdlltool is passed) - #159583 (Add new `invalid_markdown_table` rustdoc lint) - #161098 (PassWrapper: handle LLVM 24 change in function types) - #161661 (Don't treat slashes as path seps after drive letters in verbatim paths)
…able_cell, r=Urgau,notriddle,camelid Add new `invalid_markdown_table` rustdoc lint Fixes rust-lang#159186. r? @Urgau
…uwer Rollup of 6 pull requests Successful merges: - #155499 (stabilize never type) - #161294 (add crashtests [6/N]) - #161050 (Only use dlltool.exe on MinGW if -Cdlltool is passed) - #159583 (Add new `invalid_markdown_table` rustdoc lint) - #161098 (PassWrapper: handle LLVM 24 change in function types) - #161661 (Don't treat slashes as path seps after drive letters in verbatim paths)
…able_cell, r=Urgau,notriddle,camelid Add new `invalid_markdown_table` rustdoc lint Fixes rust-lang#159186. r? @Urgau
View all comments
Fixes #159186.
r? @Urgau