natiginfo / action-detekt-all

Run detekt for all files
Apache License 2.0
30 stars 4 forks source link

detekt 1.20.0 - Property 'formatting' is misspelled or does not exist. #44

Open psud opened 2 years ago

psud commented 2 years ago

Hello all,

We use the detekt GitHub action as follows (shortend to relevant parts only):

jobs:
  detekt:
    name: run detekt analysis
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v2
      - name: Detekt
        uses: natiginfo/action-detekt-all@1.20.0
        with:
          args: '-c ${{ env.detekt_config }} -b ${{ env.detekt_baseline }} -r html:${{ env.detekt_report }} --build-upon-default-config'

When GitHub executes the action it fails with the following error

Property 'formatting' is misspelled or does not exist.
Run failed with 1 invalid config property.
    - Property 'formatting' is misspelled or does not exist.

Passing the parameter -formatting or --formatting does not change the outcome.

formatting was added in 1.20.0 (https://detekt.dev/changelog.html#1200---2022-04-14) but is not documented in cli parameters (https://detekt.dev/cli.html#use-the-cli) so I am not sure which component actually has the issue. This GitHub action project or detekt itself.

Thanks in advance for your input!

petrazavadska commented 2 years ago

In the cli documentation https://detekt.dev/docs/gettingstarted/cli/ there is a following mention of formatting below --auto-correct option: The additional 'formatting' rule set, added with '--plugins', does support it and needs this flag. In --plugins you have following description: Extra paths to plugin jars separated by ',' or ';'.

So I did what it asked and downloaded the needed jar file from here: https://github.com/detekt/detekt/releases/download/v1.20.0/detekt-formatting-1.20.0.jar and copied it to my project.

My step is defined like this:

- name: Detekt checks
  uses: natiginfo/action-detekt-all@1.20.0
  with:
    args: --build-upon-default-config --config ./config/detekt.yml --plugins ./config/detekt-formatting-1.20.0.jar

Not sure if this is really needed or there is another way to handle this issue but for the time being this works :D

stuebingerb commented 2 years ago

Still broken in 1.21.0