Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
documentation:style_guide [2017-02-24 15:57] mh |
documentation:style_guide [2019-10-22 09:14] mh |
||
---|---|---|---|
Line 13: | Line 13: | ||
There is also some automatic support to check whether a Curry program follows | There is also some automatic support to check whether a Curry program follows | ||
some parts of this style guide. | some parts of this style guide. | ||
- | The recent releases of the Curry systems | + | A style checker for Curry is available in the Curry package `stylechecker` |
- | [[http://www.informatik.uni-kiel.de/~pakcs/ | PAKCS]] and | + | which can be installed via the command |
- | [[http://www-ps.informatik.uni-kiel.de/kics2 | KiCS2]] | + | |
- | contain a style checker which can be invoked by the command | + | |
- | curry style <Curry program> | + | cypm update && cypm install stylechecker |
- | It should be noted that these tools checks only a small part of | + | This installs the executable `curry-stylechecker` into the directory |
+ | `~/.cpm/bin` (which should be added to your path). | ||
+ | After the successful installation, | ||
+ | the style checker which can be invoked by the command | ||
+ | |||
+ | curry-stylecheck <Curry program> | ||
+ | |||
+ | It should be noted that this tool checks only a small part of | ||
the style rules (mainly indentation rules). | the style rules (mainly indentation rules). | ||
Line 38: | Line 43: | ||
Then the Curry style checker produces the following style violations: | Then the Curry style checker produces the following style violations: | ||
- | > curry style Test | + | > curry-stylecheck Test |
... | ... | ||
- | Line 3.7 GuardedRhs: Bars are not aligned. | + | Test: 3:1-5:43: Warning: `type signature` missing |
- | Line 3.19 GuardedRhs: Equality signs are not aligned. | + | Hint: `top level functions` should have `type signatures` |
- | Line 7.9 IfThenElse: Wrong indentation of keywords. | + | ... |
- | Line 10.0 Line is longer than 80 characters. | + | Test: 3:7-5:43: Warning: `guards` not aligned |
- | Line 10.26 IfThenElse: Wrong indentation of subexpressions. | + | Hint: align `guards` |
+ | ... | ||
+ | Test: 3:7-5:43: Warning: `guard` equal signs not aligned | ||
+ | Hint: align `guard` equal signs | ||
+ | ... | ||
+ | Test: 7:1-8:26: Warning: `type signature` missing | ||
+ | Hint: `top level functions` should have `type signatures` | ||
+ | ... | ||
+ | Test: 7:9-8:26: Warning: `then` and `else` wrong alignement | ||
+ | Hint: align `then` and `else` | ||
+ | ... | ||
+ | Test: 10:1-10:83: Warning: line too long | ||
+ | Hint: line should be under `80` character(s) | ||
+ | ... | ||
+ | Test: 10:1-10:83: Warning: `type signature` missing | ||
+ | Hint: `top level functions` should have `type signatures` | ||