Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/197460
Change subject: Have utils.check_php_opening_tag check the file extension suffix
......................................................................
Have utils.check_php_opening_tag check the file extension suffix
php -l will happily say that non-PHP files don't have syntax errors, and
is unconditionally called in sync-file. But since check_php_opening_tag is
more restrictive, only actually check PHP files.
Change-Id: Ie1d16423787a25e3c45e77d9447e8e2d51fd0299
---
M scap/tasks.py
M scap/utils.py
2 files changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/scap
refs/changes/60/197460/1
diff --git a/scap/tasks.py b/scap/tasks.py
index 92c7eab..c23d4ce 100644
--- a/scap/tasks.py
+++ b/scap/tasks.py
@@ -91,8 +91,7 @@
for path in paths:
for root, dirs, files in os.walk(path):
for filename in files:
- if filename.endswith(('.php', '.inc', '.phtml', '.php5')):
- utils.check_php_opening_tag(os.path.join(root, filename))
+ utils.check_php_opening_tag(os.path.join(root, filename))
def compile_wikiversions_cdb(source_tree, cfg):
diff --git a/scap/utils.py b/scap/utils.py
index bb6e126..c78be39 100644
--- a/scap/utils.py
+++ b/scap/utils.py
@@ -313,6 +313,8 @@
:param path: Location of file
:raises: ValueError on invalid file
"""
+ if not path.endswith(('.php', '.inc', '.phtml', '.php5')):
+ return
with open(path) as f:
text = f.read()
if text.strip() and not text.startswith('<?php'):
--
To view, visit https://gerrit.wikimedia.org/r/197460
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1d16423787a25e3c45e77d9447e8e2d51fd0299
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/scap
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits