Skip to content

Commit

Permalink
chore(examples): Refine the docstring for implicitInit
Browse files Browse the repository at this point in the history
  • Loading branch information
jubnzv committed Sep 17, 2024
1 parent 2c1139e commit 1c6deda
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion examples/implicit-init/implicitInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,27 @@ import { MistiTactWarning, Severity } from "../../src/internals/warnings";

/**
* An example of a custom detector that showcases the usage of the detector API.
* It reports all contracts that don't have an explicit implementation of the init function.
*
* It reports all the contracts that doesn't have an explicit implementation of the init function.
* ## Why is it bad?
* It is better to have an explicit definition of the init function to ensure the
* developer did not forget to initialize anything.
*
* ## Example
* ```tact
* contract Main {
* val: Int = 42;
* // Bad: no init function
* }
* ```
*
* Use instead:
* ```tact
* contract Main {
* val: Int = 42;
* init() {} // Good: the init function has been added
* }
* ```
*/
export class ImplicitInit extends ASTDetector {
async check(cu: CompilationUnit): Promise<MistiTactWarning[]> {
Expand Down

0 comments on commit 1c6deda

Please sign in to comment.