Docs
Configuration

Configuration

FTA expects to be provided a directory ("project root") and will automatically look for TypeScript and JavaScript code within that directory.

To configure how FTA interprets a project, you can either pass CLI arguments or create a fta.json file. FTA will automatically look for fta.json in the project root, but you can specify this with --config-path.

Supplying Options

Some options can also be controlled via CLI arguments, but not all:

CLI arguments

ArgumentDescription
--config-pathPath to fta.json
--formatFormat of the output (table, csv or json)
--jsonShorthand for --format json
--output-limitSee full documentation for output_limit below
--score-capSee full documentation for score_cap below
--include-commentsSee full documentation for include_comments below
--exclude-underSee full documentation for exclude_under below

Configuration Options, set via fta.json

OptionEquivalent CLI argument
output_limit--output-limit
score_cap--score-cap
include_comments--include-comments
exclude_under--exclude-under
extensionsN/A
exclude_filenamesN/A
exclude_directoriesN/A

CLI arguments will be given priority over options found in fta.json.

View the full description for each configuration option below.

Configuration Options

output_limit

How many files to include in the output. Only applies to the table format.

  • CLI argument: --output-limit
  • Default: 5000

score_cap

Maximum FTA score which will cause FTA to throw. Useful if you want to prevent any files being added to the project that exceed a certain maintainability level. For an existing project, you might opt to set this as your curent-highest-fta-score.

  • CLI argument: --score-cap
  • Default: 1000

include_comments

Whether to include code comments as part of the analysis. Most of the time, comments should not be considered a contributor towards complexity, hence the default of false.

  • CLI argument: --include-comments
  • Default: false

exclude_under

Minimum number of lines of code for files to be included in the output. The default is 6 to exclude very small files as a sensible default.

  • CLI argument: --exclude-under
  • Default: 6

exclude_directories

An array of directory paths representing directories to exclude from the analysis. Files within any of these directories will be ignored. Paths can be specified as relative to the project root. The defaults are always used; any supplied values are added to the exclusions list.

  • Default: ["/dist", "/bin", "/build"]

exclude_filenames

An array of glob patterns representing filenames to exclude from the analysis. Files matching any of these patterns will be ignored. Globs can include wildcards and brace expansions. The defaults are always used; any supplied values are added to the exclusions list. Exclusions will override extensions.

  • Default: [".d.ts", ".min.js", ".bundle.js"]

extensions

File extensions to identify files that should be analyzed. JavaScript files are also accepted. The defaults are always used; any supplied values are added to the inclusions list.

  • Default: [".js", ".jsx", ".ts", ".tsx"]

Example

Example configuration fta.json:

{
  "output_limit": 250,
  "score_cap": 90,
  "exclude_directories": ["__fixtures__"],
  "exclude_filenames": ["*.test.{ts,tsx}"],
  "extensions": [".cjs"],
  "include_comments": false,
  "exclude_under": 10
}

Here, we've limited the output to 250 files, capped the FTA score to 90, excluded anything in the /path/to/project/__fixtures__ dir, excluded test files and included files with the .cjs extension.

Note: spec/test files (that contain TypeScript or JavaScript code) are included by default, since they constitute material code that must be maintained. This is optional - users are free to exclude test code from outputs, like in this example.