{"id":13587339,"url":"https://github.com/shellspec/shellmetrics","last_synced_at":"2025-04-12T19:06:29.637Z","repository":{"id":55155368,"uuid":"247692930","full_name":"shellspec/shellmetrics","owner":"shellspec","description":"Cyclomatic Complexity Analyzer for bash, mksh, zsh and POSIX shells","archived":false,"fork":false,"pushed_at":"2023-10-02T17:15:41.000Z","size":44,"stargazers_count":50,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-22T05:04:05.783Z","etag":null,"topics":["bazh","cyclomatic-complexity","metrics","mksh","script","shell","shell-script","test","yash","zsh"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shellspec.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ko1nksm"}},"created_at":"2020-03-16T12:10:23.000Z","updated_at":"2024-08-01T16:33:20.586Z","dependencies_parsed_at":"2024-08-01T16:33:17.926Z","dependency_job_id":null,"html_url":"https://github.com/shellspec/shellmetrics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellspec%2Fshellmetrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellspec%2Fshellmetrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellspec%2Fshellmetrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellspec%2Fshellmetrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellspec","download_url":"https://codeload.github.com/shellspec/shellmetrics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224742331,"owners_count":17362232,"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":["bazh","cyclomatic-complexity","metrics","mksh","script","shell","shell-script","test","yash","zsh"],"created_at":"2024-08-01T15:06:09.877Z","updated_at":"2024-11-15T07:15:58.874Z","avatar_url":"https://github.com/shellspec.png","language":"Shell","funding_links":["https://github.com/sponsors/ko1nksm"],"categories":["Shell"],"sub_categories":[],"readme":"# ShellMetrics\n\nShellMetrics is Cyclomatic Complexity Analyzer for shell script.\n\n[![Travis CI](https://img.shields.io/travis/com/shellspec/shellmetrics/master.svg)](https://travis-ci.com/shellspec/shellmetrics)\n[![Coveralls](https://img.shields.io/coveralls/github/shellspec/shellmetrics.svg)](https://coveralls.io/github/shellspec/shellmetrics?branch=master)\n[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/shellspec/shellmetrics)](https://www.codefactor.io/repository/github/shellspec/shellmetrics)\n[![GitHub top language](https://img.shields.io/github/languages/top/shellspec/shellmetrics.svg)](https://github.com/shellspec/shellmetrics/search?l=Shell)\n[![License](https://img.shields.io/github/license/shellspec/shellmetrics.svg)](https://github.com/shellspec/shellmetrics/blob/master/LICENSE)\n\n## Requirements\n\nShellMetrics is written by shell script.\nOne of the following shells is required: `bash`, `mksh`, `yash`, `zsh`\n\n## Installation\n\n```sh\ncurl -fsSL https://git.io/shellmetrics \u003e ~/bin/shellmetrics\nchmod +x ~/bin/shellmetrics\n```\n\nor\n\n```sh\nwget https://git.io/shellmetrics -O ~/bin/shellmetrics\nchmod +x ~/bin/shellmetrics\n```\n\n## Usage\n\n```\nUsage: shellmetrics [options] files...\n\n  -s, --shell           The path of shell to use as parser [default: bash]\n                          Supported shells: bash, mksh, yash, zsh\n      --[no-]color      Enable / Disable color [default: enabled]\n      --csv             Generate CSV output\n  -p, --pretty          Format pretty with wrapper function(s)\n  -d, --debug           Display parsed data for debug instead of report\n  -v, --version         Display the version\n  -h, --help            You're looking at it\n```\n\nMetric values vary slightly depending on the shell used.\n\n## Example\n\nShellMetrics self metrics.\n\n- NLOC - Non-comment Lines of Code\n- LLOC - Logical Lines of Code\n- CCN - Cyclomatic Complexity number\n\n```console\n$ shellmetrics ./shellmetrics\n==============================================================================\n  LLOC  CCN  Location\n------------------------------------------------------------------------------\n     1    1  usage:9 shellmetrics\n     1    1  proxy:35 shellmetrics\n     1    1  putsn:40 shellmetrics\n     1    1  putsn:44 shellmetrics\n     4    2  putsn:39 shellmetrics\n     9    2  count:51 shellmetrics\n     2    1  is_comment_line:64 shellmetrics\n     2    2  is_blank_line:69 shellmetrics\n     3    1  repeat_string:73 shellmetrics\n     3    2  array:79 shellmetrics\n     2    1  array_is_empty:86 shellmetrics\n     7    2  push_array:91 shellmetrics\n    11    3  pop_array:102 shellmetrics\n    11    3  shift_array:119 shellmetrics\n     8    3  peel:136 shellmetrics\n     7    3  pretty:149 shellmetrics\n     2    1  process:162 shellmetrics\n    65   27  parse:167 shellmetrics\n    21    8  analyze:238 shellmetrics\n    56    6  default_report:274 shellmetrics\n    10    4  csv_report:372 shellmetrics\n     3    1  title:389 shellmetrics\n     9    5  init_mode:395 shellmetrics\n     9    2  main:412 shellmetrics\n     4    2  error:426 shellmetrics\n     2    1  abort:435 shellmetrics\n     1    1  unknown:440 shellmetrics\n     1    1  required:441 shellmetrics\n     1    1  param:442 shellmetrics\n     1    1  params:443 shellmetrics\n     2    1  params_:444 shellmetrics\n    20   12  parse_options:446 shellmetrics\n    52    2  \u003cmain\u003e shellmetrics\n------------------------------------------------------------------------------\n 1 file(s), 33 function(s) analyzed. [bash 4.4.20(1)-release]\n\n==============================================================================\n NLOC    NLOC  LLOC    LLOC    CCN Func File (lines:comment:blank)\ntotal     avg total     avg    avg  cnt\n------------------------------------------------------------------------------\n  412   12.48   332   10.06   3.18   33 shellmetrics (479:5:62)\n------------------------------------------------------------------------------\n\n==============================================================================\n NLOC    NLOC  LLOC    LLOC    CCN Func File    lines comment   blank\ntotal     avg total     avg    avg  cnt  cnt    total   total   total\n------------------------------------------------------------------------------\n  412   12.48   332   10.06   3.18   33    1      479       5      62\n------------------------------------------------------------------------------\n```\n\n## Contribution\n\n### How to test\n\nShellMetrics tested by [ShellSpec](https://github.com/shellspec/shellspec).\nTo test, install ShellSpec and run `spellspec` on the project root directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellspec%2Fshellmetrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellspec%2Fshellmetrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellspec%2Fshellmetrics/lists"}