Skip to content

Make a Coding Style Guide for Compose #103

@mudgen

Description

@mudgen

Documentation Issue

Compose has a specific coding style guide but it isn't directly documented.

Recommended change

Make a STYLE.md file that concisely provides the coding style that is required by all Compose code. Update existing documentation to tell contributors to follow the style guide.

Additional Context

The style guide can be derived from the ERC721Facet.sol and LibERC721.sol, and ERC20Facet.sol and LibERC20.sol files.

The style guild should concisely give rules and examples of rules as needed to make it clear.

Here are some points that should be included in the style guide:

  1. All parameters names to events, errors and functions should be preceded with an underscore "_".
  2. One line if statements without code block brackets "{" and "}" are not allowed. Use a newline and brackets.
  3. Internal functions in facets should be preceded with "internal". Note: There should be none or few internal functions in facets. Repeat yourself if it makes the code easier to follow or read.
  4. Internal functions in Solidity libraries are not proceeded with anything, since, in Compose, all functions in libraries are internal functions.
  5. Use delete to set a value to 0.
  6. Use camel case for names of variables and functions and contract and library names unless parts of it are usually uppercase like ERC.
  7. The formatting of code is determined by the default settings of forge fmt. Run forge fmt to format your code.

Tell users to look at ERC721Facet.sol and LibERC721.sol for more examples of the style guide.

More rules can be derived from the above mentioned source code files.

Helpful Information

Have a question? Please check our CONTRIBUTING file first - your answer might already be there!

Want to discuss something? For general questions, ideas, or brainstorming, please browse our discussions or start a new one.

You can also join our Discord to discuss the documentation issue.

Metadata

Metadata

Assignees

Labels

DocumentationImprovements or additions to documentation

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions