Monday, October 7, 2013

puppet-lint: how to sort your diagnostics

I find a bit irritating that the output of puppet-lint is not sorted. I refer to fix my puppet manifests top-down rather than by class of error. This does the job:
puppet-lint /vagrant/modules/mymodule/manifests/mymanifest.pp | awk '{ print $NF , $0}' | sort -n
and the result is neatly sorted by linenumber:
23 ERROR: create_certificate_file not in autoload module layout on line 23
33 ERROR: create_jks_store not in autoload module layout on line 33
38 WARNING: indentation of => is not properly aligned on line 38
39 WARNING: indentation of => is not properly aligned on line 39
41 ERROR: trailing whitespace found on line 41
44 WARNING: indentation of => is not properly aligned on line 44
45 WARNING: indentation of => is not properly aligned on line 45
46 ERROR: trailing whitespace found on line 46
48 ERROR: trailing whitespace found on line 48
52 ERROR: jks_java_wrapper_certificate not in autoload module layout on line 52
52 WARNING: line has more than 80 characters on line 52
66 ERROR: trailing whitespace found on line 66
70 ERROR: jks_java_wrapper_key not in autoload module layout on line 70
70 WARNING: defined type not documented on line 70
70 WARNING: line has more than 80 characters on line 70
76 WARNING: indentation of => is not properly aligned on line 76
77 WARNING: indentation of => is not properly aligned on line 77
78 WARNING: indentation of => is not properly aligned on line 78
80 WARNING: indentation of => is not properly aligned on line 80
81 ERROR: two-space soft tabs not used on line 81
90 ERROR: trailing whitespace found on line 90
91 WARNING: line has more than 80 characters on line 91
94 WARNING: line has more than 80 characters on line 94
97 ERROR: trailing whitespace found on line 97
100 ERROR: trailing whitespace found on line 100
101 ERROR: trailing whitespace found on line 101
113 WARNING: indentation of => is not properly aligned on line 113
114 ERROR: trailing whitespace found on line 114
114 WARNING: indentation of => is not properly aligned on line 114



Incidentally,most trivial issues can be fixed with a "pre" version of puppet-lint, or also CTRL + SHIFT + F in Geppetto.

No comments: