-
Notifications
You must be signed in to change notification settings - Fork 29
chore: added markdown docs templates #220
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
base: master
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
♻️ Duplicate comments (1)
docs/templates-md/properties.js (1)
23-29: Code duplication and null safety issue.This code duplicates the signature-building logic from the
anchorfunction and has the same null safety concerns.See the refactor suggestion in the previous comment (lines 10-16) which addresses both issues by extracting common logic and adding null checks.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
docs/config-md.js(1 hunks)docs/templates-md/contract.hbs(1 hunks)docs/templates-md/helpers.js(1 hunks)docs/templates-md/page.hbs(1 hunks)docs/templates-md/properties.js(1 hunks)hardhat.config.js(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
hardhat.config.js (2)
docs/templates-md/helpers.js (2)
require(1-1)require(4-4)docs/templates-md/properties.js (2)
require(1-1)require(2-2)
docs/templates-md/properties.js (1)
docs/templates-md/helpers.js (2)
slug(67-72)i(139-139)
docs/templates-md/helpers.js (1)
docs/templates-md/properties.js (5)
require(1-1)require(2-2)item(83-83)signature(11-11)signature(24-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: slither
- GitHub Check: tests-foundry
- GitHub Check: coverage
- GitHub Check: tests
🔇 Additional comments (3)
docs/templates-md/properties.js (3)
59-65: LGTM! Good defensive coding.The ternary operator properly handles the case where
item.variablesdoesn't exist, preventing potential runtime errors.
67-72: LGTM!The function correctly aggregates publicly visible functions and public variables using AST queries with appropriate visibility filters.
47-57: Add null safety checks foritem.inheritance.All three functions assume
item.inheritanceexists and is an array. If it'sundefined, calling.some()will throw a runtime error.Apply this diff to add defensive checks:
module.exports['has-functions'] = function ({ item }) { - return item.inheritance && item.inheritance.some(c => c.functions.length > 0); + return item.inheritance?.some(c => c.functions?.length > 0) ?? false; }; module.exports['has-events'] = function ({ item }) { - return item.inheritance && item.inheritance.some(c => c.events.length > 0); + return item.inheritance?.some(c => c.events?.length > 0) ?? false; }; module.exports['has-errors'] = function ({ item }) { - return item.inheritance && item.inheritance.some(c => c.errors.length > 0); + return item.inheritance?.some(c => c.errors?.length > 0) ?? false; };Likely an incorrect or invalid review comment.
- Updated all README.adoc to README.mdx - Moved `templates-md` and the contents to just `templates` - Updated `hardhat.config.js` to use `docs/config` - Updated `helpers.js` to account for adoc change - Updated `docs/config.js` to use mdx
Updated the following legacy patterns: - `https://url[Link Text]` -> `[Link Text](https://url)` - `WARNING: | IMPORTANT: | CAUTION: | IMPORTANT:` -> `<Callout type=warn"></Callout>` - `NOTE: | TIP:` -> <Callout></Callout> - Delimitters such as `====` -> `####` or removed if no header text present
|
Updated the following legacy patterns in the natspec:
With the |
| return `${pagePath}#${anchor}`; | ||
| } | ||
|
|
||
| // Process {REF} and other references |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So most replacing logic can be removed now right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for this repo we could remove pieces like L:146-149 and maybe L:157-162, but these are patterns used in other libraries. We definitely still need L:151-155 and the rest of functions to handle instances where a contract references another contract, .e.g. you might have {ERC20} inside ERC1155 comments and we need to turn that into a markdown link.
| @@ -0,0 +1,55 @@ | |||
| # TEMPLATE: Source Repository Trigger - Commit-Based Deployment | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to:
- Rename that workflow file to
docs.yml - Add a temporary manual dispatch in order to test here (which can be removed before merging)
Co-authored-by: James Toussaint <33313130+james-toussaint@users.noreply.github.com>
This PR adds the updated
templates-mdandconfig-md.jsto thedocsdirectory. By doing this we can generate API documentation forOpenZeppelin/docsremotely. Please see the guide hereSummary by CodeRabbit