More than one analyzer in the .deepsource.toml

I have a repository with javascript and go code, currently configured with the go analyzer. I’d like to also add the new javascript analyzer, and potentially the dockerfile one as well.

Is it possible to have more than one analyzer in the same .deepsource.toml configuration file? Couldn’t find an example of the syntax for this in the documentation.

1 Like

Sure. You can add multiple analyzers in a single .deepsource.toml file.

Here’s an example config that runs Go, JavaScript and Docker:

version = 1

test_patterns = [
  "tests/*_test.go",
  "**/*_test.go",
"src/*.min.js"
]

[[analyzers]]
name = "go"
enabled = true

  [analyzers.meta]
  import_paths = ["github.com/deepsourcelabs/web-app/backend"]
  import_root = "github.com/deepsourcelabs/web-app"

[[analyzers]]
name = "javascript"
enabled = true

  [analyzers.meta]
  ecma_version = "2016"
  module_system = "commonjs"
  environment = [
    "nodejs",
    "browser",
    "jest",
  ]

  plugins = ["react"]
  style_guide = "airbnb"
  dialect = "typescript"

[[analyzers]]
name = "docker"
enabled = true

  [analyzers.meta]
  dockerfile_paths = [
    "dockerfile_dev",
    "dockerfile_prod"
  ]
1 Like

I added this:

version = 1
exclude_patterns = [
  "chart",
  "scripts",
]

[[analyzers]]
name = "go"
enabled = true

  [analyzers.meta]
  import_root = "github.com/okteto/app"
  import_paths = ["github.com/okteto/app/backend"]

[[analyzers]]
name = "javascript"
enabled = true

  [analyzers.meta]
  ecma_version = "2016"
  module_system = "commonjs"
  environment = [
    "nodejs",
    "browser",
    "jest",
  ]

  plugins = ["react","import"]
  style_guide = "airbnb"
  dialect = "typescript"

But when I created the PR, only the go analyzer ran, based on the check list

What am I missing?

1 Like

There’s an error in your toml, value “import” is invalid for plugins. See docs

We’ve also created an internal issue, to report such errors in GitHub’s check itself.

2 Likes