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

Auto-generate documentation for chplcheck lint rules #26208

Merged
merged 22 commits into from
Jan 8, 2025

Conversation

jabraham17
Copy link
Member

@jabraham17 jabraham17 commented Nov 5, 2024

Adds documentation for chplcheck rules, auto-generated from the existing chplcheck rule defintions.

This PR makes the following changes:

  1. make docs will now build a rules.rst file which is included in the chplcheck documentation which lists all lint rules
    • This is enabled by the doc/util/chplcheck-docs.py, which is also available to users for their own custom rule files
    • Rules can also have examples, specified in tools/chplcheck/examples. These are included in the online docs and provide reasoning to users about why a lint rule exists
    • Screenshot 2024-12-16 at 3 00 10 PM
    • Screenshot 2024-12-16 at 2 57 24 PM
  2. The chplcheck langauge server will provides a link straight to rule documentation
    Screenshot 2024-11-04 at 4 08 44 PM

Future work:

  • Add more examples to tools/chplcheck/examples

[Reviewed by @DanilaFe]

Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
@jabraham17 jabraham17 marked this pull request as ready for review December 16, 2024 23:12
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
@jabraham17 jabraham17 requested a review from DanilaFe January 6, 2025 17:38
doc/util/chplcheck-docs.py Outdated Show resolved Hide resolved
doc/util/chplcheck-docs.py Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a copy of the PREDIFF elsewhere; can you symlink it instead?

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 is a copy. But tools/chplcheck/examples is included in the tarball while test/chplcheck/PREDIFF is not, so the tarball will have broken symlinks

with context.track_errors() as _:
for loc, node, rule, fixits in driver.run_checks(context, asts):
diagnostic = Diagnostic(
range=chapel.lsp.location_to_range(loc),
message="Lint: rule [{}] violated".format(rule),
severity=DiagnosticSeverity.Warning,
code=rule,
code_description=CodeDescription(base_url + "#" + rule.lower()),
Copy link
Contributor

Choose a reason for hiding this comment

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

nice touch!

Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
@jabraham17 jabraham17 merged commit 9d1bb98 into chapel-lang:main Jan 8, 2025
9 checks passed
@jabraham17 jabraham17 deleted the doc-lint-rules branch January 8, 2025 18:15
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