Legoktm has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/373179 )
Change subject: Generate reports for sniffs
......................................................................
Generate reports for sniffs
Change-Id: I8a18c37fd0d1a2712f4da3f4c6df0aafaa7fb96d
---
M .gitignore
M app.py
M templates/sniff.html
3 files changed, 40 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/labs/libraryupgrader
refs/changes/79/373179/1
diff --git a/.gitignore b/.gitignore
index 621b542..7157448 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
output.json
extensions/*.html
index.html
+sniffs/*.html
diff --git a/app.py b/app.py
index 9145871..e224c0e 100644
--- a/app.py
+++ b/app.py
@@ -37,6 +37,21 @@
return json.load(f)
+def read_by_sniff(version='dev-master'):
+ new = defaultdict(lambda: defaultdict(int))
+ data = read_raw()
+ for ext in data:
+ info = data[ext][version]
+ if not info:
+ continue
+ for name, finfo in info['files'].items():
+ for message in finfo['messages']:
+ sniff = message['source']
+ new[sniff][ext] += 1
+
+ return new
+
+
def read_by_ext(version='dev-master'):
new = {}
data = read_raw()
@@ -86,6 +101,15 @@
with open(os.path.join(ext_path, ext + '.html'), 'w') as f:
f.write(render_template('extension.html', ext=ext, data=data))
+ by_sniff = read_by_sniff()
+ sniff_path = os.path.join(path, 'sniffs')
+ if not os.path.isdir(sniff_path):
+ os.mkdir(sniff_path)
+
+ for sniff, data in by_sniff.items():
+ with open(os.path.join(sniff_path, sniff + '.html'), 'w') as f:
+ f.write(render_template('sniff.html', sniff=sniff, data=data))
+
if __name__ == '__main__':
with open('index.html', 'w') as f:
diff --git a/templates/sniff.html b/templates/sniff.html
index 1cb9c46..b01516b 100644
--- a/templates/sniff.html
+++ b/templates/sniff.html
@@ -2,10 +2,23 @@
<html lang="en">
<head>
<meta charset="UTF-8">
- <title>{{ code }} - PHPCS Dashboard</title>
+ <title>{{ sniff }} - PHPCS Dashboard</title>
</head>
<body>
-<h1 class="title">{{ code }}</h1>
+<h1 class="title">{{ sniff }}</h1>
+
+{% if data %}
+The following extensions are failing on this sniff:
+
+<ul>
+ {% for extension in data|sort %}
+ <li>{{extension}} - {{data[extension]}}</li>
+ {% endfor %}
+</ul>
+{% else %}
+There are no failing extensions!
+{% endif %}
+
</body>
</html>
--
To view, visit https://gerrit.wikimedia.org/r/373179
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a18c37fd0d1a2712f4da3f4c6df0aafaa7fb96d
Gerrit-PatchSet: 1
Gerrit-Project: labs/libraryupgrader
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits