github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/bin/ratchet (about)

     1  #!/usr/bin/env bash
     2  
     3  ROOT_DIR=$(cd $(dirname $(dirname $0)) && pwd)
     4  
     5  $ROOT_DIR/bin/lint > /tmp/currentlint
     6  
     7  added_lint_debt=$(diff --changed-group-format='%>' --unchanged-group-format='' $ROOT_DIR/lintdebt /tmp/currentlint 2>&1)
     8  added_lint_debt_lines=$(wc -w <<< "$added_lint_debt")
     9  
    10  removed_lint_debt=$(diff --changed-group-format='%<' --unchanged-group-format='' $ROOT_DIR/lintdebt /tmp/currentlint 2>&1)
    11  removed_lint_debt_lines=$(wc -w <<< "$removed_lint_debt")
    12  
    13  if [ "$added_lint_debt_lines" -ne "0" ]; then
    14      cat <<END
    15  ==RATCHET===============================
    16  Please do not create any new lintdebt.
    17  The added lint debt between the current code and the lintdebt file:
    18  
    19  END
    20  
    21      echo "$added_lint_debt"
    22      echo -e "==RATCHET===============================\n"
    23  
    24      exit 1
    25  fi
    26  
    27  
    28  
    29  if [ "$removed_lint_debt_lines" -ne "0" ]; then
    30      cat <<END
    31  ==RATCHET===============================
    32  It looks like you've removed some lint debt! YAY!!!
    33  Please update & commit the new lintdebt to reflect your fixes.
    34  
    35    ./bin/lint > lintdebt
    36    git add lintdebt
    37  
    38  ==RATCHET===============================
    39  
    40  END
    41  
    42      exit 1
    43  fi
    44