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

Consistent rule references in tests #916

Merged
merged 2 commits into from
Jul 28, 2023
Merged

Consistent rule references in tests #916

merged 2 commits into from
Jul 28, 2023

Conversation

tommy-gilligan
Copy link
Contributor

This is really in response to #845 (comment)

I think it makes sense to always refer to rules by human-readable name in test configs for clarity.

Referring to rules by number in expectations then makes less sense. The rules could always be referred to by name in expectations but ultimately there is some file lib/md###.js that will be relevant when fixing a test. This is why I've gone with number:name for expectations. This format has meant that in some instances lines are long enough to break line-length rule.

@DavidAnson
Copy link
Owner

Maybe I’m being wildly inconsistent here, but I like rule names in configuration files and comments for clarity, but I like rule numbers in test file “assertions” for conciseness. To me, the MD123 form is canonical for a rule and will never change. Whereas the name can change and has in a few cases. There will be only one MD123 per rule, but there can be multiple names. Which is all kind of an argument to use MD123 everywhere, BUT I appreciate clarity in configuration where there are often multiple rules being handled at once. My view on test files and preferring the {MD123} syntax there is that it should be short and unobtrusive and also because there is usually only one rule being tested in each file (with the file name and content making the scenario clear). Using the rule name in tests is more to type and easier to typo - while having both the number and number he name is redundant. So I’m keen on part of this change, but not all of it. Updating only the configuration sections will also make the diff much easier to review.

Copy link
Owner

@DavidAnson DavidAnson left a comment

Choose a reason for hiding this comment

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

I like this change, thank you! It looks like there may be a merge conflict. And I may have added a new file or two in my last commits that should be included. I don't expect another commit on my part before merging this PR, so it should just be this one update. I hope you had some kind of automation to do/redo this vs. manually typing everything. :)

lib/markdownlint.js Show resolved Hide resolved
test/inline-configure-file-single-line.md Show resolved Hide resolved
@tommy-gilligan
Copy link
Contributor Author

I hope you had some kind of automation to do/redo this vs. manually typing everything. :)

haha yeah. i'd proly lose my mind if i did this manually >.<

i'll force push a rebase ommitting Always refer to rules by number:name in expectations and its revert commit.

Copy link
Owner

@DavidAnson DavidAnson left a comment

Choose a reason for hiding this comment

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

Looks good, thanks again!

@DavidAnson DavidAnson merged commit 07b851b into DavidAnson:next Jul 28, 2023
14 checks passed
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