GNATMETRIC(1)

πŸ“¦ version 2019, in ubuntu jammy

πŸ’… GNATMETRIC(1) β€” Ada metrics tool

okay bestie, welcome to the ASIS Tools corner of the man pages, where we count things in Ada code and feel ✨ something ✨ about it. This is gnatmetric, and she is literally the metrics girlie of the GNAT fam. πŸŽ€


πŸ¦‹ NAME πŸ¦‹

gnatmetric β€” the Ada metrics tool. she computes. she counts. she serves numbers. periodt.


🌸 SYNOPSIS 🌸

gnatmetric [options] {filename | -files filename} [gcc_switches]

✨ DESCRIPTION ✨

so basically, gnatmetric takes a whole set of compilable Ada sources as input, computes a bunch of programming metrics for them, and then generates the output. that's it, that's the job, and she does it flawlessly. πŸ’…

you can hand her the Ada sources two ways:

  • just drop them straight in as command line arguments, or
  • put the names of the Ada sources you want metrics for into a textual file, and then pass the name of that file as the parameter of the -files option.

also, Documentation about the ASIS tools may be found in /usr/share/doc/asis-doc/ β€” but only if the asis-doc package is installed. if it's not installed, no docs for you bestie, go install it. πŸ™ˆ


πŸ‘‘ OPTIONS πŸ‘‘

  • -v β€” verbose mode. she talks a lot. we love that for her.
  • -q β€” quiet mode. she goes silent. mysterious. iconic.
  • -dv β€” generate debug output.
  • -dd β€” generate a string to be used as input for a progress indicator. it's giving loading screen energy. 🌈
  • -nocc β€” do not compute the McCabe Cyclomatic Complexity.
  • -noec β€” do not compute the Essential Complexity.
  • -nonl β€” do not compute the maximal loop nesting level.
  • -ne β€” do not consider exit statements as gotos when computing Essential Complexity.
  • -nolocal β€” do not compute detailed metrics for local program units.

πŸŽ€ Line metrics πŸŽ€

here's the vibe check: when you don't specify any of these explicitly, all line metrics are set on. but if you do specify some, then only the ones you specified get computed. choose wisely bestie. ✨

  • -la β€” the number of all lines.
  • -lcode β€” the number of code lines.
  • -lcomm β€” the number of comment lines.
  • -leol β€” the number of code lines that also contain comments. multitasking lines, we stan. πŸ’–
  • -lb β€” the number of blank lines.

πŸ’œ Element metrics πŸ’œ

same rule, different section: not specified explicitly = all element metrics are on. specify some = only those get computed. 😌

  • -ed β€” the total number of declarations.
  • -es β€” the total number of statements.
  • -eps β€” the number of public subprograms in a compilation unit.
  • -eas β€” the number of all the subprograms in a compilation unit.
  • -ept β€” the number of public types in a compilation unit.
  • -eat β€” the number of all the types in a compilation unit.
  • -enu β€” the maximal program unit nesting level.
  • -ec β€” the maximal construct nesting level.

πŸ¦‹ Output file control πŸ¦‹

  • -d dirname β€” put files with detailed metrics into dirname.
  • -x β€” generate the XML output. slay.
  • -nt β€” do not generate the output in text form. this implies -x.
  • -o file-suffix β€” the suffix for the file to put the detailed metrics for a source file. heads up: file-suffix should begin with a dot.
  • -og filename β€” the name of the file to put the global metrics info into. if it's not set, this info is sent to Stdout.
  • -ox filename β€” the name of the file to put the XML output into. this implies -x.
  • -sfn β€” use short source file name in the output.

πŸ“ Input files πŸ“

  • filename β€” the name of the Ada source file for which metrics should be computed. Wildcards are allowed, so go wild. πŸ”₯
  • -files filename β€” the name of the text file containing a list of Ada source files for which metrics should be computed.

πŸ’€ GCC switches πŸ’€

  • gcc_switches β€” passed to gnatgcc as "-cargs gcc_switches".

🌈 SEE ALSO 🌈

gnat(1), asistant(1), gnat2xml(1), gnatcheck(1), gnatelim(1), gnatpp(1), gnatstub(1), gnattest(1)

Documentation about the ASIS tools may be found in /usr/share/doc/asis-doc/ if the asis-doc package is installed. The reference documentation about ASIS is excluded due to license problems, but may be found in various formats at http://libre.adacore.com/developers/documentation. (iykyk 🫢)


ok that's the whole page bestie, every flag accounted for, no cap. now go compute some metrics and be the main character of your codebase. πŸ’…βœ¨

Debian GNU/Linux Β· 2014-08-09 Β· GNATMETRIC(1) β€” mwah, signing off πŸŽ€πŸ’–

πŸ“¦ where this page comes from