Skip to content

Commit

Permalink
Merge pull request #2 from practo/more_sniffs
Browse files Browse the repository at this point in the history
new sniffs
  • Loading branch information
justjkk committed May 10, 2016
2 parents 9a0ab7f + 5546145 commit 2564a01
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions fabpolish/contrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def find_php_syntax_errors():


@sniff(severity='major', timing='fast')
def code_analyzer():
def python_code_analyzer():
"""Running static code analyzer"""
info('Running static code analyzer')
return local(
Expand Down Expand Up @@ -99,7 +99,7 @@ def check_migration_branch():


@sniff(severity='major', timing='fast')
def remove_debug_info():
def check_python_debug_info():
"""Check and remove debugging print statements"""
info('Checking for debug print statements')
return local(
Expand All @@ -111,6 +111,15 @@ def remove_debug_info():
)


@sniff(severity='major', timing='fast')
def check_php_debug_info():
info('Checking for var_dump, echo or die statements...')
return local(
"! find ./src -name '*.php' -print0 | "
"xargs -0 egrep -n 'var_dump|echo|die' | grep -v 'NOCHECK'"
)


@sniff(severity='major', timing='fast')
def check_image_edited():
# Check if image files have been edited
Expand Down Expand Up @@ -139,3 +148,12 @@ def run_eslint():
"grep '\.js$' | "
"xargs ./node_modules/eslint/bin/eslint.js"
)


@sniff(severity='major', timing='fast')
def check_preg_replace():
info('Checking use of preg_replace...')
return local(
"! find src -name '*.php' -print0 | "
"xargs -0 grep -n 'preg_replace('"
)

0 comments on commit 2564a01

Please sign in to comment.