unlock icon indicating copy to clipboard operation
unlock copied to clipboard

Solidity contracts lint rules

Open HardlyDifficult opened this issue 5 years ago • 3 comments

Describe the solution you'd like Create a smart contract style guide to answer common questions / best practices.

Questions (we can add to this overtime):

  • Use public variables or private w/ getter
  • When to use events
  • Accept arrays for batch transactions? Or always keep functions single purpose and use batch transactions instead.

HardlyDifficult avatar Mar 02 '20 19:03 HardlyDifficult

What do you think @clemsos ?

julien51 avatar Jan 28 '22 02:01 julien51

yes possibly. We can have general rules written down, maybe even explicit the existing ones (like the mixins etc).

Also would be good to enforce things with a stronger linter - goes with #7739 too.

clemsos avatar Jan 28 '22 11:01 clemsos

Renamed as « define sol contracts mint rules » so it becomes more actionable.

clemsos avatar Jul 25 '22 13:07 clemsos

Here is a new plugin just out to support prettier for solidity https://github.com/prettier-solidity/prettier-plugin-solidity/releases/tag/v1.0.0?utm_source=substack&utm_medium=email

clemsos avatar Nov 23 '22 07:11 clemsos

looking into it, solhint does quite a good job of catching inconstencies in contract writing style. We just need to enforce these better - that requires a rewriting/reordering of some functions and variables names

clemsos avatar Nov 25 '22 11:11 clemsos