{"id":13806701,"url":"https://github.com/dspinellis/cqmetrics","last_synced_at":"2025-03-19T05:30:25.702Z","repository":{"id":2003085,"uuid":"22557991","full_name":"dspinellis/cqmetrics","owner":"dspinellis","description":"C Quality Metrics","archived":false,"fork":false,"pushed_at":"2022-06-14T07:53:29.000Z","size":134,"stargazers_count":65,"open_issues_count":4,"forks_count":11,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-02-28T16:00:43.870Z","etag":null,"topics":["c","metrics","quality-metrics"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dspinellis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-02T21:39:20.000Z","updated_at":"2025-02-01T18:41:42.000Z","dependencies_parsed_at":"2022-09-19T17:24:55.456Z","dependency_job_id":null,"html_url":"https://github.com/dspinellis/cqmetrics","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dspinellis%2Fcqmetrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dspinellis%2Fcqmetrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dspinellis%2Fcqmetrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dspinellis%2Fcqmetrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dspinellis","download_url":"https://codeload.github.com/dspinellis/cqmetrics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243971156,"owners_count":20376784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","metrics","quality-metrics"],"created_at":"2024-08-04T01:01:14.944Z","updated_at":"2025-03-19T05:30:25.355Z","avatar_url":"https://github.com/dspinellis.png","language":"C++","funding_links":[],"categories":["C/C++","Programming Languages","Tools"],"sub_categories":[],"readme":"# C Code Quality Metrics\n\n[![Build Status](https://travis-ci.org/dspinellis/cqmetrics.svg?branch=master)](https://travis-ci.org/dspinellis/cqmetrics)\n[![Coverity Scan Build Status](https://scan.coverity.com/projects/8464/badge.svg)](https://scan.coverity.com/projects/dspinellis-cqmetrics)\n[![DOI](https://zenodo.org/badge/22557991.svg)](https://zenodo.org/badge/latestdoi/22557991)\n\n\nThe program qmcalc will read a C source code file from its standard\ninput and print on its standard output a single line containing\ntens of metrics regarding size, complexity,\nused keywords, comments and documentation, use of the C preprocessor,\nand observed formatting style.\nThe full set of the metrics is documented in the file\n[metrics.md](https://github.com/dspinellis/cqmetrics/blob/master/metrics.md).\n\nThe code has been written to run efficiently and reliably.\nThe program receives the code to analyze from its standard input,\nso that it can process data coming e.g. directly out of a `git show` command,\nwithout having intermediate data touch the disk.\nAlso, the program can process code\nthat may not be easy (or possible) to fully parse using a compiler front-end,\ndue e.g. to missing header files or an unknown compiler configuration.\n\nFurthermore,\nthe software is designed in a way that should allow its easy extension to\nother languages with C-like syntax, such as Java, C++, C#, and Go.\nThe main thing you need to add is an *X*MetricsCalculator and an\n*X*Keyword class.\nPull requests for such extensions are more than welcomed.\n\n## Building\n\n### Prerequisites\n* C++ compiler\n* GNU make\n* [CppUnit](http://sourceforge.net/projects/cppunit/) for running `make test`\n\nTo build type change the directory to `src` (`cd src`) and run `make`.\nThis will also generate the files `header.tab` and `header.txt`,\nwhich can be used for loading the output into other programs\nfor further processing.\n\n### Install\n\n`cd src \u0026\u0026 make install`\n\n## Running\n* The  *qmcalc* program can process its standard input or report metrics on each of the specified files\n* The *qmcalc-showstyle* wrapper takes as a single argument a directory, and reports the metrics for each C file in the directory\n* The *qmcalc-sumstyle* wrapper  takes as a single argument a directory, processes all C files in the directory,\n  and for each metric from `ncpp_directive` and onward it reports\n    * the metric's ordinal number,\n    * the sum of the metric's values over all files, and\n    * the percentage of files for which the metric is non-zero.\n\n## Further reading\nThe style checks performed are based on the following guidelines.\n* [Google](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml)\n* [FreeBSD](http://www.freebsd.org/cgi/man.cgi?query=style\u0026sektion=9)\n* [GNU](https://www.gnu.org/prep/standards/html_node/Formatting.html)\n* [Recommended C Style and Coding Standards - updated version of the Indian Hill C Style and Coding Standards paper](http://www.cs.arizona.edu/~mccann/cstyle.html)\n* [Wikipedia summary](http://en.wikipedia.org/wiki/Indent_style)\n\n## Citation\n* The tool is described in detail in the following paper.\nDiomidis Spinellis, Panos Louridas, and Maria Kechagia. [The evolution of C programming practices: A study of the Unix operating system](http://www.dmst.aueb.gr/dds/pubs/conf/2016-ICSE-ProgEvol/html/SLK16.html) 1973–2015. In Willem Visser and Laurie Williams, editors, *ICSE '16: Proceedings of the 38th International Conference on Software Engineering*, pages 748–759, New York, May 2016. Association for Computing Machinery. ([doi:10.1145/2884781.2884799](http://dx.doi.org/10.1145/2884781.2884799))\n* Some other metrics are based on the paper [A Tale of Four Kernels](http://www.dmst.aueb.gr/dds/pubs/conf/2008-ICSE-4kernel/html/Spi08b.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdspinellis%2Fcqmetrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdspinellis%2Fcqmetrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdspinellis%2Fcqmetrics/lists"}