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

Create Cadence Style Guide #2

Open
alilloig opened this issue Jul 28, 2022 · 1 comment · May be fixed by #3
Open

Create Cadence Style Guide #2

alilloig opened this issue Jul 28, 2022 · 1 comment · May be fixed by #3
Assignees
Labels
SC-Eng Issues that we want to see surfaced in SC-Eng ZH Board

Comments

@alilloig
Copy link
Member

Context

Developers need better guidelines for how to write clean cadence code.

Definition of Done

Create a guide in the cadence section of the docs site that give recommendations for Cadence style

  • line length
  • function, field, and type comments (paremeters returns) /// (three slashes)
  • indentation, spaces
  • var/let type, spaces
  • bracket spaces
  • conditions and panic message formats
  • comments on function interface or on function implementation
  • Whitespace between code lines
  • High level documentation at the beginning of contracts/transactions
  • Contract, field, and function names and capitalization

PR Review

Who is your Code Partner - @joshuahannan
Who can provide external eyes - @satyamakgec

@alilloig alilloig added the SC-Eng Issues that we want to see surfaced in SC-Eng ZH Board label Jul 28, 2022
@alilloig alilloig self-assigned this Jul 28, 2022
@alilloig
Copy link
Member Author

alilloig commented Jul 28, 2022

@bluesign commented 6 days ago
I think few important coding style questions are:

When to use panic?
When to return optional?
How to label functions? Where to use _ ?
When to use Struct vs Resource ?
Where to use access(contract) vs pub ?
How to link Resources correctly ? e.g. via multiple interface restrictions vs via multiple paths.
I think when repo is live, we should make each item as PR, then discuss on each PR if needed.
If we don't have opinion how it should be (more debatable), maybe we can start from an issue.

@alilloig alilloig linked a pull request Jul 28, 2022 that will close this issue
5 tasks
@alilloig alilloig linked a pull request Jul 28, 2022 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SC-Eng Issues that we want to see surfaced in SC-Eng ZH Board
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant