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

Document best practices for position arguments in utils.report() #8257

Merged
merged 6 commits into from
Jan 6, 2025

Conversation

jeddy3
Copy link
Member

@jeddy3 jeddy3 commented Dec 30, 2024

Which issue, if any, is this issue related to?

Closes #8261

Is there anything in the PR that needs further explanation?

If someone has time, it may be worth adding a small section to the "writing rules" about the report() function to give examples of how node, index and endIndex are likely used.

This comment was marked as resolved.

@romainmenke
Copy link
Member

If someone has time, it may be worth adding a small section to the "writing rules" about the report() function to give examples of how node, index and endIndex are likely used.

#8261

I've opened an issue for this and added some initial thoughts

Copy link
Member

@romainmenke romainmenke left a comment

Choose a reason for hiding this comment

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

I am a bit unsure about this change.

On the one hand your change is obviously correct and it is a direction I think we want to promote for core rules. But word is also very convenient for new rule authors.

Should we keep the documentation as-is for now and await the outcome of #8261 ?

#8251 this change might have just been an unlucky combo of linting at-rule names, where all the other and similar rules still use word, despite being core rules :)

But I don't have a very strong opinion on this and happy with this change if you feel it is generally helpful to authors to already promote index/endIndex.

@Mouvedia
Copy link
Member

I am a bit unsure about this change.

I agree with @romainmenke, word is sometimes OKish/convenient.
i.e. this PR is probably not necessary
If anything, it's line that will need a > [!WARNING] for its deprecation.

@jeddy3
Copy link
Member Author

jeddy3 commented Dec 31, 2024

Should we keep the documentation as-is for now and await the outcome of #8261 ?

SGTM. Let's rework this PR for that issue.

@jeddy3 jeddy3 changed the title Document use of index in report() Document best practices for position arguments in utils.report() Dec 31, 2024
@jeddy3 jeddy3 marked this pull request as draft December 31, 2024 08:56
@jeddy3
Copy link
Member Author

jeddy3 commented Jan 4, 2025

I've reworked the docs based on @romainmenke excellent write-up in #8261 (comment).

I tried to give rule authors a sense of how the location arguments work without getting into overwhelming detail so that they have some grounding when they look at the code of existing rules.

I've given a couple of examples of what seem to be our most common patterns:

  • using word
  • using index and endIndex (often with a construct parser)

docs/developer-guide/rules.md Outdated Show resolved Hide resolved
@jeddy3 jeddy3 marked this pull request as ready for review January 4, 2025 09:50
jeddy3 and others added 2 commits January 4, 2025 12:13
Co-authored-by: Gary Gozlan <Mouvedia@users.noreply.github.com>
@jeddy3 jeddy3 mentioned this pull request Jan 5, 2025
8 tasks
Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

Thank you, almost LGTM. Can you check my minor comments?

docs/developer-guide/rules.md Outdated Show resolved Hide resolved
docs/developer-guide/rules.md Outdated Show resolved Hide resolved
jeddy3 and others added 2 commits January 6, 2025 12:11
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
@jeddy3
Copy link
Member Author

jeddy3 commented Jan 6, 2025

@ybiquitous Commit your suggestions. Thank you for your attention to detail.

Copy link
Member

@romainmenke romainmenke left a comment

Choose a reason for hiding this comment

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

Thank you for working on this @jeddy3. LGTM 👍

@jeddy3 jeddy3 merged commit 2e790d9 into main Jan 6, 2025
17 checks passed
@jeddy3 jeddy3 deleted the document-index branch January 6, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Document best practices for position arguments in utils.report()
4 participants