Configuration

The .attractor.yml File

You can configure how and when Attractor analyzes your pull requests by placing a YAML file called .attractor.yml in the root of your app’s directory. Here is an example:

branches:
  only:
    - main
skip:
  includes:
    - dep
report:
  app_root: app
  minimum_churn: 1
  ignore:
    - bin
    - config
    - db
    - spec
    - storybook
    - test
  start_ago: 1y

Restrict Branches

You might want to restrict Attractor to create reports only for specific target branches of your PR to save on your report quota.

For example, following setting will ensure that only for pull requests opened against the main and develop branches reports are generated:

branches:
  only:
    - main
    - develop

By default, Attractor listens for pull requests on all branches.

Skip PRs or Individual Commits

Attractor’s plans include only a limited amount of reports per month. In addition to restricting your target branches, you might therefore want to turn off reports based on a string that’s included in the pull request’s title, or a commit’s message, e.g. skip-ci, deps etc.

This snippet will ensure there are no reports generated when the string deps is included in a PR’s title or commit’s message, as might be the case for PRs auto-generated by dependabot, depfu etc:

skip:
  includes:
    - dep

Configure Reports

Attractor provides several options to configure which files should be included in your report, and how long a history it should take into account. This can be done by specifying the following options under the report key:

  • app_root: Where your main app code lies. The default is ., but depending on your app it could also be src, for example, etc.
  • ignore: An array of which folders to ignore when analyzing your app. The default is ["bin", "config", "db", "spec", "test", "vendor"]
  • minimum_churn: Only files that have been touched at least this amount of times are scanned (default 1)
  • start_ago: What timespan to include in the analysis (default 5y)

For a detailed breakdown, look at https://github.com/julianrubisch/attractor/?tab=readme-ov-file#cli-commands-and-options