-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,20 @@ | ||
#!/bin/bash | ||
# Loads necessaries | ||
set -e # Exit on error | ||
|
||
source ./scripts/utils/prettyecho.sh | ||
source ./scripts/lint/setupenv.sh | ||
|
||
VERBOSE=false | ||
KEEP_CONTAINER=false | ||
# Parse options | ||
while getopts "v" opt; do | ||
case $opt in | ||
v) | ||
VERBOSE=true | ||
;; | ||
d) | ||
KEEP_CONTAINER=true | ||
;; | ||
\?) | ||
efatal "Lint" "Invalid option: -$OPTARG" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
# Tearing down | ||
spin_up | ||
if [ $? -ne 0 ]; then | ||
efatal 0 "Lint" "Failed to spin up container." | ||
exit 1 | ||
fi | ||
|
||
# Code | ||
einfo 0 "Lint" "ERRORS ONLY MODE. Ignoring warnings and bad conventions.." | ||
CLNORMAL=$(tput sgr0) | ||
CLCYAN=$(tput setaf 6) | ||
|
||
component=$1 | ||
if [ component = "" ]; then | ||
component="app" | ||
else | ||
component="app/$component" | ||
fi | ||
einfo 1 "Lint" "Linting $component..." | ||
|
||
docker exec -t $TMP_LINTER_NAME pylint --output-format=colorized \ | ||
--django-settings-module=bkdnoj.settings \ | ||
--load-plugins pylint_django \ | ||
--ignore=migrations \ | ||
--errors-only \ | ||
$component | ||
echo "${CLCYAN} * [ LINT ] Linting $component...${CLNORMAL}" | ||
|
||
# Tearing down | ||
if [ "$KEEP_CONTAINER" = "false" ]; then | ||
einfo 0 "Lint" "Tearing down temporary container for lint..." | ||
tear_down | ||
else | ||
einfo 0 "Lint" "Keeping container." | ||
fi | ||
pylint --output-format=colorized \ | ||
--django-settings-module=bkdnoj.settings \ | ||
--load-plugins pylint_django \ | ||
--ignore=migrations \ | ||
--errors-only \ | ||
$component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
# Loads necessaries | ||
set -e # Exit on error | ||
|
||
source ./scripts/utils/prettyecho.sh | ||
|
||
source ./scripts/lint/setupenv.sh | ||
# Defines | ||
# # $TMP_LINTER_NAME | ||
# # $TMP_LINTER_IMAGE_NAME | ||
# # $CONTAINER_WORKDIR | ||
|
||
|
||
VERBOSE=false | ||
KEEP_CONTAINER=false | ||
LINT_TARGET="" | ||
# Parse options | ||
while getopts "vdt" opt; do | ||
case $opt in | ||
v) | ||
VERBOSE=true | ||
;; | ||
d) | ||
KEEP_CONTAINER=true | ||
;; | ||
t) | ||
LINT_TARGET=$OPTARG | ||
;; | ||
\?) | ||
efatal "Lint" "Invalid option: -$OPTARG" >&2 | ||
einfo "Usage $0 [-v] [-d]" | ||
echo " -v: To enable verbose" | ||
echo " -d: To keep container after linting" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
einfo 0 "LINT OPTIONS" "VERBOSE=$VERBOSE, KEEP_CONTAINER=$KEEP_CONTAINER, LINT_TARGET='$LINT_TARGET'" | ||
|
||
# Tearing down | ||
spin_up | ||
if [ $? -ne 0 ]; then | ||
efatal 0 "Lint" "Failed to spin up container." | ||
exit 1 | ||
fi | ||
|
||
# Code | ||
einfo 0 "Lint" "ERRORS ONLY MODE. Ignoring warnings and bad conventions.." | ||
|
||
docker exec -t $TMP_LINTER_NAME bash $CONTAINER_WORKDIR/scripts/lint/lint.sh $LINT_TARGET | ||
|
||
# Tearing down | ||
if [ "$KEEP_CONTAINER" = "false" ]; then | ||
einfo 0 "Lint" "Tearing down temporary container for lint..." | ||
tear_down | ||
else | ||
einfo 0 "Lint" "Keeping container." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters