To ensure Super-Linter identifies the correct files for your new tool, you must implement logic in lib/functions/buildFileList.sh. Depending on how the tool identifies files, choose one of the following three approaches:
1. File extension or name check
Use this if the tool targets specific extensions. Add an elif clause to the BuildFileArrays function in lib/functions/buildFileList.sh. You can use these variables:
FILE_TYPE: the file extension.BASE_FILE: the name of the file.FILE_DIR_NAME: the directory path.
2. File contents check
Use this if you need to inspect file contents to determine if the tool should run.
- Implement a detection function in
lib/functions/detectFiles.sh. - Add an
elif clause in the BuildFileArrays function in lib/functions/buildFileList.sh that calls your detection function.
3. Entire workspace check
Use this if the tool lints the entire workspace (e.g., via a configuration file).
- Add logic to the
BuildFileList function in lib/functions/buildFileList.sh to handle the workspace test case. - In
BuildFileArrays, add the file to the language-specific array when "${FILE}" == "${GITHUB_WORKSPACE}". - Update the README to include the tool in the list of tools that check the entire workspace.
Tip: To optimize performance, combine extension checks with content checks (e.g., only run content detection on .yaml files).
# Example: Extension check
elif [ "${FILE_TYPE}" == "ext" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-<LANGUAGE_NAME>"
fi
# Example: Content check
elif DetectCloudFormationFile "${FILE}"; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-CLOUDFORMATION"
fi