Fix all remaining shellcheck issues and exclude SC1091

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-07 22:26:29 +00:00
parent b1749448dc
commit ef617c8810
4 changed files with 48 additions and 28 deletions

View File

@ -2,6 +2,8 @@
# filepath: pacman-wrapper.sh
# A helpful wrapper for Arch Linux's pacman package manager
# shellcheck disable=SC2317 # Many functions are called indirectly
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
@ -18,6 +20,7 @@ declare -a WHITELISTED_NAMES_LIST=()
declare -a GREYLISTED_KEYWORDS_LIST=()
POLICY_LISTS_LOADED=0
# shellcheck disable=SC2317 # Function is called indirectly
load_policy_lists() {
if [[ $POLICY_LISTS_LOADED -eq 1 ]]; then
return
@ -187,6 +190,7 @@ function display_operation() {
}
# Helper: return 0 if the given package name is blocked by policy
# shellcheck disable=SC2317 # Function is called indirectly
function is_blocked_package_name() {
load_policy_lists
local normalized="${1,,}"

View File

@ -135,6 +135,7 @@ handle_arg_help_or_unknown() {
return 1 # Not a flag, let caller handle it
;;
esac
# shellcheck disable=SC2317
return 0
}

View File

@ -256,7 +256,8 @@ run_linters() {
log_info "Running shellcheck..."
local sc_out="$TMPDIR/shellcheck.txt"
if is_cmd shellcheck; then
if ! shellcheck -x -S style "${FILES[@]}" > "$sc_out" 2>&1; then
# Exclude SC1091 (not following sourced files) as it's expected in many scripts
if ! shellcheck -x -S style -e SC1091 "${FILES[@]}" > "$sc_out" 2>&1; then
issues=$((issues + 1))
fi
else

View File

@ -522,10 +522,12 @@ if [ -d "$PER_LANG_DIR" ]; then
*) display_lang="$lang" ;;
esac
echo "### $display_lang Keywords" >> "$DOCS_FILE"
echo "" >> "$DOCS_FILE"
echo "| Keyword | Count | Documentation |" >> "$DOCS_FILE"
echo "|---------|-------|---------------|" >> "$DOCS_FILE"
{
echo "### $display_lang Keywords"
echo ""
echo "| Keyword | Count | Documentation |"
echo "|---------|-------|---------------|"
} >> "$DOCS_FILE"
head -"$TOP_N" "$keyword_file" | while read -r count term; do
[ -z "$term" ] && continue
@ -560,10 +562,12 @@ if [ -d "$PER_LANG_DIR" ]; then
*) display_lang="$lang" ;;
esac
echo "### $display_lang Functions" >> "$DOCS_FILE"
echo "" >> "$DOCS_FILE"
echo "| Function | Count | Documentation |" >> "$DOCS_FILE"
echo "|----------|-------|---------------|" >> "$DOCS_FILE"
{
echo "### $display_lang Functions"
echo ""
echo "| Function | Count | Documentation |"
echo "|----------|-------|---------------|"
} >> "$DOCS_FILE"
head -"$TOP_N" "$func_file" | while read -r count term; do
[ -z "$term" ] && continue
@ -598,10 +602,12 @@ if [ -d "$PER_LANG_DIR" ]; then
*) display_lang="$lang" ;;
esac
echo "### $display_lang" >> "$DOCS_FILE"
echo "" >> "$DOCS_FILE"
echo "| Import | Count | Documentation |" >> "$DOCS_FILE"
echo "|--------|-------|---------------|" >> "$DOCS_FILE"
{
echo "### $display_lang"
echo ""
echo "| Import | Count | Documentation |"
echo "|--------|-------|---------------|"
} >> "$DOCS_FILE"
head -20 "$import_file" | while read -r count import; do
[ -z "$import" ] && continue
@ -623,10 +629,12 @@ else
echo -e "${YELLOW}No per-language files found, using combined analysis${NC}"
if [ -f "$RESULTS_DIR/grep_keywords.txt" ]; then
echo "## Language Keywords" >> "$DOCS_FILE"
echo "" >> "$DOCS_FILE"
echo "| Keyword | Count | Documentation |" >> "$DOCS_FILE"
echo "|---------|-------|---------------|" >> "$DOCS_FILE"
{
echo "## Language Keywords"
echo ""
echo "| Keyword | Count | Documentation |"
echo "|---------|-------|---------------|"
} >> "$DOCS_FILE"
head -"$TOP_N" "$RESULTS_DIR/grep_keywords.txt" | while read -r count term; do
[ -z "$term" ] && continue
@ -637,10 +645,12 @@ else
fi
if [ -f "$RESULTS_DIR/grep_function_calls.txt" ]; then
echo "## Function/Method Calls" >> "$DOCS_FILE"
echo "" >> "$DOCS_FILE"
echo "| Function | Count | Documentation |" >> "$DOCS_FILE"
echo "|----------|-------|---------------|" >> "$DOCS_FILE"
{
echo "## Function/Method Calls"
echo ""
echo "| Function | Count | Documentation |"
echo "|----------|-------|---------------|"
} >> "$DOCS_FILE"
head -"$TOP_N" "$RESULTS_DIR/grep_function_calls.txt" | while read -r count term; do
[ -z "$term" ] && continue
@ -652,10 +662,12 @@ else
fi
if [ -f "$RESULTS_DIR/grep_imports.txt" ]; then
echo "## Imports/Includes" >> "$DOCS_FILE"
echo "" >> "$DOCS_FILE"
echo "| Import | Count | Documentation |" >> "$DOCS_FILE"
echo "|--------|-------|---------------|" >> "$DOCS_FILE"
{
echo "## Imports/Includes"
echo ""
echo "| Import | Count | Documentation |"
echo "|--------|-------|---------------|"
} >> "$DOCS_FILE"
head -20 "$RESULTS_DIR/grep_imports.txt" | while read -r count import; do
[ -z "$import" ] && continue
@ -668,9 +680,11 @@ else
fi
fi
echo "" >> "$DOCS_FILE"
echo "---" >> "$DOCS_FILE"
echo "*Generated by analyze_repo.sh + generate_study_materials.sh*" >> "$DOCS_FILE"
{
echo ""
echo "---"
echo "*Generated by analyze_repo.sh + generate_study_materials.sh*"
} >> "$DOCS_FILE"
echo -e "${GREEN}Created: $DOCS_FILE${NC}"
#==============================================================================