Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template lint without parameters return false positive #3058

Open
peczenyj opened this issue Dec 3, 2024 · 0 comments
Open

template lint without parameters return false positive #3058

peczenyj opened this issue Dec 3, 2024 · 0 comments

Comments

@peczenyj
Copy link
Contributor

peczenyj commented Dec 3, 2024

This is the help message from redpanda connect

$ docker  run --rm redpandadata/connect:4.42 template lint --help
NAME:
   redpanda-connect template lint - Parse Redpanda Connect templates and report any linting errors

USAGE:
   redpanda-connect template lint [command options]

DESCRIPTION:
   Exits with a status code 1 if any linting errors are detected:

     redpanda-connect template lint
     redpanda-connect template lint ./templates/*.yaml
     redpanda-connect template lint ./foo.yaml ./bar.yaml
     redpanda-connect template lint ./templates/...

   If a path ends with '...' then Redpanda Connect will walk the target and lint any
   files with the .yaml or .yml extension.

OPTIONS:
   --env-file value, -e value [ --env-file value, -e value ]    import environment variables from a dotenv file
   --templates value, -t value [ --templates value, -t value ]  EXPERIMENTAL: import Redpanda Connect templates, supports glob patterns (requires quotes)
   --help, -h                                                   show help

based on this, this option is valid redpanda-connect template lint that does nothing (?)

and since there is an option -t I made a mistake and I did not add the templates files as an argument of template lint and it give me a false positive

for instance, if the template is ok, both commands exit with success

$ docker run --rm -v ./templates:/t redpandadata/connect:4.42 template lint -t "/t/*.yaml"
$ docker run --rm -v ./templates:/t redpandadata/connect:4.42 template lint "/t/*.yaml"

however, if I change one unit test to force a failure, the first command will not execute the unit tests.

what I expect: same behavior as test

$ docker run --rm -v ./config:/c redpandadata/connect:4.42 test
No tests were found

$ echo $?
1

BTW the command lint also return a false positive if no files are specified (and the help description does not show this possibility

$ docker run --rm -v ./config:/c redpandadata/connect:4.42 lint

$ echo $?
0

$ docker run --rm -v ./config:/c redpandadata/connect:4.42 lint help
NAME:
   redpanda-connect lint - Parse Redpanda Connect configs and report any linting errors

USAGE:
   redpanda-connect lint [command options]

DESCRIPTION:
   Exits with a status code 1 if any linting errors are detected:

     redpanda-connect lint ./configs/*.yaml
     redpanda-connect lint ./foo.yaml ./bar.yaml
     redpanda-connect lint ./configs/...

   If a path ends with '...' then Redpanda Connect will walk the target and lint any
   files with the .yaml or .yml extension.

what I expect:

  • if I call test, lint or template lint, I expect a failure message and exit code != 0 if no files are specified (it could be a mistake)
  • will be wonderful some kind of "verbose" option where we show the files linted /tested and what are the tests executed

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant