commit ea61d8d6f0b38be4de800ec585552aac5120dd6c Author: xdrm-brackets Date: Sat May 13 12:30:39 2017 +0200 [1] project init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f002af --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/src/linter +/phptest/ +*.o \ No newline at end of file diff --git a/php-linter b/php-linter new file mode 100755 index 0000000..a2ac5a4 --- /dev/null +++ b/php-linter @@ -0,0 +1,47 @@ +#!/bin/bash + +usage(){ + echo -e "Usage: php-linter {path}\n"; +} + +# [1] Manage config +#========================================================# +# (1) Check argc # +if [ $# -lt 1 ]; then + + usage; + echo "* Missing argument 'path'"; + exit 1; + +fi; + +# (2) Check argument @filename # +FILENAME="`realpath $1`"; + +if [ ! -e $FILENAME ]; then + + usage; + echo "* path '$FILENAME' doesn't exist"; + exit 1; + +fi; + +# (3) Check file or dir # +if [ -d $FILENAME ]; then + + count=0; + + ## {1} Exec for each file in directory ## + for phpfile in `find $FILENAME -name '*.php'`; do + + count=`expr $count + 1`; + echo "($count) file $phpfile"; + ./src/linter $phpfile; + + done; + +else + ## {2} Exec file ## + ./src/linter $FILENAME; +fi; + diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..7b7441c --- /dev/null +++ b/src/Makefile @@ -0,0 +1,15 @@ +GCCARGV=-Wall + + +default: compile + +compile: install + +install: linter + + + + +linter: linter.c linter.h + gcc $(GCCARGV) -o linter -c linter.c; + diff --git a/src/linter.c b/src/linter.c new file mode 100644 index 0000000..c2db99e --- /dev/null +++ b/src/linter.c @@ -0,0 +1,10 @@ +/************************** +* PHP-Linter * +*************************** +* Designed & Developed by * +* Adrien Marquès * +* * +*************************** +* doowap31@gmail.com * +**************************/ +#include "linter.h" \ No newline at end of file diff --git a/src/linter.h b/src/linter.h new file mode 100644 index 0000000..5e2d4e0 --- /dev/null +++ b/src/linter.h @@ -0,0 +1,17 @@ +/************************** +* PHP-Linter * +*************************** +* Designed & Developed by * +* Adrien Marquès * +* * +*************************** +* doowap31@gmail.com * +**************************/ + +#ifndef _LINTER_H_ + #define _LINTER_H_ + + #include + #include + +#endif \ No newline at end of file