Skip to content

coursier: additional_dependencies with non-default channel #2986

@junghoon-vans

Description

@junghoon-vans

search you tried in the issue tracker

#2702

describe your actual problem

Description

Currently, coursier's additional_dependencies only supports the default channel.
This means it can't pull dependencies from repositories like central.

AS-IS
repos:
- repo: https://github.com/junghoon-vans/pre-coursier
  rev: v0.2.0
  hooks:
  - id: scalafmt
    args: ["--config-str", "version = 2.4.2, runner.dialect = scala3"]
    additional_dependencies: ["scalafmt:2.4.2"] # This is available

  - id: checkstyle
    args: [".", "-c", "./checkstyle.xml"]
    additional_dependencies: ["checkstyle:10.8.0"] # This is not avaliable

Solution

How about changing central to the default repository for more dependencies?
In fact, coursier's default repository also fetches files from central.

TO-BE
repos:
- repo: https://github.com/junghoon-vans/pre-coursier
  rev: v0.2.0
  hooks:
  - id: scalafmt
    args: ["--config-str", "version = 2.4.2, runner.dialect = scala3"]
    additional_dependencies: ["org.scalameta::scalafmt-cli:2.4.2"]

  - id: checkstyle
    args: [".", "-c", "./checkstyle.xml"]
    additional_dependencies: ["com.puppycrawl.tools:checkstyle:10.8.0"]

But the library must be explicitly marked in additional_dependencies.

pre-commit --version

pre-commit:3.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions