-
Notifications
You must be signed in to change notification settings - Fork 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
Lint rules for contracts #4770
Comments
#3787 will introduce some constraints on use of promises in contracts. Because upgrades are voluntary we can wait to quiesce non-durable promises. But we also need to think through unexpected crashing. "All contracts should be of the form that awaits inside of a contract are not awaiting someone else's action." - @dtribble |
How hard would it to detect files with a zoe-compliant |
I think the rule would have a precondition that it searches the file for whether to try testing it. Like https://github.com/Agoric/agoric-sdk/blob/fd1c24a84584f6b5f7b7d5e8b21d756464db05b6/packages/eslint-plugin/lib/processors/use-jessie.js (btw @michaelfig where does that code live now? I can't find a repo for https://www.npmjs.com/package/@jessie.js/eslint-plugin ) I imagine you can get an AST for that first pass and skip if there's no Though if the inclusion criterion was being zoe-compliant then it wouldn't be feasible to lint for that. I take it you're asking because you'd prefer not to have a contract signifier in the filename. If so, what are some reasons? |
just long names. I don't think it's a huge deal, I just thought it might not be hard to find the files without a naming convention. |
Is that so? Please elaborate. |
I think I remember the issue: The Jessie definition serves several purposes. One of them is that Jessie be simple enough that a eval/apply style Jessie interpreter can be straightforwardly implemented in any conventional imperative language. In practice, this aligns extraordinarily well with Jessie's other design constraints, such as being simple enough that you (and eventually tools) can reason about your Jessie code. Our contracts need the second but not really the first in any deployment scenario we are considering. Generators with But generators with non-top-level All that said, I think contract specific lint rules would be great! Leaving aside generators, these should be in addition to Jessie rules, not instead of them. Are there other cases that are problematic in this way other than generators? |
https://github.com/Agoric/agoric-sdk/tree/ta/jessie-check-contracts adds jessie-check to all non-test contracts (that I could find use
Aside from the generator/await (which the last comment provides a solution for) the rest seem trivial to fix. Though I don't know the safe alternative to
👍 I'll revise the PR description. |
import { makeMap } from 'jessie.js'; |
@turadg really needed for launch? |
a wish for a contract static check: #7771 (comment) |
closes: #9693 ## Description more linting for #9693, using endojs/endo#2369 Also adopts `harden-exports` for `.contract.js` modules, - #4770 ### Security Considerations none ### Scaling Considerations none ### Documentation Considerations none ### Testing Considerations CI with expected errors ### Upgrade Considerations n/a
What is the Problem Being Solved?
Our contracts need tighter linting than our general eslint-config.
@jessie-check
provides some of that additional constraint.TBD what else we need to constrain (ticket created with the idea that jessie-check wasn't appropriate but it is in part)
Description of the Design
Define file path patterns for what needs to be contract-linted so that files don't have to include a pragma.
Define rules for that set
Consider using rules that require type information from TypeScript (using https://typescript-eslint.io/ )
Security Considerations
--
Test Plan
--
The text was updated successfully, but these errors were encountered: