Commit Graph

831 Commits

Author SHA1 Message Date
Tim Abbott 52fc1c71bc provision: Rewrite using subprocess module instead of sh.
The `with sh.sudo` pattern that we were using in python-sh was
deprecated, and emperically hangs on Ubuntu xenial.  Since in general
the use of python-sh/python-pbs caused trouble (requiring extra
dependencies, confusing syntax), this just removes it.

We replace it with a new zulip_tools.py library function that echoes
the command line and streams the output.

We do the same to install-phantomjs so we can remove that dependency.
2016-04-10 17:33:19 -07:00
Vishnu Ks 2ac5271091 Move global variable have_scrolled_away_from_top to ui.js. 2016-04-10 10:55:16 -07:00
Tim Abbott 9584ae1ab8 Add CSS linter for missing space after : in rules. 2016-04-08 21:04:43 -07:00
Aristeidis Fkiaras 0058ccbdb0 Move global unread_messages_read_in_narrow to unread.js. 2016-04-08 12:11:47 -07:00
Tim Abbott 209e6ef7a1 Run trailing whitespace linter on bash files. 2016-04-08 11:52:11 -07:00
Tim Abbott caba24b2af Fix existing trailing whitespace in bash scripts. 2016-04-08 11:52:11 -07:00
Tim Abbott 4fa63c29ca Run whitespace linters on html files. 2016-04-08 11:52:11 -07:00
Tim Abbott d670e902a9 Run whitespace linters on handlebars templates. 2016-04-08 11:52:11 -07:00
Tim Abbott c6d01ab76b Run whitespace linters on CSS files. 2016-04-08 11:47:10 -07:00
Tim Abbott 1b84617771 Don't skip running python custom linters inside comments.
This fixes an issue where we weren't checking for trailing whitespace
in comments.
2016-04-08 11:47:10 -07:00
Tim Abbott 14b5e265c2 Remove unuseful suspicious code lint check. 2016-04-08 11:47:10 -07:00
Tim Abbott efd14e7ad9 Revert "Exclude 'from typing import *' from linter."
This reverts commit d936bf61f9.

We no longer need this since we've migrated to specifying the
dependencies in the typing module that we're actually using.
2016-04-07 14:12:18 -07:00
Tim Abbott e413d4e153 Move webpack configuration to tools/. 2016-04-06 08:09:55 -07:00
Eklavya Sharma 05ab57e373 In py3k, exit with 1 if repository is not clean. 2016-04-05 13:22:51 -07:00
Eklavya Sharma 569d1240d0 Exit with 1 in py3k when fixers find an issue.
tools/travis/py3k used to always exit with exit code 0.
It should exit with 1 when fixers detect a compatibility issue.

py3k used [ -z "$failed" ] to check if there was a failure.
This is wrong, since if no failure has occured, failed=0,
and -z checks if a string is of zero length. This commit also
fixes this bug.
2016-04-05 13:22:51 -07:00
Eklavya Sharma dd501830a6 Change position where git reset is called in py3k.
In py3k, "git reset --hard" was called only if
libmodernize.fixes.fix_dict_six changed files and some of those
changes are not considered false positives by py3k.
But if all of those changes are not considered false positives
by py3k, then "git reset --hard" is not called and the repository
is no longer clean.

This commit fixes this bug.
2016-04-05 13:22:51 -07:00
Eklavya Sharma 5e71777975 Add --no-pager option to git diff in py3k.
This is needed because py3k hangs when a pager opens up.
2016-04-05 13:22:51 -07:00
Eklavya Sharma adff674b0e tools/travis/py3k now checks all python files.
tools/travis/py3k used to only check files whose names ended with .py.
Now it also checks python scripts which don't have an extension.
It uses tools/lister.py to get a list of all python files.
2016-04-05 13:22:51 -07:00
Eklavya Sharma ab02ab31e3 Change len(obj.keys()) to len(obj) in tools/get-handlebar-vars.
This prevents libmodernize.fixes.fix_dict_six from reporting
this on running tools/travis/py3k.
2016-04-05 13:22:51 -07:00
Eklavya Sharma 8a81f8c125 Apply Python 3 futurize transform libfuturize.fixes.fix_print_with_import. 2016-04-05 13:22:51 -07:00
Eklavya Sharma f4aa609aea Apply Python 3 futurize transform libmodernize.fixes.fix_file. 2016-04-05 13:22:51 -07:00
Eklavya Sharma be0a4f349d Apply Python 3 futurize transform libmodernize.fixes.fix_filter. 2016-04-05 13:22:51 -07:00
Tim Abbott 78e289f904 Exclude puppet-common tests from puppet linter. 2016-04-04 17:08:29 -07:00
Tim Abbott b99313545e Add PEP-484 type annotations to global dictionaties. 2016-04-03 15:40:06 -07:00
Tim Abbott 70c1b0a01d lister: Add file type detection for node and ruby. 2016-04-01 15:27:32 -07:00
Eklavya Sharma aead933c14 Add command-line interface to lister.py using argparse. 2016-04-01 15:27:32 -07:00
Eklavya Sharma 81fdeae0ea Remove '.'s from extensions in lister.py interface and lint-all.
In lint-all, change occurences of '.py', '.js', ... to 'py', 'js', ....
2016-04-01 15:27:16 -07:00
Eklavya Sharma ad4c20a3e6 Migrate lint-all to lister.py for getting files.
This has the side effect of making lint-all check all shell scripts,
not just those under scripts/, tools/, and bin/.

[commit message expanded by tabbott]
2016-04-01 15:24:43 -07:00
Eklavya Sharma ec8ae1f4c5 Add option to determine file type in lister.py using shebang. 2016-04-01 15:19:13 -07:00
Eklavya Sharma 5063f16f82 Add options for file type in lister.py
Add option to filter files by their extension.
Add option to return a dict of list of files keyed by their file type.
2016-04-01 15:19:13 -07:00
Eklavya Sharma 81aabb5831 Add option to exclude files from lister.py. 2016-04-01 15:19:13 -07:00
Eklavya Sharma 422fef2e24 Add argument modified_only to lister.py.
Add option of only showing modified files in tools/lister.py.
2016-04-01 15:19:13 -07:00
Eklavya Sharma 6954eb072c Create lister.py.
Make module tools/lister.py which lists all files in a directory
tracked by git.  This is done because lister.py will be used by other
scripts in the future which have to introspect files in the repository,
like linters, static code checkers, etc.
2016-04-01 15:19:13 -07:00
Tim Abbott 7d74c64f75 Add hackish tool for finding unused CSS. 2016-04-01 09:34:46 -07:00
Tim Abbott d936bf61f9 Exclude 'from typing import *' from linter. 2016-03-30 21:50:31 -07:00
Tim Abbott 970d697e88 Fetch PhantomJS packages from a GitHub URL.
This should fix a problem we've been having with errors downloading
the PhantomJS packages from their original hosting service.

Eventually we should move it to an S3 bucket.
2016-03-29 21:24:38 -07:00
Eklavya Sharma 20f4bcd86e Delete tools/python-proxy since it is not used. 2016-03-29 20:02:26 -07:00
Tim Abbott cd2348e9ae Run queue processers multithreaded in development.
This change drops the memory used for Python processes run by Zulip in
development from about 1GB to 300MB on my laptop.

On the front of safety, http://pika.readthedocs.org/en/latest/faq.html
explains "Pika does not have any notion of threading in the code. If
you want to use Pika with threading, make sure you have a Pika
connection per thread, created in that thread. It is not safe to share
one Pika connection across threads.".  Since this code only connects
to rabbitmq inside the individual threads, I believe this should be
safe.

Progress towards #32.
2016-03-20 18:04:24 -07:00
Eklavya Sharma 9e3c3e14f5 Partially apply Python 3 libmodernize.fixes.fix_dict_six.
Refer to #256
2016-03-19 15:52:58 -07:00
Tim Abbott f9222de83e Auto-load commonly used modules in manage.py shell.
This automatically loads settings, zerver.models.* and
zerver.lib.actions.* when you start `manage.py shell`, which should
save a bit of time basically every time someone uses it.

Fixes #275.
2016-03-19 11:32:49 -07:00
Varshit 72033069ed Extend lint-all to check for newlines at the end of files. 2016-03-17 23:03:56 -07:00
Tim Abbott 3a46bae542 Fix shell script list computation to exclude files not in git.
This fixes an issue where the next commit's no-newline-and-end-of-file
check was incorrectly firing on tools/phantomjs.
2016-03-17 23:03:56 -07:00
Eklavya Sharma 37f9520666 Make the remaining ambiguous divisions python 3 compatible.
Refer to #256
2016-03-12 10:53:51 -08:00
Eklavya Sharma 14130a84ca Partially apply Python 3 transform libpasteurize.fixes.fix_newstyle
Refer to #256
2016-03-12 23:19:56 +05:30
Eklavya Sharma 3ab567db98 Add call to generate-fixtures in test-backend.
Add call to tools/generate-fixtures in tools/test-backend before
starting the tests.  Previously, test-backend could fail if called
after tools/test-js-with-casper had failed.

Fixes #501.
2016-03-12 09:24:32 -08:00
Eklavya Sharma 01bfa2d94d Apply Python 3 futurize transform libmodernize.fixes.fix_unicode_type
Refer to #256
2016-03-10 22:04:15 -08:00
Eklavya Sharma b9e792c4e6 Apply Python 3 futurize transform libmodernize.fixes.fix_xrange_six
Refer to #256
2016-03-10 22:03:58 -08:00
Eklavya Sharma aa505b0d55 Apply Python 3 futurize transform libmodernize.fixes.fix_map
Refer to #256
2016-03-10 22:03:44 -08:00
Eklavya Sharma 7b8cb105bf Apply Python 3 futurize transform libmodernize.fixes.fix_imports_six
Refer to #256
2016-03-10 22:03:30 -08:00
Eklavya Sharma def027a1ec Apply Python 3 futurize transform libmodernize.fixes.fix_filter
Refer to #256
2016-03-10 22:03:06 -08:00