A "lint" program for Graphviz files

Until a “real” lint is added to Graphviz, here is an add-on.
It tries to flag

  • attributes that are not defined for the object / engine. e.g.
    • rankdir applied to a cluster
    • rank used if fdp is the engine
    • coooler=red
  • values that are illegal (fail type check) or out-of-bounds e.g.
    • rank=top
    • width=78
    • weight=-2
    • fixedsize=“ok”

It is moderately tested, but bugs undoubted lurk.
Find it here:

Note: just because an attribute or value is flagged that does not mean that there is an error. It is quite OK to make up attribute name, and the compiler is quite forgiving about odd values. But gvlint will remind you that you might want to make some fixes.

Some examples:

FILE tests/121.dot  ENGINE: not set, using dot
Bad value for edge (B->D) (constraint = none). Should be "bool".
Bad value for edge (B->D) (constraint = none). Should be "bool".
There is/are 2 incorrect usage(s) of attribute "constraint" for edges
FILE tests/2193.dot  ENGINE: not set, using dot
"color" is not a defined (Root) graph attribute for "dot". 
"penwidth" is not a defined (Root) graph attribute for "dot". 
There is/are 1 incorrect usage(s) of attribute "color" for (Root) graph
There is/are 1 incorrect usage(s) of attribute "penwidth" for (Root) graph
FILE tests/graphs/b94.gv  ENGINE: not set, using dot
"color" is not a defined (Root) graph attribute for "dot". 
There is/are 1 incorrect usage(s) of attribute "color" for (Root) graph
1 Like

It’s neat, but I kinda wish it was stand-alone. I don’t think the systems I work with have gvpr.

Can you modify it so it can take arguments for ignoring/supressing attribute warnings?

gvpr comes as a standard part of the Graphviz package. If you have dot you also have gvpr.

Are you asking to suppress all attribute warnings (and just show type checking), or only suppress specific attribute warnings?