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

YETUS-1202. plug-ins cannot use filefilter to build lists of files #291

Merged
merged 1 commit into from Oct 12, 2022

Conversation

aw-was-here
Copy link
Contributor

No description provided.

for i in "${HADOLINT_CHECKFILES[@]}"; do
if [[ -f "${i}" ]]; then
for i in "${CHANGED_FILES[@]}"; do
if [[ "${i}" =~ Dockerfile ]] && [[ -f "${i}" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why scope it to file names like Dockerfile? The previous values contained in HADOLINT_CHECKFILES used to be pre-filtered according to this expression?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. HADOLINT_CHECKFILES was basically everything that had Dockerfile in the name. There is a slight performance penalty not prefiltering... but only if there are no other files being excluded. As soon as exclusion is introduced, a second loop is required and that quickly makes the perf diff a negative since the exclusion list may actually be bigger than what is in the patch!

@@ -62,7 +62,9 @@ This function call registers the `pluginname` so that test-patch knows that it e
function pluginname_filefilter
```

defines the filefilter for the `pluginname` plug-in.
defines the filefilter for the `pluginname` plug-in. This function determines if the plug-in should
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: capitalize "defines" at the beginning of the sentence.

done < <("${YAMLLINT}" "${i}")
for i in "${CHANGED_FILES[@]}"; do

if [[ ${i} =~ \.yaml$ ]] ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as for the Dockerfile filter previously.

@aw-was-here
Copy link
Contributor Author

In addition to what I wrote in the JIRA, my hunch is that longer term, individual plug-ins doing their own filename caching is likely a mistake. For example, I'm not sure what happens if a project's personality file adds files into CHANGED_FILES. There is also the general memory usage, code complexity, etc.

I realize this PR doesn't really fix shellcheck and shelldocs to match the rest. But fixing those is a much bigger problem that I don't want to take on right now.

@aw-was-here aw-was-here merged commit a6731e1 into apache:main Oct 12, 2022
@aw-was-here aw-was-here deleted the fix_filters branch October 12, 2022 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants