{"id":32117565,"url":"https://github.com/h-o-t/nocuous","last_synced_at":"2025-10-20T16:53:04.768Z","repository":{"id":37783751,"uuid":"195749056","full_name":"h-o-t/nocuous","owner":"h-o-t","description":"A static code analysis tool for JavaScript and TypeScript.","archived":false,"fork":false,"pushed_at":"2024-10-07T08:38:54.000Z","size":4334,"stargazers_count":42,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-20T16:53:03.126Z","etag":null,"topics":["javascript","testing","toxicity","typescript"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/h-o-t.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-08T06:20:55.000Z","updated_at":"2025-07-15T10:52:57.000Z","dependencies_parsed_at":"2023-01-21T12:16:07.025Z","dependency_job_id":null,"html_url":"https://github.com/h-o-t/nocuous","commit_stats":null,"previous_names":["kitsonk/nocuous"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/h-o-t/nocuous","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h-o-t%2Fnocuous","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h-o-t%2Fnocuous/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h-o-t%2Fnocuous/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h-o-t%2Fnocuous/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h-o-t","download_url":"https://codeload.github.com/h-o-t/nocuous/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h-o-t%2Fnocuous/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280127557,"owners_count":26276931,"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","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javascript","testing","toxicity","typescript"],"created_at":"2025-10-20T16:52:59.481Z","updated_at":"2025-10-20T16:53:04.757Z","avatar_url":"https://github.com/h-o-t.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nocuous\n\n![CI](https://github.com/h-o-t/nocuous/workflows/ci/badge.svg)\n[![jsr.io/@higher-order-testing/nocuous](https://jsr.io/badges/@higher-order-testing/nocuous)](https://jsr.io/@higher-order-testing/nocuous)\n[![jsr.io/@higher-order-testing/nocuous score](https://jsr.io/badges/@higher-order-testing/nocuous/score)](https://jsr.io/@higher-order-testing/nocuous)\n\nA static code analysis tool for JavaScript and TypeScript.\n\n## Installing the CLI\n\nIf you want to install the CLI, you would need to have Deno\n[installed first](https://docs.deno.com/runtime/getting_started/installation/)\nand then on the command line, you would want to run the following command:\n\n```shell\n$ deno install --name nocuous --allow-read --allow-net -f jsr:@higher-order-testing/nocuous/cli\n```\n\nYou can also \"pin\" to a specific version by using `nocuous@{version}` instead,\nfor example `jsr:@higher-order-testing/nocuous@1.1.0/cli`.\n\nThe CLI comes with integrated help which can be accessed via the `--help` flag.\n\n## Using the API\n\nIf you want to incorporate the API into an application, you need to import it\ninto your code. For example the following will analyze the Deno std assertion\nlibrary and its dependencies resolving with a map of statistics:\n\n```ts\nimport { instantiate, stats } from \"jsr:@higher-order-testing/nocuous\";\n\nawait instantiate();\n\nconst results = await stats(new URL(\"https://jsr.io/@std/assert/1.0.6/mod.ts\"));\n\nconsole.log(results);\n```\n\n## Architecture\n\nThe tool uses [swc](https://swc.rs/) as a Rust library to parse code and then\nrun analysis over the parsed code. It is then compiled to Web Assembly and\nexposed as an all-in-one API. Code is loaded via the JavaScript runtime and a\nresolver can be provided to allow for custom resolution logic.\n\n## Background\n\nThe statistics collected around code toxicity are based directly on Erik\nDörnenburg's article\n[How toxic is your code?](https://erik.doernenburg.com/2008/11/how-toxic-is-your-code/).\n\nThe default metrics are based on what is suggested in the article. When applying\nto TypeScript/JavaScript there are some adaptation that is required:\n\n| Metric                          | Table Label | Description                                                                                     | Default Threshold |\n| ------------------------------- | ----------- | ----------------------------------------------------------------------------------------------- | ----------------- |\n| File length                     | L           | The number of lines in a file.                                                                  | 500               |\n| Class data abstraction coupling | CDAC        | The number of instances of other classes that are \"new\"ed in a given class.                     | 10                |\n| Anon Inner Length               | AIL         | Class expressions of arrow functions length in number of lines.                                 | 35                |\n| Function Length                 | FL          | The number of statements in a function declaration, function expression, or method declaration. | 30                |\n| Parameter Number                | P           | The number of parameters for a function or method                                               | 6                 |\n| Cyclomatic Complexity           | CC          | The cyclomatic complexity for a function or method                                              | 10                |\n| Binary Expression Complexity    | BEC         | How complex a binary expression is (e.g. how many `\u0026\u0026` and `                                    |                   |\n| Missing Switch Default          | MSD         | Any `switch` statements that are missing the `default` case.                                    | 1                 |\n\n---\n\nCopyright 2019 - 2024 Kitson P. Kelly. MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh-o-t%2Fnocuous","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh-o-t%2Fnocuous","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh-o-t%2Fnocuous/lists"}