feat(lint): poc 2.0 linter gno handle extensions rules
New Proposal for Linter Extension Rules
I did this first PR #4913 to implement linting warning on avl tree iterate method without limit. It was a "wild" PoC mixing preprocessing and linting logic.
This PR is an improved proposal with a lintrules interface and where each enabled implementations will run a function on all the nodes of the AST. (The AST traversal is done one time, but each node traversed applied the ruleset enabled)
The question is should i keep going in this way or do i go in the wrong direction ?
My next steps would be:
- Clean the code, improved the naming, the interface and implementations
- Allow in the CLI to enable/disable rules with a default preset
Small drawing of what i did
cc @moul @aeddi @thehowl
π PR Checks Summary
All Automated Checks passed. β
Manual Checks (for Reviewers):
- [ ] IGNORE the bot requirements for this PR (force green CI check)
Read More
π€ This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.
β Automated Checks (for Contributors):
π’ Maintainers must be able to edit this pull request (more info) π’ Pending initial approval by a review team member, or review from tech-staff
βοΈ Contributor Actions:
- Fix any issues flagged by automated checks.
- Follow the Contributor Checklist to ensure your PR is ready for review.
- Add new tests, or document why they are unnecessary.
- Provide clear examples/screenshots, if necessary.
- Update documentation, if required.
- Ensure no breaking changes, or include
BREAKING CHANGEnotes. - Link related issues/PRs, where applicable.
βοΈ Reviewer Actions:
- Complete manual checks for the PR, including the guidelines and additional checks if applicable.
π Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)
If
π’ Condition met βββ π’ And βββ π’ The base branch matches this pattern: ^master$ βββ π’ The pull request was created from a fork (head branch repo: MikaelVallenet/gno)Then
π’ Requirement satisfied βββ π’ Maintainer can modify this pull requestPending initial approval by a review team member, or review from tech-staff
If
π’ Condition met βββ π’ And βββ π’ The base branch matches this pattern: ^master$ βββ π’ Not (π΄ Pull request author is a member of the team: tech-staff)Then
π’ Requirement satisfied βββ π’ If βββ π’ Condition β βββ π’ Or β βββ π΄ At least one of these user(s) reviewed the pull request: [jefft0 leohhhn n0izn0iz notJoon omarsy x1unix] (with state "APPROVED") β βββ π΄ At least 1 user(s) of the team tech-staff reviewed pull request β βββ π’ This pull request is a draft βββ π’ Then βββ π’ Not (π΄ This label is applied to pull request: review/triage-pending)Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)
If
π’ Condition met βββ π’ On every pull requestCan be checked by
- Any user with comment edit permission
Codecov Report
:x: Patch coverage is 44.79167% with 53 lines in your changes missing coverage. Please review.
:loudspeaker: Thoughts on this report? Let us know!
Sounds like a good place to plug you in for the linter, but Iβm not an expert at all, Morgan will have a much more informed opinion.
A few thoughts though:
- I think it makes more sense to put the .gno test files in a folder similar to
gnovm/testsinstead of in theexamplesfolder, which is meant to be stored on-chain and callable.β© - It might be useful to create a standard structure for each lint rule. For example, have a subfolder with the implementation plus docs/specs (Markdown? or JSON so itβs easier to parse, even by the lint tool itself). It could include an ID for the rule (similar to https://staticcheck.dev/docs/checks/), a short description, a longer description, and maybe a workaround with example code, etc.