-
For readability purposes, I prefer to write...
...rather than...
...but sometimes, I forget to add the type declaration, which leads to inconsistent code style. Is there an option to enforce explicit type declarations? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You could write a custom rule that flags this scenarios. To view the AST (PSI) of your source code, you can use the PSI Viewer plugin for IntelliJ. This is helpful when implementing and debugging rules. |
Beta Was this translation helpful? Give feedback.
-
If you only care about that on the public functions/properties you could also use this rule: https://detekt.dev/docs/rules/libraries#librarycodemustspecifyreturntype |
Beta Was this translation helpful? Give feedback.
You could write a custom rule that flags this scenarios.
To view the AST (PSI) of your source code, you can use the PSI Viewer plugin for IntelliJ. This is helpful when implementing and debugging rules.