Linting

Factori offers some linting capabilities on Michelson contracts. This feature is in a beta state.

Linting

The Factori lint instruction goal is to detect some syntactic problems in the Michelson file that we thought were worth keeping a trace of.

Smart contract structure

The structure of a Michelson smart contract is not predetermined, it has mandatory sections (like the parameter, storage, and code sections) but they can appear in a different order, it depends on the compilation. The order that Factori lint choose is this one: parameter -> storage -> code -> views. If a smart contract doesn't follow this order, the linter will print a warning telling what section is at the wrong place and what was expected.

Annotations

The annotations in the Michelson files are important, they define the entrypoint in the parameter and also the field of the storage.

Missing ones

The lint command shows when an annotation in the storage/parameter is missing. It will be easier for Factori to generate an interface with a lot of annotations.

Forbidden ones

Factori also holds a set of forbidden annotations to warn the user. For example, if you have a field of the storage named transfer_tokens, Factori will print a warning because it's a reserved word from Michelson. This set of forbidden annotations can grow or shrink depending on the evolution of the tool.

Incoherent ones

Michelson allows multiple uses of the same annotation. It can become confusing if the annotation %token_id defines a natural but at the same time another annotation %token_id defines a string. Factori detects these weird cases and warns the user.