Skip to content

softvis/polymetric-views

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polymetric Views

Online version

If you just want to have a look, a recent version of Polymetric Views is hosted here. Simply open the page and once the demo data has loaded you can switch between layouts and mappings.

The demo data was created from a recent snapshot of the source of spring-core, which is part of the Spring Framework. The data file is about 5.7MB large, which explains the load time.

You can also use this online version to visualise your own projects. Simply load the MSE file with your metrics into the web page. (See section on inFamix below for details on how to create the MSE file.) Note that all the processing happens in your browser on your computer; no data is uploaded to a server.

Getting the metrics data with inFamix

To get the metrics for a Java, C, or C++ project use inFamix. On Linux simply call inFamix like this

inFamix -lang ( cpp | java | c ) -path path/to/project -mse path/to/msefile.mse

On OS X, depite the fact that inFamix is packaged like an application, it must also be used from the command line:

./inFamix.app/Contents/MacOS/inFamix -lang ( cpp | java | c ) -path path/to/project -mse path/to/msefile.mse

Copy the MSE file into the public directory and rename it to data.mse.

MSE is a file format. The files generated by inFamix use the MSE format to write FAMIX models. Information about FAMIX and MSE can be found on the Moose Technology website.

Displaying the polymetric views

Open the file public/polymetrics.html in a browser. If a file named data.mse is present a diagram for the data contained in that file should be displayed in the browser. In either case, other MSE files can be loaded from the page.

Note that depending on your browser and computer and the size of the MSE file it can take 10 seconds or more before the diagram is rendered. Switching between layouts and metrics mappings should be very quick.

Supported browsers: Firefox, WebKit/Blink-based browsers (e.g. Safari, Chrome), "modern" Internet Explorer (i.e. Internet Explore 9 and above). Other browsers may or may not work. Internet Explorer 8 and below definitely do not work.

Available metrics

The following metrics are currently available at the class level:

  • LOC (Lines of Code): the sum of the lines of code of all methods in the class
  • NOA (Number of Attributes): the number of attributes (instance variables/fields/members) of the class
  • NOM (Number of Methods): the number of methods in the class
  • NOPUBM (Number of Public Methods): the number of methods in the class that are public
  • WMC (Weighted Method Count): the sum of the weight of all methods in the class. We are using the method's Cyclomatic Complexity as its weight. This makes WMC the sum of the complexity of all methods in the class.
  • CBO (Coupling between Objects): the number of other types and classes the class is coupled to. This metric was proposed by Chidamber and Kemerer, and is described well in this brief intro.

The following ratios are also available at the class level:

  • LOC/NOM: The lines of code over the number of methods, i.e. the average method length
  • WMC/LOC: The total complexity over the number of lines of code, i.e. the average complexity per line of code

The following metric is available at the package/namespace level:

  • NOC (Number of Classes): the number of classes in the package/namespace. This includes classes that are in child packages/namespaces.

Implementation Notes

The MSE parser

The MSE parser in public/mseparser.js was generated with PEG.js. The grammar is included in mse/mse.pegjs. If you want to modify the grammar and regenerate the parser, run the generate.sh script. You will need Node.js, npm, and the pegjs package to do so. Detailed instructions are available in the PEG.js documentation.

Copyright and license

Copyright 2013 Erik Doernenburg

Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Polymetric views of class metrics in the tradition of CodeCrawler reimplemented with D3.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published