Skip to content
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

[tools] Add markdownlint to the pre-commit #2717

Conversation

gabrieldemarmiesse
Copy link
Contributor

@gabrieldemarmiesse gabrieldemarmiesse commented May 17, 2024

Fix #2716

This pre-commit hook will also fix easy mistakes :) It also doesn't require any manual installation. It just works™

The CI will trigger an error if a markdown file does not conform to the rules of markdownlint

Example of pre-commit failure in the CI: https://github.com/modularml/mojo/actions/runs/9132279705/job/25113289498?pr=2663

Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
@@ -263,7 +263,7 @@ ls **/*.mojo | entr sh -c "./scripts/build-stdlib.sh && mojo main.mojo"
Now, every time you save a Mojo file, it packages the standard library and
runs `main.mojo`.

**Note**: you should stop `entr` while doing commits, otherwise you could have
__Note__: you should stop `entr` while doing commits, otherwise you could have
Copy link
Collaborator

@JoeLoser JoeLoser May 17, 2024

Choose a reason for hiding this comment

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

Question Is this change because of differences in the markdownlint-cli version we use internally, or something else? Looks like I'm on 0.34.0 locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That may be possible I can try it out. Give me a sec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried with 0.34.0 and I still got

stdlib/docs/development.md:266:1 MD050/strong-style Strong style should be consistent [Expected: underscore; Actual: asterisk]

Looking at the documentation it makes sense: https://github.com/DavidAnson/markdownlint/blob/main/doc/md050.md

By default markdownlint just wants all emphasis to be the same. Being __something__ or **something**. I don't know what the tool installed on your machine is doing but I would say that the pre-commit is right here.

If you want we can add some configuration to enforce one style or the other, that would avoid any blurry line concerning this rule. What do you think?

EDIT: Added the rule to always use asterisk to avoid confusion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, that makes sense. I don't feel strongly on the version, but I'd just like our internal and external to be consistent with the style they pick to avoid drift. @modularml/docs do you have opinions here?

Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
@gabrieldemarmiesse
Copy link
Contributor Author

@JoeLoser done. We now always force **something** instead of __something__. There is very little usage of the second form. I hope it's also the case in the internal codebase. If not, you can run the pre-commit with pre-commit run --all-files to fix everything in one go.

@JoeLoser
Copy link
Collaborator

!sync

@JoeLoser JoeLoser self-assigned this May 18, 2024
@JoeLoser JoeLoser added the imported-internally Signals that a given pull request has been imported internally. label May 18, 2024
@modularbot
Copy link
Collaborator

✅🟣 This contribution has been merged 🟣✅

Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the nightly branch during the next Mojo nightly release, typically within the next 24-48 hours.

We use Copybara to merge external contributions, click here to learn more.

@modularbot modularbot added the merged-internally Indicates that this pull request has been merged internally label May 18, 2024
@JoeLoser
Copy link
Collaborator

JoeLoser commented May 18, 2024

I just landed this internally, but our copybara isn't managing .pre-commit-config.yaml, ditto with the workflow files etc. We should probably have it manage the pre commit config yaml file for easy (thoughts @patrickdoc?). The net effect is the config and md file change landed, and once those propagate in the nightly tonight, then we can send a different smaller PR for the pre commit config file itself. Or is it easier to just merge this wholesale into the nightly branch now, @patrickdoc? There shouldn't be any conflicts in theory during the auto rebase, but didn't want to cause any issues.

modularbot pushed a commit that referenced this pull request May 19, 2024
[External] [tools] Add markdownlint to the pre-commit

Fix #2716

This pre-commit hook will also fix easy mistakes :) It also doesn't
require any manual installation. It just works™

The CI will trigger an error if a markdown file does not conform to the
rules of markdownlint

Example of pre-commit failure in the CI:
https://github.com/modularml/mojo/actions/runs/9132279705/job/25113289498?pr=2663

Co-authored-by: Gabriel de Marmiesse <gabriel.demarmiesse@datadoghq.com>
Closes #2717
MODULAR_ORIG_COMMIT_REV_ID: 56e9f0d2e5498625762effab6e7c0d83b6c8b560
@modularbot modularbot added the merged-externally Merged externally in public mojo repo label May 19, 2024
@modularbot
Copy link
Collaborator

Landed in b6b01b4! Thank you for your contribution 🎉

@modularbot modularbot closed this May 19, 2024
JoeLoser pushed a commit to JoeLoser/mojo that referenced this pull request May 20, 2024
Split off from modularml#2717
since Copybara isn't currently managing the
`.pre-commit-config.yaml` file.  The other changes from
modularml#2717 landed already
in
modularml@b6b01b4

Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
JoeLoser pushed a commit that referenced this pull request May 20, 2024
Split off from #2717
since Copybara isn't currently managing the
`.pre-commit-config.yaml` file.  The other changes from
#2717 landed already
in
b6b01b4

Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
martinvuyk pushed a commit to martinvuyk/mojo that referenced this pull request May 24, 2024
[External] [tools] Add markdownlint to the pre-commit

Fix modularml#2716

This pre-commit hook will also fix easy mistakes :) It also doesn't
require any manual installation. It just works™

The CI will trigger an error if a markdown file does not conform to the
rules of markdownlint

Example of pre-commit failure in the CI:
https://github.com/modularml/mojo/actions/runs/9132279705/job/25113289498?pr=2663

Co-authored-by: Gabriel de Marmiesse <gabriel.demarmiesse@datadoghq.com>
Closes modularml#2717
MODULAR_ORIG_COMMIT_REV_ID: 56e9f0d2e5498625762effab6e7c0d83b6c8b560
martinvuyk pushed a commit to martinvuyk/mojo that referenced this pull request May 24, 2024
Split off from modularml#2717
since Copybara isn't currently managing the
`.pre-commit-config.yaml` file.  The other changes from
modularml#2717 landed already
in
modularml@b6b01b4

Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported-internally Signals that a given pull request has been imported internally. merged-externally Merged externally in public mojo repo merged-internally Indicates that this pull request has been merged internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants