aolint - BAO Compensation Static Analysis, Workflow QA and cross-reference tool

The attached perl script, is a lint' tool for BAO modules. It will inspect a set of roar files looking for workflow that might cause compensation or other problems.

 

It looks for:

 

- unused context items.

- uninitialized context items.

- missing required parameters.

- xml content in a string value.

- missing/undefined processes

- unused or undefined tokens in transforms.

- context items with similar names (eg 'host name' and 'hostname' )

- badly formed XML in input boxes.

- use of transformations on process calls (not best practice)

- use of Ad-Hoc Query and string concatenation

- modules that are co-dependent (suggest refactoring)

- dev studio version differences

- check unused/unset globals

 

It accelerates the testing cycle, resulting in more robust workflow.

 

The Cross Reference report is useful for impact analysis reporting on module dependancy, process dependency and use of global context items.

 

Pre-requisites

 

To run it you will need

 

- perl (any platform) - on Windows I use Active Perl. 64 bit Cygwin Perl didnt seem to have all required modules available.

- the perl XML:SAX::Expat module. (install via perl package manager 'ppm' or linux package manager or  manually from http://search.cpan.org/~bjoern/XML-SAX-Expat-0.40/Expat.pm )

- since v1.4 - the perl XML::LibXML module (install via ppm , linux package manager or from http://search.cpan.org/~shlomif/XML-LibXML-1.90/ )

 

Execution

 

perl aolint.pl module1.roar module2.roar ....

 

or for more diagnostics...

 

perl aolint.pl INFO module1.roar module2.roar ....

 

for a cross reference of Processes and Modules

 

perl aolint.pl XREF module1.roar module2.roar ....

 

Example

 

$ ./aolint.pl Test.roar

Pass 1: Check local context items ...

 

module: Test.roar

 

process: :Test:Assign:

 

       WARNING:Text might be XML ? [<string>

<stuff>val

</stuff></string>]assign[1]:assignment[1]

       ERROR  :context item [context_undefined] used but not set.assign[1]:assignment[3]

 

process: :Test:SwitchTest:

 

       ERROR  :context item [set on case1 only] might not be initialised at assign[2]:assignment[2]

               set at switch[1]:sequence[2]:assign[1]:assignment[2]

 

process: :Test:TestCompensation:

 

       ERROR  :context item [b] might not be initialised at end[1]

               set at switch[1]:sequence[2]:assign[1]:assignment[1]

 

Pass 2: Check Processcalls...


:Test:caller

       ERROR: Required parameter [two] missing calling :Test:called

       call-process[2]

 

 

End.

For more diagnostics use./aolint.pl INFO ... or ./aolint.pl XREF ...

 

ps If you get a message saying ‘ParserDetails.ini’ doesn’t exist see http://johnbokma.com/perl/installing-xml-sax.html

 

pps Use at your own risk.

 

Any feedback appreciated

 

History

 

v1.7 - Fix HASH ref error in Cross Reference report

v1.6 - Skip concepts (not processed), report on Configs used across modules.

v.1.5 - Check unused or unset globals.

v1.4b - Fix to use Perl 5.10 + avoid using switch.pm (Thanks to Gordon McKeown)

v1.4 - check directly inputted XML that contains Context or Config refs, for well formedness - uses LibXML::XML

v1.3 - allow script to run from any folder

v1.2 - bugfix - for-loop context item checks

v1.1

- use of '//' in stylesheets (though quite common in BAO workflow, generally not good)

- unsused for-loop context item

- disable-output-escaping=yes (usually wrong most of the time)

- hide messages from certain modules but still parse them to check processes are called correctly ( -h flag).

It can help speed up testing and be used for QA reports.