.napirc

napi's powerful configuration file

The .napirc file lives at the root of your codebase and defines both the settings needed to minimally run the tool, and the parameters within which napi will assess your codebase for technical debt.

Example File

For a given python project, the file will look like the following. This config is for Apache Airflow.

When running in another directory, the .napirc needs to be at the root of whatever path you pass to the CLI via the —workdir command. e.g. napi audit view —workdir=/path/to/airflow

{
  "language": "python",
  "project": {
    "include": [
      "airflow-core/src/**/*"
    ],
    "exclude": [
      ".git/**",
      "**/dist/**",
      "**/build/**",
      "**/__pycache__/**",
      "**/*.pyc",
      "**/.pytest_cache/**",
      "**/venv/**",
      "**/.env/**",
      "**/*.egg-info/**",
      "**/.tox/**",
      "**/.coverage",
      "**/htmlcov/**",
      "**/.mypy_cache/**"
    ]
  },
  "outDir": "napi_out",
  "metrics": {
    "file": {
      "maxChar": 5000,
      "maxLine": 2000,
      "maxDep": 10
    },
    "symbol": {
      "maxChar": 50000,
      "maxLine": 200,
      "maxDep": 5
    }
  },
  "python": {
    "version": "3.11"
  }
}

Configuration Parameters

Field

Required?

Description

language

True

The programming language to process.

outDir

True

The output folder of extracted code.

python.version

Only for python projects

The version of the language to consider. Only major version is required. (e.g. 2.17, 3.11, etc.)

project.include

True

Files to include in the audit/visualization process.

project.exclude

True

Files to exclude from the audit/visualization process.

metrics

False

A collection of optional settings to give more information to the audit view.

metrics.file.maxChar

False

Informs the audit view which files to highlight as erroring when the number of characters in a file exceeds this limit.

metrics.file.maxLine

False

Informs the audit view which files to highlight as erroring when the number of lines of code in a file exceeds this limit.

metrics.file.maxDep

False

Informs the audit view which files to highlight as erroring when the number of dependencies in a file exceeds this limit.

metrics.symbol.maxChar

False

Informs the audit view which files to highlight as erroring when the number of characters in a symbol exceeds this limit.

metrics.symbol.maxLine

False

Informs the audit view which files to highlight as erroring when the number of lines of code in a symbol exceeds this limit.

metrics.symbol.maxDep

False

Informs the audit view which files to highlight as erroring when the number of dependencies in a symbol exceeds this limit.

Updated on