From 260738a1fef25cfd4de941e1a943d8c37649a61f Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Fri, 24 Feb 2023 14:36:47 -0800 Subject: [PATCH] Linting cleanup --- .pre-commit-config.yaml | 3 ++ recipes/default/abuse-the-force | 10 +++---- recipes/default/build-neovim | 1 + recipes/default/force-cli | 10 +++---- recipes/default/golang | 0 recipes/default/test-recipe | 0 recipes/no-sudo/build-fish | 20 +++++++------ recipes/no-sudo/build-vim | 51 +++++++++++++++++---------------- recipes/no-sudo/test-recipe | 0 9 files changed, 53 insertions(+), 42 deletions(-) mode change 100644 => 100755 recipes/default/abuse-the-force mode change 100644 => 100755 recipes/default/force-cli mode change 100644 => 100755 recipes/default/golang mode change 100644 => 100755 recipes/default/test-recipe mode change 100644 => 100755 recipes/no-sudo/build-fish mode change 100644 => 100755 recipes/no-sudo/build-vim mode change 100644 => 100755 recipes/no-sudo/test-recipe diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 51e8ee8..8f1e834 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,3 +19,6 @@ repos: rev: 2.1.5 hooks: - id: shellcheck + # files: (.*\.sh$|^recipes/.*) + types: [shell, executable] + # files: ^recipes diff --git a/recipes/default/abuse-the-force b/recipes/default/abuse-the-force old mode 100644 new mode 100755 index 34b532c..95d6a96 --- a/recipes/default/abuse-the-force +++ b/recipes/default/abuse-the-force @@ -1,12 +1,12 @@ #! /bin/bash -if [ ! -d $WORKSPACE/abuse-the-force ]; then - git clone https://github.com/ViViDboarder/abuse-the-force.git $WORKSPACE/abuse-the-force +if [ ! -d "$WORKSPACE/abuse-the-force" ]; then + git clone https://github.com/ViViDboarder/abuse-the-force.git "$WORKSPACE/abuse-the-force" fi -cd $WORKSPACE/abuse-the-force && git pull && rake install +cd "$WORKSPACE/abuse-the-force" && git pull && rake install # Ensure this is in the user PATH -for f in $DEFAULT_ASSETS_PATH/* ; do - try_link "$f" "$USER_BIN/$(basename $f)" +for f in "$DEFAULT_ASSETS_PATH"/* ; do + try_link "$f" "$USER_BIN/$(basename "$f")" done diff --git a/recipes/default/build-neovim b/recipes/default/build-neovim index f081dff..2e5632e 100755 --- a/recipes/default/build-neovim +++ b/recipes/default/build-neovim @@ -1,4 +1,5 @@ #! /bin/bash +set -e # in common # sudo_package 'libtool automake cmake' diff --git a/recipes/default/force-cli b/recipes/default/force-cli old mode 100644 new mode 100755 index 946059a..154dfce --- a/recipes/default/force-cli +++ b/recipes/default/force-cli @@ -2,13 +2,13 @@ # Some settings are mac specific if [[ "$UNAME_STR" == "Darwin" ]]; then - wget -P $USER_BIN https://godist.herokuapp.com/projects/heroku/force/releases/current/darwin-amd64/force + wget -P "$USER_BIN" https://godist.herokuapp.com/projects/heroku/force/releases/current/darwin-amd64/force elif [[ "$UNAME_STR" == "Linux" ]]; then - wget -P $USER_BIN https://godist.herokuapp.com/projects/heroku/force/releases/current/linux-amd64/force + wget -P "$USER_BIN" https://godist.herokuapp.com/projects/heroku/force/releases/current/linux-amd64/force fi -chmod +x $USER_BIN/force +chmod +x "$USER_BIN/force" -for f in $DEFAULT_ASSETS_PATH/* ; do - try_link "$f" "$USER_BIN/$(basename $f)" +for f in "$DEFAULT_ASSETS_PATH"/* ; do + try_link "$f" "$USER_BIN/$(basename "$f")" done diff --git a/recipes/default/golang b/recipes/default/golang old mode 100644 new mode 100755 diff --git a/recipes/default/test-recipe b/recipes/default/test-recipe old mode 100644 new mode 100755 diff --git a/recipes/no-sudo/build-fish b/recipes/no-sudo/build-fish old mode 100644 new mode 100755 index 6c1b2d4..639839b --- a/recipes/no-sudo/build-fish +++ b/recipes/no-sudo/build-fish @@ -2,13 +2,17 @@ log "Compiling and installing fish-shell to local prefix" -local fish_shell_dir=$WORKSPACE/fish-shell +function main() { + local fish_shell_dir=$WORKSPACE/fish-shell -if [ ! -d $fish_shell_dir ]; then - log "Cloning fish-shell" - git clone https://github.com/fish-shell/fish-shell $fish_shell_dir -else - (cd $fish_shell_dir && git pull) -fi + if [ ! -d "$fish_shell_dir" ]; then + log "Cloning fish-shell" + git clone https://github.com/fish-shell/fish-shell "$fish_shell_dir" + else + (cd "$fish_shell_dir" && git pull) + fi -(cd $fish_shell_dir && ./configure --prefix=$LOCAL_PREFIX --disable-shared && make && make install) + (cd "$fish_shell_dir" && ./configure --prefix="$LOCAL_PREFIX" --disable-shared && make && make install) +} + +main diff --git a/recipes/no-sudo/build-vim b/recipes/no-sudo/build-vim old mode 100644 new mode 100755 index 57a8cb4..e74433c --- a/recipes/no-sudo/build-vim +++ b/recipes/no-sudo/build-vim @@ -1,31 +1,34 @@ #!/bin/bash +set -e -local vim_dir="$WORKSPACE/vim" +function main() { + local vim_dir="$WORKSPACE/vim" -# Build latest vim -if [ ! -d $vim_dir ]; then - hg clone https://vim.googlecode.com/ $vim_dir -fi + # Build latest vim + if [ ! -d "$vim_dir" ]; then + hg clone https://vim.googlecode.com/ "$vim_dir" + fi -# Go to workspace -cd $vim_dir + # Go to workspace + cd "$vim_dir" -# Use latest tagged source code -hg update -r 'max(tagged())' -# Configure vim with ruby, python and GTK -./configure --with-features=huge \ - --enable-pythoninterp \ - --enable-rubyinterp \ - --enable-gui=gtk2 \ - --prefix=$LOCAL_PREFIX + # Use latest tagged source code + hg update -r 'max(tagged())' + # Configure vim with ruby, python and GTK + ./configure --with-features=huge \ + --enable-pythoninterp \ + --enable-rubyinterp \ + --enable-gui=gtk2 \ + --prefix="$LOCAL_PREFIX" -# Compile -make -# Install newly compiled vim -make install -# Link vi to vim out of convenience -vim_path=$(which vim) -sudo ln -s $vim_path ${vim_path:0:(-1)} + # Compile + make + # Install newly compiled vim + make install + # Link vi to vim out of convenience + vim_path=$(which vim) + sudo ln -s "$vim_path" "${vim_path:0:(-1)}" -# Go back to previous directory -cd $ROOT_DIR + # Go back to previous directory + cd "$ROOT_DIR" +} diff --git a/recipes/no-sudo/test-recipe b/recipes/no-sudo/test-recipe old mode 100644 new mode 100755