Command-line Documentation...















Usage:
vil /assembly=ASSEMBLYNAME1[,ASSEMBLYNAME2,...] [OPTIONS]

- or -

vil /a=ASSEMBLYNAME1[,ASSEMBLYNAME2,...] [OPTIONS]

Description:
Vil lists out contents and details of .Net Assemblies, and also provides complexity, coupling, cohesion, and inheritance metrics.

Examples:
For examples, please see the examples on the screenshots page, and in several of the descriptions farther down on this page.
Required:
/a, /assembly=ASSEMBLYNAME1[,ASSEMBLYNAME2,...]

The ASSEMBLYNAME is the name of the .Net assembly to be examined by vil.  The path seperator character needs to be correct to the OS being used.  Use '/' for *nix and '\' for Windows.  A special wildcard exists - "*.net".  This does not look for files with a ".net" extension, but instead will retrieve all ".dll" and ".exe" files.  Multiple assemblies can be declared by using wildcards or commas to seperate different assembly names.  Here are some examples:

  • vil /assembly=DataSender.dll
  • vil /assembly=*.dll
  • mono vil.exe /assembly='~/*.exe'  [LINUX]
  • vil /a='..\*.net'
  • vil /a='Reader.dll,Writer.dll'
  • vil /a='project/bin/*.dll'  [LINUX]
  • vil /a=Sys*.dll

File names generally do not need to be in quotes.  But, if the filename contains whitespace, single quotes should be used - as in some of the examples above.  

Assemblies need to be in a place where they would run - so that vil can determine where to load dependencies from.

Options:
/m, /metrics=METRIC1[,METRIC2,...] Adds output columns for each METRIC specified. Available metrics are:
modules, impTypes, classes, interfaces, enumerations, structs, types, LOC, dead, events, impInterfaces, WMC, DIT, CBO, RFC, NOC, constructors, methods, imps, fields, CC, params, maxStack, locals, tryblocks, abstracts, ecouplings, acouplings, abstractness, properties, instability, distance, LCOM 
Click here for full description of metrics

Examples:
  • vil /a=system.dll /m=cc,loc,params /scope=method
  • vil /a=app.exe /metrics=wmc,cbo,lcom,rfc /scope=class
/e, /element Indicates whether a line is for a class, module, method, field, etc...
/return Indicates the return Type for methods.
/static Indicates whether each element is static or instance.
/visibility Indicates visibility of an element (public, private, protected, etc...).
/long List long type names. This will cause the full namespace of each element to be included in the listing. Although more precise, this can hinder readability.
/notrim When output is to console or to a non-html file, the default is to use abbreviated text, where viable, to make it more presentable in the console.  With the "notrim" option, no abbreviation will occur. 
/s, /sort=metric Sorts(descending) the output by a specified metric.
/sorta=metric Sorts(ascending) the output by a specified metric.
/h, /head[=NUM] Limits output to the top NUM elements. If not specified, default is 15.
/tail[=NUM] Limits output to the bottom NUM elements. If not specified, default is 15.
/out=FILENAME Send output to a file named FILENAME, as opposed to the console.
/outHtml=FILENAME Send output as an Html Page, along with a summary of the query itself,  to a file named FILENAME.
/outHtmlShort=FILENAME Send output as an Html Page to a file named FILENAME.  Same as above, but without the query details.
/outHtmlTable=FILENAME Returns just an Html table to a file named FILENAME. Same as above, but without the Html and Body tags, and without the embedded stylesheet.  This is useful for situations where the metrics table will be part of a page that another application or script will assemble.
/outXml=FILENAME Returns an XML document to a file named FILENAME. The document defines the request, as well as the results. The XML is very readable and self-explanatory.
/title='TITLE' The TITLE needs to be in quotes.  If generating an Html output(from the 3 preceding options), the title option can be used to give a title that will be displayed in the metrics table in Html.
/sc, /scope=SCOPE

By default, vil will return almost all code elements (class, method, etc.) that exist in the assemblies of a query.  This can be considerably more than one desires.  Scope allows the ability to limit the output to certain categories of code elements.  Example:  "/scope=method"  would only return methods.

Valid scopes are:

  • all
  • assembly
  • type (includes classes, structs, enumerations, and interfaces)
  • method
  • imp (includes methods and constructors)
  • imptype (includes classes and structs)
  • class
  • enumeration
  • interface
  • struct
  • constructor
  • default

 

/mo, /module Indicates which module (DLL or EXE) a code element came from.  This is helpful in multi-assembly queries.
/f, /filter='EXPRESSION' Limits output to records that meet the criteria specified in the EXPRESSION.

Example #1: /filter='methods>4' would limit output to classes and structs that have greater than 4 methods.

Example #2: /filter='params>4 && locals<7' would limit output to methods and constructors that have more than 4 parameters and less than 7 local variables.

Expression Notes:
  • || is the "or" symbol.
  • && is the "and" symbol.
  • <, >, <=, >=, ==, and != may all be used in expressions.
  • parenthesis () may be used in expressions.
  • generally, expression syntax is c# syntax (which is also pretty much the same as java)

/noJudge The "noJudge" option disables judgemental color-coding of metrics.  If running in a Linux console, or using any of the Html outputs, metric values are color coded.  By default, a "red" metric is for metrics with a very high value (99th percentile), and a "yellow" metric is used for metrics with a high value (approx. 97+ percentile).  Percentiles are based on a sampling of numerous opensource .Net software projects. 
/nix

This option is only applicable when running on Microsoft Windows.  This option generates output to console, or to a file using the "/out" option, as though it were being run on Linux.  The implication of this is that judgemental color coding escape sequences will be generated in the output.  You would not want to use this if you were on Microsoft Windows using the standard "command.exe" and "cmd.exe" consoles.  This option has value when you are using a *nix emulation console in Microsoft Windows, such as Cygwin, MKS Toolkit, or Microsoft Windows Services for Unix.  

** Note:  When using this option without the "/out" option, and therefor having output come straight to the console, the output contains the color-escape sequences - but they will not be rendered correctly unless you have the output piped through a Linux command - such as "cat".

Example:  To get color output to a *nix emulation shell:

vil /assembly=*.dll /metrics=loc /nix | cat

 

/noLogo Suppresses version and copyright notices.
/test By default, classes that are test fixtures for either NUnit, MbUnit, or csUnit will be ignored for analysis purposes. To be very precise, this also includes any class that inherits from a class that has an attribute that inherits from any of these:
  • NUnit.Framework.TestFixtureAttribute
  • csUnit.TestFixtureAttribute
  • MbUnit.Core.Framework.TestFixturePatternAttribute
The "/test" option will cause test fixtures for NUnit, MbUnit, and csUnit to be treated as any other class - and included in metrics calculations.
Files of Interest: (These files are in the same location as vil.exe)
judge.vjf

This file contains a list of metrics and border-line values that are used for color coding results in HTML and in *Nix shell output. Each line starts with either "imp", "type", or "module". "imp" lines are lines that define ranges for methods and constructors. "Type" lines are for classes and structs, and "module" is for modules and assemblies. The next item on a line is the name of a metric. The 3rd item on the line is the threshold value for that metric that should be considered "very high". The 4th, and optional, item is for threshold values that are considered "high".

Example:

imp cc 25 18

The line indicates that for methods and constructors, cc(cyclomatic complexity) values of 25 or more are tagged as "very high" for color coding purposes, and values of 18 or more are considered "high".
The first 2 lines in the file:

consoleveryhigh 31
consolehigh 33

... indicate the ANSI color codes that get used for console color on *nix emulation shells and on Linux. For HTML output, the colors are determined by a stylesheet in "vil.css".

The values currently in this file are not totally arbitrary. They are based on an analysis of many .Net open-source software applications. The "very high" values are generally at the 99th percentile or higher, while the "high" values are generally at the 97th or higher percentile.

vil.css

This is a stylesheet that can control many style elements within HTML output. It is fairly self-explanatory.

vil.exe.config

This is a .Net configuration file. You will likely not need to alter this. However, if you are working with Microsoft.Net versions other than the released versions of .Net 1.0 or 1.1, you may need to alter this file to allow vil to work with special, or yet to be released, versions of Microsoft.Net.

vil.lic

You will probably not have this file. If you need to analyze sets of assemblies that exceed 100 types(classes, enums, interfaces, and structs), you can acquire a "vil.lic" file (by emailing)that will allow an unlimited number of types.

Syntax Note:
Although the examples in this document use ( /metrics= ) syntax, all of the following are recognized and treated equally:

/metrics=cc,cbo
-metrics cc,cbo
--metrics=cc,cbo
-metrics=cc,cbo

Options are not case sensitive. File names may need to be in quotes. 




©2003-2006 1bot.com. All rights reserved.