fix not working lint job

The current implementation just passes an empty list to the python script checking for spaces, partially because we have a duplicated -or statement at the end of the find.

So removing the duplicate and investigate further.

Adding the parameter -print0 does in this case only apply to the last -or statement (md) and only prints those.

$ find -name '*.yaml' -or -iname '*.rst' -or -iname '*.cue' -or -iname '*.sh' -or -iname '*.md' -print0 | xargs -0 
./README.md ./.gitlab/issue_templates/Bug Report.md ./.gitlab/issue_templates/Feature Proposal.md ./yaook/op/gnocchi/static/README.md ./yaook/op/barbican/static/README.md ./yaook/helm_builder/Charts/README.md

So it's read as a and concatenation to the last statement (verfied by the following statement)

$ find -name '*.yaml' -or -iname '*.rst' -or -iname '*.cue' -or -iname '*.sh' -or -iname '*.md' -and -print0 | xargs -0
./README.md ./.gitlab/issue_templates/Bug Report.md ./.gitlab/issue_templates/Feature Proposal.md ./yaook/op/gnocchi/static/README.md ./yaook/op/barbican/static/README.md ./yaook/helm_builder/Charts/README.md

But we expect to find more files

$ find -name '*.yaml' -or -iname '*.rst' -or -iname '*.cue' -or -iname '*.sh' -or -iname '*.md' | wc -l
831

making the -print0 expression added with -or gives us all files in the directory (including .) which is also not the desired state.

Trying to switch to regex gives me the correct amount of files

$ find -regex '.*\.\(yaml\|md\|sh\|cue\|rst\)$' | wc -l
831

Can we now use -print0 as it's now an and connection between only those two?

$ find -regex '.*\.\(yaml\|md\|sh\|cue\|rst\)$' -print0
./lint/check_cross_operator_imports.sh./lint/yaml_jinja_doubleescape.sh./deploy/selfsigned-issuer.yaml./README.md
[...]

Looks good from the first view.

Edited by Anika Borchmann

Merge request reports

Loading