super-linter / super-linter

Combination of multiple linters to run as a GitHub Action or standalone
https://github.com/super-linter/super-linter
MIT License
9.5k stars 971 forks source link

`commitlint` behavior issues #6316

Open claudioandre-br opened 1 week ago

claudioandre-br commented 1 week ago

Is there an existing issue for this?

Are you using the latest Super-linter version available?

Are you resonably sure that it's a Super-linter issue, and not an issue related to a tool that Super-linter runs?

Current Behavior

The Docker "slim" image of super-linter includes commitlint [1], as expected. So, this works:

docker run --rm -e RUN_LOCAL=true -e DEFAULT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
  -e ENFORCE_COMMITLINT_CONFIGURATION_CHECK=true \
  -e VALIDATE_GIT_COMMITLINT=true \
  -v $(pwd):/tmp/lint ghcr.io/super-linter/super-linter:slim-latest

But the standard image does not. So the below fails silently:

docker run --rm -e RUN_LOCAL=true -e DEFAULT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
  -e ENFORCE_COMMITLINT_CONFIGURATION_CHECK=true \
  -e VALIDATE_GIT_COMMITLINT=true \
  -v $(pwd):/tmp/lint ghcr.io/super-linter/super-linter:v7.1.0

GIT_COMMITLINT is not executed for the command above. No errors, no hints, nothing.

This also works (this looks "slim", e.g., no goreleaser banner):

docker run --rm -e RUN_LOCAL=true -e DEFAULT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
  -e ENFORCE_COMMITLINT_CONFIGURATION_CHECK=true \
  -e VALIDATE_GIT_COMMITLINT=true \
  -v $(pwd):/tmp/lint ghcr.io/super-linter/super-linter:latest

[1] [GIT_COMMITLINT] commitlint: @commitlint/cli@19.5.0

Expected Behavior

standard: super-linter/super-linter@[VERSION]: includes all supported linters.

All means ALL.

Super-Linter version

v7.1.0

Super-linter configuration

- name: Linter
        uses: super-linter/super-linter@b92721f792f381cedc002ecdbb9847a15ece5bb8 # v7.1.0
        env:
          ENABLE_COMMITLINT_STRICT_MODE: true
          ENFORCE_COMMITLINT_CONFIGURATION_CHECK: true
          VALIDATE_ALL_CODEBASE: false
          VALIDATE_CHECKOV: false
          VALIDATE_GIT_COMMITLINT: true
          DEFAULT_BRANCH: "main"
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Relevant log output

There is no error. Nothing to add here.

Steps To Reproduce

Run this command and try to find any reference of commitlint.

docker run --rm -e RUN_LOCAL=true -e DEFAULT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
  -e ENFORCE_COMMITLINT_CONFIGURATION_CHECK=true \
  -e VALIDATE_GIT_COMMITLINT=true \
  -v $(pwd):/tmp/lint ghcr.io/super-linter/super-linter:v7.1.0

Anything else?

BTW:

ferrarimarco commented 1 week ago

Hi!

This is expected because we 7.1.0 doesn't include commitlint, and we didn't release 7.2.0 yet.

But you have a point about documentation. It might be helpful to mention that.

claudioandre-br commented 1 week ago

Probably a better solution: you guys should run commitlint with the -g "$LINTER_RULES_PATH" option.

-g, --config         path to the config file; result code 9 if config is missing