Skip to content

Commit

Permalink
docs: update for JSR
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk committed Oct 7, 2024
1 parent 6844e1e commit e9f0995
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nocuous"
version = "1.0.3"
version = "1.1.0"
edition = "2021"
description = "Wasm bindings to peform static analysis of JavaScript and TypeScript code"
authors = ["Kitson P. Kelly"]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2019 - 2022 Kitson P. Kelly
Copyright 2019 - 2024 Kitson P. Kelly

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# nocuous

![CI](https://github.com/h-o-t/nocuous/workflows/ci/badge.svg)
[![npm version](https://img.shields.io/npm/v/nocuous)](https://www.npmjs.com/package/nocuous)
[![jsr.io/@higher-order-testing/nocuous](https://jsr.io/badges/@higher-order-testing/nocuous)](https://jsr.io/@higher-order-testing/nocuous)
[![jsr.io/@higher-order-testing/nocuous score](https://jsr.io/badges/@higher-order-testing/nocuous/score)](https://jsr.io/@higher-order-testing/nocuous)

A static code analysis tool for JavaScript and TypeScript.

## Installing the CLI

If you want to install the CLI, you would need to have Deno
[installed first](https://deno.land/manual@v1.28.2/getting_started/installation)
[installed first](https://docs.deno.com/runtime/getting_started/installation/)
and then on the command line, you would want to run the following command:

```shell
$ deno install --name nocuous --allow-read --allow-net --allow-hrtime --import-map https://deno.land/x/nocuous/import_map.json -f https://deno.land/x/nocuous/cli.ts
$ deno install --name nocuous --allow-read --allow-net -f jsr:@higher-order-testing/nocuous/cli
```

You can also "pin" to a specific version by using `nocuous@{version}` instead,
for example `https://deno.land/nocuous@1.0.0/import_map.json` and
`https://deno.land/nocuous@1.0.0/cli.ts`.
for example `jsr:@higher-order-testing/nocuous@1.1.0/cli`.

The CLI comes with integrated help which can be accessed via the `--help` flag.

Expand All @@ -28,21 +28,15 @@ into your code. For example the following will analyze the Deno std assertion
library and its dependencies resolving with a map of statistics:

```ts
import { instantiate, stats } from "https://deno.land/x/nocuous/mod.ts";
import { instantiate, stats } from "jsr:@higher-order-testing/nocuous";

await instantiate();

const results = await stats(
new URL("https://deno.land/std/testing/asserts.ts"),
);
const results = await stats(new URL("https://jsr.io/@std/assert/1.0.6/mod.ts"));

console.log(results);
```

It is recommended though that you "pin" to a specific version of the library,
for example to import from version _1.0.0_ you would want to import from
`https://deno.land/x/nocuous@1.0.0/mod.ts`.

## Architecture

The tool uses [swc](https://swc.rs/) as a Rust library to parse code and then
Expand All @@ -69,3 +63,7 @@ to TypeScript/JavaScript there are some adaptation that is required:
| Cyclomatic Complexity | CC | The cyclomatic complexity for a function or method | 10 |
| Binary Expression Complexity | BEC | How complex a binary expression is (e.g. how many `&&` and ` | |
| Missing Switch Default | MSD | Any `switch` statements that are missing the `default` case. | 1 |

---

Copyright 2019 - 2024 Kitson P. Kelly. MIT License.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@higher-order-testing/nocuous",
"version": "1.1.0-alpha.1",
"version": "1.1.0",
"exports": {
".": "./mod.ts",
"./cli": "./cli.ts"
Expand Down
2 changes: 1 addition & 1 deletion lib/nocuous.generated.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// deno-fmt-ignore-file
/// <reference types="./nocuous.generated.d.ts" />

// source-hash: 43cfda03f376967255010c5fde052a546c1224bb
// source-hash: 3c5dc89a98a1e2719fce7ed1ed5eeae612ebcfea
let wasm;

const heap = new Array(128).fill(undefined);
Expand Down
Binary file modified lib/nocuous_bg.wasm
Binary file not shown.
6 changes: 2 additions & 4 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
*
* ### Example
*
* Fetches the `std/asserts` library for Deno and its dependencies and returns
* Fetches the `@std/assert` library for Deno and its dependencies and returns
* a map of the code toxicity statistics.
*
* ```ts
* import { instantiate, stats } from "jsr:@higher-order-testing/nocuous";
*
* await instantiate();
*
* const results = await stats(
* new URL("https://jsr.io/@std/assert/1.0.6/equal.ts"),
* );
* const results = await stats(new URL("https://jsr.io/@std/assert/1.0.6/mod.ts"));
*
* console.log(results);
* ```
Expand Down

0 comments on commit e9f0995

Please sign in to comment.