"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/validate.sh" (12 May 2020, 2288 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 
    3 # "validate.sh"                                              v1.0.2 | 2019/10/20
    4 #-------------------------------------------------------------------------------
    5 # Validate code style consistency in the repository via EditorConfig settings
    6 # and the EClint validator tool:
    7 #   https://editorconfig.org
    8 #   https://www.npmjs.com/package/eclint
    9 #-------------------------------------------------------------------------------
   10 echo -e "\n\033[34;1m================================================"
   11 echo -e "\033[33;1mValidating Code Styles via EditorConfig Settings"
   12 echo -e "\033[34;1m================================================\033[0m"
   13 
   14 # ==================
   15 # Check Dependencies
   16 # ==================
   17 # Since the script might also be run locally by end users, check that EClint is
   18 # installed on the user machine:
   19 
   20 if eclint --version > /dev/null 2>&1 ; then
   21     echo -e "Using:"
   22     echo -e "\033[34;1m*\033[35m Node.js $(node -v)"
   23     echo -e "\033[34;1m*\033[35m EClint v$(eclint --version).\n\033[31;1m"
   24 else
   25     echo -e "\033[31;1m~~~ ERROR! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
   26     echo -e "In order to run this script you need to install EClint (Node.js):\n"
   27     echo -e "\thttps://www.npmjs.com/package/eclint"
   28     echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\033[0m"
   29     echo -e "If you've already installed Node.js on your machine, type:\n"
   30     echo -e "\033[33;1m\tnpm install -g eclint"
   31     echo -e "\033[31;1m\n/// Aborting All Tests ///\033[0m"
   32     exit 1
   33 fi
   34 
   35 # ==============
   36 # Validate Files
   37 # ==============
   38 # Check that project files meet the code style standards set in `.editorconfig`;
   39 # if not, print only the list of files that failed -- because EClint reports are
   40 # usually too long.
   41 
   42 tmpLog=./eclint.log
   43 eclint check 2> $tmpLog || {
   44     echo -e "\033[31;1m~~~ ERROR! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
   45     echo -e "The following files didn't pass the validation test:\n\033[33;1m";
   46     cat $tmpLog | grep  "^[^ ]";
   47     echo -e "\n\033[31;1mRun ECLint locally for detailed information about the problems.";
   48     echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
   49     echo -e "/// Aborting All Tests ///\033[0m";
   50     rm $tmpLog;
   51     exit 1;
   52     }
   53 rm $tmpLog;
   54 echo -e "\033[32;1m/// Test Passed ///\033[0m"
   55 exit
   56 
   57 # EOF #