[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Static Analysis of OpenLDAP



I've thrown together a quick style sheet to view the XML file with
issues, if anyone cares.  It works, but can definitely be improved:-)

-- 
Hallvard

/*
  Quick stylesheet to display issues.xml downloaded from the klocwork
  issues list.  It lacks klocwork's ability to jump around in the
  code which you can do online, but is usable for offline browsing.

  Download issues.xml to the directory with this file.  Run:
	perl -x issues.css XML-file...
  to edit the XML file(s) a bit and apply this style sheet.

  I *think* it only uses standard CSS keywords, color names, etc.
  No attempt at beauty, and I'm sure I should have been using
  XSLT or something instead of Perl.  So shoot me.  Or improve it.

#! perl -wp0777i
# Apply stylesheet if not already done.
BEGIN { ($css = $0) =~ s%^.*[\\/]%%; $css = qq(type="text/css" href="$css"); }
s%^(<\?xml\s.*>\n)(?=<errorList)%$1<?xml-stylesheet $css?>\n%;
# Shorten loooong filenames.
s%/home/klocwork/opensourceprojects/openldap/openldap/%%g;
__END__
*/


/* Element indentation + ordering reflects the structure of issues.xml. */
errorList		{ display:block; background:white; color:black; }
 problem		{ display:block; background:#f8f8f8; margin-top:2ex; }
  /* header: Issue# */
  problemID		{ display:block; text-align:center; font-weight:bold; }
  problemID:before	{ content:"Issue#"; }
  /* 1st line: file...code */
  file			{ color:teal; }
  method, line		{ color:navy; padding-left:1ex; }
  method:after		{ content:"()"; }
  line:before		{ content:"line "; }
  column		{ display:none; }
  code			{ color:red; padding-left:1ex; } /* Type of problem */
  code:before		{ content:"["; }
  code:after		{ content:"]"; }
  /* I wanted code{display:run-in} (with message) but that fails on firefox */
  message		{ display:block; padding-left:2em; }
  anchor		{ display:none; }
  prefix, postfix	{ color:olive; font-size:smaller; }
  prefix:before		{ content:"<<"; }
  prefix:after		{ content:">"; }
  postfix:before	{ content:"...<"; }
  postfix:after		{ content:">>"; }

  trace			{ display:block; }
   traceBlock		{ display:block; margin:1ex; background:#f0f0f0; }
   traceBlock:before	{ color:teal;
			  content:attr(file) " : " attr(method) "():"; }
    /* traceLine element: No content. Attributes line,text,type,refId. */
    traceLine		{ display:block; margin-left:1em; }
    traceLine[type="E"]	{ color:blue;  }
    traceLine[type="C"]	{ color:green; }
    traceLine:before	{ color:black; content:attr(line) ": "; }
    traceLine:after	{              content:attr(text);      }

  citingStatus		{ display:block; color:maroon; text-align:center; }
  state			{ display:none;  } /* E.g. state "New" */
  history		{ display:block; }
   statusUpdate		{ display:block; padding-left:2em; }
   statusUpdate:before	{ color:fuchsia; content:"[" attr(user) "] "; }
    comment		{}

  severity, severitylevel, displayAs, dateOriginated, url { display:none; }