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

Create workflow to lint Markdown files #265

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MGaetan89
Copy link
Member

@MGaetan89 MGaetan89 commented Jul 2, 2024

This PR creates a new workflow to lint Markdown files. This was suggested here: #255 (comment).

The new workflow uses the DavidAnson/markdownlint-cli2-action action. It uses the rules defined in DavidAnson/markdownlint.

For the moment, I've kept the default configuration (ie. all the rules are enabled), and modified the maximum line length to be 120 characters, instead of 80.
A sample output is available here: https://github.com/robolectric/robolectric.github.io/actions/runs/9766776527/job/26960490077?pr=265.

I didn't modify any Markdown file yet, because I think that it's better to agree on the rules first. Once that's done, I'll fix all the Markdown files.

The original suggestion was to only enforce max line length. That's possible with the action I'm using. We just need to agree on the value to use.

@utzcoz
Copy link
Member

utzcoz commented Jul 4, 2024

@MGaetan89 Can we run lint with https://github.com/DavidAnson/markdownlint manually? We can create our custom lint configuration file and manage it with git. It's easy to setup the environment for npm in GitHub Action, and we also can use it locally to apply potential fixes automatically.

@MGaetan89
Copy link
Member Author

@MGaetan89 Can we run lint with DavidAnson/markdownlint manually? We can create our custom lint configuration file and manage it with git. It's easy to setup the environment for npm in GitHub Action, and we also can use it locally to apply potential fixes automatically.

Good point, I forgot to include that. I'll work more on this PR, to explain how to run the check locally.
The idea is to use the provided CLI tool: https://github.com/DavidAnson/markdownlint-cli2

@MGaetan89
Copy link
Member Author

@MGaetan89 Can we run lint with DavidAnson/markdownlint manually? We can create our custom lint configuration file and manage it with git. It's easy to setup the environment for npm in GitHub Action, and we also can use it locally to apply potential fixes automatically.

I've finally added a note to explain how to check the format locally with the command line tool.

@utzcoz
Copy link
Member

utzcoz commented Oct 7, 2024

@MGaetan89 Can we fix lints automatically with some commands?

@MGaetan89
Copy link
Member Author

@MGaetan89 Can we fix lints automatically with some commands?

Yes, it's the command I added to the Readme in this PR:

markdownlint-cli2 "docs/**/*.md" "#docs/javadoc/**/*.md" --config .markdownlint.jsonc --fix

I can open a new PR which fixes all the warnings (or maybe multiple smaller PRs)

@utzcoz
Copy link
Member

utzcoz commented Oct 8, 2024

@MGaetan89 You can add a new commit in this PR to fix warnings.

@MGaetan89
Copy link
Member Author

I see that a lot of warnings are about long line length. Often it's because of inlined urls. I'll submit a PR to extract URLs at the bottom of the files first (like in 2021-10-06-sharedTest.md).

This will make reading the Markdown files easier, and hopefully this PR a bit smaller too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants