Skip to content

Commit

Permalink
Merge pull request #1698 from davidpfarrell/themes/clean-powerline
Browse files Browse the repository at this point in the history
Clean Powerline; Add Dir Support to Clean_Files
  • Loading branch information
Noah Gorny committed Nov 5, 2020
2 parents 52c0f65 + 48333b9 commit bcc3f40
Show file tree
Hide file tree
Showing 4 changed files with 270 additions and 228 deletions.
29 changes: 28 additions & 1 deletion clean_files.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
#######################################################################
# Allow-list of files to be lint-checked by CI
#
# Directory Suport
# Directory references are allowed within the file, ie:
#
# themes/powerline
#
# All files under the referenced directory will be checked
#
# Checking Files Locally
# You can manually invoke the check via:
#
# lint_clean_files.sh
#

# root directories
#
docs

# root files
#
.gitattributes
lint_clean_files.sh
themes/90210/90210.theme.bash

# themes
#
themes/90210
themes/powerline
20 changes: 18 additions & 2 deletions lint_clean_files.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
#!/usr/bin/env bash

# Pull list of checkable files from clean_files.txt
# - Folder references are allowed
# - Empty lines are ignored
# - Comment lines (#) are ignored
#
mapfile -t FILES < clean_files.txt
# shellcheck disable=SC2002 # Prefer 'cat' for cleaner script
mapfile -t FILES < <(
cat clean_files.txt \
| grep -v -E '^\s*$' \
| grep -v -E '^\s*#' \
| xargs -n1 -I{} find "{}" -type f
)

pre-commit run --files "${FILES[@]}"
# We clear the BASH_IT variable to help the shellcheck checker
# identify source includes within our scripts that require a
# 'source' directive. For more information, see:
#
# "Shellcheck SC1090 - Can't follow non-constant source"
# https://www.shellcheck.net/wiki/SC1090
#
BASH_IT='' pre-commit run --files "${FILES[@]}"

0 comments on commit bcc3f40

Please sign in to comment.