Have you come across your teammates, checking in scripts without running it, with syntax errors, malformed XML documents, broken Makefiles .... well, there is some hope, you could help (by sharing this link! :-) )
Mostly, if its code in a compiled language (like C), developers at least compile the code (might not test!) before checking into version control. But, in case of XML documents, scripts etc, the code gets checked in, and it will not error out until some test case is completely run, or in the nightly regressions!
Its not really difficult to do some basic validation of scripts, Makefiles, or even XML documents before a check-in. Most languages/tools have an option to do basic checks - syntax checks, dry run (without actually executing the commands), bytecode generation etc. Here are some, which I often use:
Does a dry-run, shows which targets would get built on an actual run.
Does a compilation and says if syntax is OK or not (there are caveats with BEGIN blocks, but at least there is something!)
This is good, there is a separate utility to do the compilation! (just run pycompile on your scripts once before you proceed)
Again, syntax checks without actually executing anything.
The name says it all! Even though there are plenty of options, you could just run once [without even options] on your XML docs to see if its well-formed.
Lua bytecode compiler, like pycompile. Generates luac.out which you can delete :-)
Mostly, if its code in a compiled language (like C), developers at least compile the code (might not test!) before checking into version control. But, in case of XML documents, scripts etc, the code gets checked in, and it will not error out until some test case is completely run, or in the nightly regressions!
Its not really difficult to do some basic validation of scripts, Makefiles, or even XML documents before a check-in. Most languages/tools have an option to do basic checks - syntax checks, dry run (without actually executing the commands), bytecode generation etc. Here are some, which I often use:
Make
make -nDoes a dry-run, shows which targets would get built on an actual run.
Perl
perl -cDoes a compilation and says if syntax is OK or not (there are caveats with BEGIN blocks, but at least there is something!)
Python
pycompileThis is good, there is a separate utility to do the compilation! (just run pycompile on your scripts once before you proceed)
bash
bash -nAgain, syntax checks without actually executing anything.
XML
xmllintThe name says it all! Even though there are plenty of options, you could just run once [without even options] on your XML docs to see if its well-formed.
Lua
luacLua bytecode compiler, like pycompile. Generates luac.out which you can delete :-)
No comments:
Post a Comment