From 8b3a294360e1dd6185f6dddefe502d34841c909e Mon Sep 17 00:00:00 2001 From: Severin Kaderli Date: Thu, 13 Dec 2018 22:42:22 +0100 Subject: [PATCH] Fix linting errors Signed-off-by: Severin Kaderli --- .gitlab-ci.yml | 2 +- system/.bash_profile | 12 ++++++------ system/.bashrc | 26 +++++++++++++------------- system/.env | 11 +++-------- system/.xprofile | 4 ++-- 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7e057cd..5cd93c1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ image: ubuntu:latest before_script: - apt-get update && apt-get install -y --no-install-recommends shellcheck - + - alias shellcheck="shellcheck -x --exclude=SC2034,SC1091,SC1090" Lint: script: - shellcheck -x --exclude=SC2034,SC1091 ./system/bin/* diff --git a/system/.bash_profile b/system/.bash_profile index 953e4d6..10f96cc 100644 --- a/system/.bash_profile +++ b/system/.bash_profile @@ -2,20 +2,20 @@ # # Author: Severin Kaderli # We just source .bashrc so we don't need to manage two files. -if [[ -f $HOME/.bashrc ]]; then - . $HOME/.bashrc +if [[ -f "${HOME}/.bashrc" ]]; then + . "${HOME}/.bashrc" fi # Setting keyboard colors -if [[ -f $HOME/.keyleds ]]; then - . $HOME/.keyleds +if [[ -f "${HOME}/.keyleds" ]]; then + . "${HOME}/.keyleds" fi # Restore custom dconf configuration -cat "${HOME}/dconf/root.conf" | dconf load / +dconf load / < "${HOME}/dconf/root.conf" # Activate correct crontab file -crontab $HOME/.crontab +crontab "${HOME}/.crontab" # If we are on tty1 we start the x-server if [ "$(tty)" = "/dev/tty1" ]; then diff --git a/system/.bashrc b/system/.bashrc index 56b2bd0..882e1b4 100644 --- a/system/.bashrc +++ b/system/.bashrc @@ -6,34 +6,34 @@ shopt -s checkwinsize shopt -s globstar # set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm|xterm-color|*-256color) color_prompt=yes;; -esac +#case "$TERM" in +# xterm|xterm-color|*-256color) color_prompt=yes;; +#esac -unset color_prompt force_color_prompt +#unset color_prompt force_color_prompt # Enable color support of ls -if [ -f $HOME/.dircolors ]; then - dircolors -b $HOME/.dircolors > /dev/null 2>&1 +if [ -f "${HOME}/.dircolors" ]; then + dircolors -b "${HOME}/.dircolors" > /dev/null 2>&1 fi # Sourcing alias definitions -if [ -f $HOME/.aliases ]; then - . $HOME/.aliases +if [ -f "${HOME}/.aliases" ]; then + . "${HOME}/.aliases" fi # Source git-prompt script -if [ -f /usr/share/git/completion/git-prompt.sh ]; then - . /usr/share/git/completion/git-prompt.sh +if [ -f "/usr/share/git/completion/git-prompt.sh" ]; then + . "/usr/share/git/completion/git-prompt.sh" fi # Enable autocompletion features -if [ -f /etc/bash_completion ]; then +if [ -f "/etc/bash_completion" ]; then /etc/bash_completion fi complete -cf sudo # Sourcing alias definitions -if [ -f $HOME/.env ]; then - . $HOME/.env +if [ -f "${HOME}/.env" ]; then + . "${HOME}/.env" fi \ No newline at end of file diff --git a/system/.env b/system/.env index 1237ff6..8727584 100644 --- a/system/.env +++ b/system/.env @@ -1,4 +1,6 @@ #!/bin/bash +. "${HOME}/bin/utils.sh" + # Bash export HISTCONTROL=ignoreboth @@ -36,16 +38,9 @@ export npm_config_prefix="$HOME/.node_modules" # Adding folders to the PATH variable export PATH="$PATH:$HOME/bin:$HOME/.node_modules/bin" -# Color codes for bash prompt -RESET='\033[0m' -GREEN='\033[32m' -RED='\033[31m' -BLUE='\033[34m' -YELLOW='\033[33m' - # Set bash prompt set_bash_prompt() { - PS1="${Reset}┌─" + PS1="${RESET}┌─" PS1="${PS1}${RED}[\t]" PS1="${PS1}${BLUE}[\h]" PS1="${PS1}${YELLOW}[\w]" diff --git a/system/.xprofile b/system/.xprofile index 57c555b..34368f9 100644 --- a/system/.xprofile +++ b/system/.xprofile @@ -10,6 +10,6 @@ setxkbmap -model pc105 -layout ch # Start ibus ibus-daemon -drx -if [[ -f $HOME/.bash_profile ]]; then - . $HOME/.bash_profile +if [[ -f "${HOME}/.bash_profile" ]]; then + . "${HOME}/.bash_profile" fi