# @atlaskit/code-insights

> Code insights reporting tool for FE (mono)repo's.

Latest version **1.4.3** (published 2024-03-20) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @atlaskit/code-insights
pnpm add @atlaskit/code-insights
yarn add @atlaskit/code-insights
bun add @atlaskit/code-insights
```

Provides the command `code-insights`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.3 |
| Published | 2024-03-20 |
| First published | 2019-03-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 95.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Atlassian Pty Ltd |
| Maintainers | atlaskit |

## Links

- npm: https://www.npmjs.com/package/@atlaskit/code-insights
- Repository: https://bitbucket.org/atlassian/atlassian-frontend-mirror
- Homepage: https://bitbucket.org/atlassian/atlassian-frontend-mirror#readme
- Issues: https://bitbucket.org/atlassian/atlassian-frontend-mirror/issues
- npm.io page: https://npm.io/package/@atlaskit/code-insights

## Dependencies (8)

- [meow](https://npm.io/package/meow.md) ^8.1.1
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [crypto](https://npm.io/package/crypto.md) ^1.0.1
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.13.1
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.7
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.0.0
- [projector-spawn](https://npm.io/package/projector-spawn.md) ^1.0.1
- [@yarnpkg/lockfile](https://npm.io/package/@yarnpkg/lockfile.md) ^1.1.0

## Recent versions

- 1.4.3 (latest) — 2024-03-20
- 1.2.2 (next) — 2023-05-17
- 1.4.2 — 2024-02-01
- 1.4.1 — 2024-01-30
- 1.4.0 — 2023-10-25
- 1.3.1 — 2023-08-21
- 1.3.0 — 2023-05-19
- 1.2.1 — 2023-05-15
- 1.2.0 — 2023-05-08
- 1.1.24 — 2022-10-04
- 1.1.23 — 2022-08-25
- 1.1.22 — 2022-04-29
- 1.1.21 — 2022-04-26
- 1.1.20 — 2022-02-23
- 1.1.19 — 2021-11-19
- … 21 more at https://npm.io/package/@atlaskit/code-insights/versions

## README

# `@atlaskit/code-insights`

This is a tool that can be run on your checkout OR on CI to report on code problems.

## CLI Flags

`--commit` The commit to publish insights on [default=current head]

`--reporters` The reporters to run [default=console]

`--gitUrl` The git url of the repo [default=current origin url]

`--targetBranch` The branch with which to compare the current branch, when git reporting is enabled can detect PR target branch. [default=master]

`--basePath` The base path to find the package.json and yarn.lock file. eg <basePath>/yarn.lock => confluence/yarn.lock [default=empty string]

## Reports

The tool is set up in a way that reports should be easy to add later. If you have a good idea for a report,
go for it and submit a PR!

### yarn lock duplicates

This report compares the lock file of the current branch to the one on `origin/master`.
It then reports the new duplicate dependencies found compared to master.

#### Requirements

This report requires `origin/master` to be available. If you're getting the following error:

```
Command failed: git show origin/master:package.json
fatal: Invalid object name 'origin/master'.
```

Your CI job is probably running on a shallow clone. This error can be fixed on bamboo with the following commands:

```sh
git remote set-url origin "${bamboo_planRepository_repositoryUrl}"
git fetch origin
```

## Reporters

The tool is set up in a way that reporters should be easy to add later. If you have a good idea for a report,
go for it and submit a PR!

### Bitbucket server code-insights (bbs)

This report uses the [Bitbucket server code insights](https://community.developer.atlassian.com/t/introducing-code-insights-for-bitbucket-server-continuously-improve-code-quality-with-quick-actionable-feedback-from-apps/23148) feature to show the code-insights report.

If this reporter is enabled and now `targetBranch` flag is provided, the reporter will try to detect the target branch of the PR the top commit is on. When targetting a different branch than `master` the report is generated using that branch instead.

#### Requirements

Authentication for BB server is required. The following options are provided:

#### API Key

The recommended way of authentication

`BITBUCKET_SERVER_TOKEN` : the BB server API token

#### Basic auth

`BITBUCKET_SERVER_USERNAME` : Bitbucket Server Username

`BITBUCKET_SERVER_PASSWORD` : Bitbucket Server Password

### Console (console)

This reporters just reports the result to the console. Handy when running locally.

---
_Source: https://npm.io/package/@atlaskit/code-insights · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
