Skip to content

MNT: pre-commit rst linter + small linting fixes #26737

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

Merged
merged 4 commits into from
Sep 15, 2023

Conversation

story645
Copy link
Member

@story645 story645 commented Sep 11, 2023

Adds rstcheck as a pre-commit hook, mostly cause I seem to have a mental block about underlines being same length as title. This pre-commit also has the advantage of being pretty configurable.

The .rst files in this PR are the linting errors I could fix because I wanted to minimize the ignored errors as much as possible.

@story645 story645 marked this pull request as draft September 11, 2023 22:16
@story645 story645 force-pushed the rst-linter branch 2 times, most recently from e057fd4 to d51c3a8 Compare September 12, 2023 05:10
@story645 story645 changed the title MNT: pre-commit rst linter MNT: pre-commit rst linter + small linting fixes Sep 12, 2023
@story645 story645 marked this pull request as ready for review September 12, 2023 05:12
- baseline
- center
- baseline

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no improvement IMHO...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fixes the linter error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the code works, is the linter correct in complaining?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original table was formatted incorrectly - the second line was supposed to be = not -
I didn't copy and paste that fix to the symlinked file and that's probably why the linter was still cranky but also I personally find list-table and grid table orders of magnitude easier to maintain than the tables where I have to update the whole thing on every change in space.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as the tables are small (like in this example), I prefer ReST simple tables. Yes they are more cumbersome to update but they are much easier to read, and readability counts. It's not that we are changing these tables all the time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm struggling a bit with your comment. I think there are two issues with this table:

  1. I had trouble understanding what the table was trying to communicate, so I reworked the table in its own PR.

  2. simple table vs list table format - I always prefer the latter because I find it more portable across different development environments. I understand the readibility concern but I can pull up the rendered docs to see the table, and also the list-table format still clearly delineates rows and columns and that's the important part for editing.

Because of 1, I'd rather discussions of this table move to that PR. If the table format is a blocker then I'll change it there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of 1, I'd rather discussions of this table move to that PR. If the table format is a blocker then I'll change it there.

I'm fine with that approach. I'm just wondering why you bothered to rewrite the old table here, when all it needs for a technical fix is replace the - by =, and for content changes, you again have the separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly cause I made that change and the linter didn't pass & then I made this change & remembered to C&P it to the non-updating symlinked file and it did pass and since I like this format better anyway I didn't feel like going back and making a way I didn't even like work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried to put it in simple table to close out this pr and that also actually requires a content change - it's also not happy with the ? table titles

@oscargus
Copy link
Member

I love static checking tools, so in general I am very positive to this. However, the table code looks quite unmanageable...

@story645
Copy link
Member Author

I find the list tables way easier to work with then the simple tables since I don't have to worry about spacing? It's long yes, but each row is distinct.

@story645
Copy link
Member Author

Granted, I also do not understand that table in the least - what are the first two columns? - but fixing that is way out of scope for this PR.

@story645
Copy link
Member Author

@oscargus I opened #26754 for axisartist. Still has list table mostly because I think that's more robust across different editing environments.

@timhoffm timhoffm added this to the v3.8-doc milestone Sep 15, 2023
@timhoffm timhoffm merged commit 5e441da into matplotlib:main Sep 15, 2023
@lumberbot-app
Copy link

lumberbot-app bot commented Sep 15, 2023

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.8.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 5e441da55ba1be8eb06c9f26b21d195d10971173
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #26737: MNT: pre-commit rst linter + small linting fixes'
  1. Push to a named branch:
git push YOURFORK v3.8.x:auto-backport-of-pr-26737-on-v3.8.x
  1. Create a PR against branch v3.8.x, I would have named this PR:

"Backport PR #26737 on branch v3.8.x (MNT: pre-commit rst linter + small linting fixes)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@lumberbot-app
Copy link

lumberbot-app bot commented Sep 15, 2023

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.8.0-doc
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 5e441da55ba1be8eb06c9f26b21d195d10971173
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #26737: MNT: pre-commit rst linter + small linting fixes'
  1. Push to a named branch:
git push YOURFORK v3.8.0-doc:auto-backport-of-pr-26737-on-v3.8.0-doc
  1. Create a PR against branch v3.8.0-doc, I would have named this PR:

"Backport PR #26737 on branch v3.8.0-doc (MNT: pre-commit rst linter + small linting fixes)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@story645 story645 deleted the rst-linter branch September 15, 2023 07:02
@timhoffm
Copy link
Member

Do we actually need this in the 3.8-doc branch? While it conceptually should go there, it should be sufficient that the test runs on the master branch to catch any rst issues of new contributions.

So I'd claim we don't have to bother with a manual backport. But feel free to decide otherwise.

@story645
Copy link
Member Author

@timhoffm yeah my take is that this is primarily a dev tool & I can manually split off the few docs I'd want in earlier (primarily the contribute page changes as I've got the separate PR for the axisartist page).

@ksunden
Copy link
Member

ksunden commented Sep 15, 2023

The backport failed because it changed whats-new/api doc entries (mostly adding python to code-block directives) that were deleted as part of release preparation, I'll add back in the changes to the resulting files in the merge-up process.

story645 added a commit to story645/matplotlib that referenced this pull request Sep 15, 2023
story645 added a commit to story645/matplotlib that referenced this pull request Sep 15, 2023
rcomer added a commit that referenced this pull request Sep 18, 2023
…v3.8.x

Backport changes to contribute from PR #26737
rcomer added a commit that referenced this pull request Sep 18, 2023
…v3.8.0-doc

Backport changes to contribute from PR #26737
@ksunden ksunden mentioned this pull request Nov 2, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants