Smalyshev has submitted this change and it was merged.

Change subject: Add configs for syntax checker
......................................................................


Add configs for syntax checker

Fix jsondiff.py per flake8 reports.

Change-Id: Idadec18c0560090ec0f059c62da75461e9a5ae51
---
M jsondiff.py
A setup.cfg
A tox.ini
3 files changed, 32 insertions(+), 6 deletions(-)

Approvals:
  Smalyshev: Looks good to me, approved
  Tjones: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/jsondiff.py b/jsondiff.py
index 7fff696..79b4ace 100755
--- a/jsondiff.py
+++ b/jsondiff.py
@@ -31,12 +31,12 @@
 
 import argparse
 import difflib
-import getopt
 import json
 import os
 import re
 import sys
 from itertools import izip_longest
+
 
 def main():
     parser = argparse.ArgumentParser(description='line-by-line diff of JSON 
blobs',
@@ -59,17 +59,18 @@
             (aline, bline) = tuple
             aline = aline.strip(' \t\n')
             bline = bline.strip(' \t\n')
-            if aline == '': aline = '{}'
-            if bline == '': bline = '{}'
+            if aline == '':
+                aline = '{}'
+            if bline == '':
+                bline = '{}'
             diff_count += 1
-            diff_file = open(target_dir + 'diff' + `diff_count` + '.html', 'w')
+            diff_file = open(target_dir + 'diff' + repr(diff_count) + '.html', 
'w')
 
             # remove searchmatch markup
             aline = re.sub(r'<span class=\\"searchmatch\\">(.*?)<\\/span>',
                            '\\1', aline)
             bline = re.sub(r'<span class=\\"searchmatch\\">(.*?)<\\/span>',
                            '\\1', bline)
-
 
             aline = json.dumps(json.loads(aline), sort_keys=True, indent=2)
             bline = json.dumps(json.loads(bline), sort_keys=True, indent=2)
@@ -83,4 +84,4 @@
             diff_file.close()
 
 if __name__ == "__main__":
-    main()
\ No newline at end of file
+    main()
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..df07bdd
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,4 @@
+# configuration for flake8
+[flake8]
+# Raise the default 79 limit
+max-line-length = 100
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..00c9e9d
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,21 @@
+# Tox configuration
+[tox]
+minversion = 1.6
+skipsdist = True
+# List the environment that will be run by default
+envlist = flake8, py27
+
+[testenv]
+# Default configuration. py26 and py27 will end up using this
+setenv = VIRTUAL_ENV={envdir}
+
+# Settings specific to the flake8 environment
+[testenv:flake8]
+# The command to run:
+commands = flake8
+# We only need flake8 when linting, we do not care about the project 
dependencies
+deps = flake8
+
+[testenv:venv]
+# Let you pass additional arguments when invoking tox
+commands = {posargs}

-- 
To view, visit https://gerrit.wikimedia.org/r/251302
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idadec18c0560090ec0f059c62da75461e9a5ae51
Gerrit-PatchSet: 4
Gerrit-Project: wikimedia/discovery/relevancylab
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Tjones <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to