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

New Rule: Private Variables #16

Open
justinkaseman opened this issue Feb 15, 2024 · 0 comments
Open

New Rule: Private Variables #16

justinkaseman opened this issue Feb 15, 2024 · 0 comments

Comments

@justinkaseman
Copy link

Description

Add a solhint rule to enforce the following recommendation from the Chainlink contracts style guide:

All contract variables should be private by default. Getters should be explicitly written and documented when you want to expose a variable publicly.
Whether a getter function reads from storage, a constant, or calculates a value from somewhere else, that’s all implementation details that should not be exposed to the consumer by casing or other conventions.

https://github.com/smartcontractkit/chainlink/blob/3a74dc13b2d42316803b26b2254caa12f7beccb4/contracts/STYLE_GUIDE.md?plain=1#L323

Steps

  1. Make a solhint rule and open a PR against this repository's master branch
  2. Once merged, open a PR to the Chainlink repository that updates the STYLE_GUIDE.md to reference the new rule
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

No branches or pull requests

1 participant