All Projects → dspinellis → cqmetrics

dspinellis / cqmetrics

Licence: other
C Quality Metrics

Programming Languages

C++
36643 projects - #6 most used programming language
shell
77523 projects
Makefile
30231 projects
sed
78 projects

Projects that are alternatives of or similar to cqmetrics

MRQy
MRQy is a quality assurance and checking tool for quantitative assessment of magnetic resonance imaging (MRI) data.
Stars: ✭ 58 (+16%)
Mutual labels:  quality-metrics
PTXQC
A Quality Control (QC) pipeline for Proteomics (PTX) results generated by MaxQuant
Stars: ✭ 34 (-32%)
Mutual labels:  quality-metrics
Asgan
A tool for analysis of assembly graphs
Stars: ✭ 26 (-48%)
Mutual labels:  quality-metrics

C Code Quality Metrics

Build Status Coverity Scan Build Status DOI

The program qmcalc will read a C source code file from its standard input and print on its standard output a single line containing tens of metrics regarding size, complexity, used keywords, comments and documentation, use of the C preprocessor, and observed formatting style. The full set of the metrics is documented in the file metrics.md.

The code has been written to run efficiently and reliably. The program receives the code to analyze from its standard input, so that it can process data coming e.g. directly out of a git show command, without having intermediate data touch the disk. Also, the program can process code that may not be easy (or possible) to fully parse using a compiler front-end, due e.g. to missing header files or an unknown compiler configuration.

Furthermore, the software is designed in a way that should allow its easy extension to other languages with C-like syntax, such as Java, C++, C#, and Go. The main thing you need to add is an XMetricsCalculator and an XKeyword class. Pull requests for such extensions are more than welcomed.

Building

Prerequisites

  • C++ compiler
  • GNU make
  • CppUnit for running make test

To build type change the directory to src (cd src) and run make. This will also generate the files header.tab and header.txt, which can be used for loading the output into other programs for further processing.

Install

cd src && make install

Running

  • The qmcalc program can process its standard input or report metrics on each of the specified files
  • The qmcalc-showstyle wrapper takes as a single argument a directory, and reports the metrics for each C file in the directory
  • The qmcalc-sumstyle wrapper takes as a single argument a directory, processes all C files in the directory, and for each metric from ncpp_directive and onward it reports
    • the metric's ordinal number,
    • the sum of the metric's values over all files, and
    • the percentage of files for which the metric is non-zero.

Further reading

The style checks performed are based on the following guidelines.

Citation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].