Commit Graph

1778 Commits

Author SHA1 Message Date
Umair Khan 128beb910b testing: Use TestResult in run_test.
Internally, Django uses TestResult to gather results from testcases.
This commit upgrades the run_test function to use TestResult to compile
result.
2017-02-19 21:04:06 -08:00
Tim Abbott 42cbce9ad6 travis: Add special check for queue processor lists matching. 2017-02-19 16:19:55 -08:00
Tim Abbott d6bbcd2737 travis: Automate updates to production-helper Nagios test.
This list was likely to end up out of date quickly, since it wasn't
documented that you need to update it when adding a queue.  The best
solution is to just not require it to be updated.
2017-02-19 16:19:53 -08:00
Tim Abbott 64898dd0d1 run-dev-queue-processors: Remove dead code. 2017-02-19 13:11:19 -08:00
Tim Abbott 9ac66b0121 test-backend: Update blacklist of covered files based on CI.
After accidentally merging ecadb33fbc
before I go CI input, I discovered that coverage in my development
environment differs from that in CI :(.
2017-02-18 18:52:59 -08:00
Tim Abbott 473c0ee1fe mypy: Remove now-unused type: ignores. 2017-02-18 17:01:01 -08:00
Tim Abbott ecadb33fbc test-backend: Add 100% test coverage assertions.
This adds an assertion, when `test-backend` is run with `--coverage`,
that we have 100% test coverage on a list of files that we expect to.
There's a whitelist/blacklist, managed in tools/test-backend.

Fixes #3363.
2017-02-18 16:34:40 -08:00
Tim Abbott 1abfdc340a lint-all: Soften check for % comprehensions. 2017-02-18 16:29:47 -08:00
Tim Abbott 3ccbc7c114 run-dev: Use a different path for casper test PID file.
This fixes an issue where running the casper tests while a development
server was running would effectively corrupt the PID file.
2017-02-17 16:31:28 -08:00
adnrs96 e84cf7b6f1 tools: Create HTML pretty printer.
In This commit we extend the work being done by @showell in PR#1778
to develop a tool to pretty print html and our handlebar templates
in order to enforce our style convention of 4 Space indentation in
templates.

This commit introduces following changes:
* Fix Py3 Compatibility.
* Add ability to prettify in cases when html tags are not the
  starting of a line and addition of test cases for it.
* Add ability to lint handlebar tags and add test cases for it.
* Add {{else}} as special case of indent.
* Add test cases in general to testing new tool.

@showell Helped me throughout and reviewed this commit.

Fixes #1778
2017-02-15 07:34:43 -08:00
Saumya Rawat dcd9ff642d dev: Fix postgres provision errors with non-postgres-readable homedir.
This fixes an issue where provision would fail if the user's home
directory was setup in such a way that the postgres user couldn't
access it (and thus the `sudo` command here would throw errors about
having a non-readable current working directory).
2017-02-11 23:47:07 -08:00
Saumya Rawat 151d2139ad dev: Clearer postgres error messages in postgres-init-dev-db.
This uses `pg_isready` to provide a clearer error message if postgres
isn't working.

Fixes #2419.
2017-02-11 23:46:56 -08:00
Tommy Ip c7e33c6c9f optimization: Use Python to test management commands.
The original test was written in shell script which launches a new
django instance for every tests. By doing it in Python, we avoid
the overhead and reduce the test time to <1 second.

Fixes #3620.
2017-02-11 13:48:16 -08:00
Tim Abbott 879d8cdca0 mypy: Stop using deprecated --silent-imports. 2017-02-10 23:53:44 -08:00
Tim Abbott bb5d81281c mypy: Upgrade to new package name and version 0.571.
Fixes #3448.
2017-02-10 23:53:44 -08:00
Tim Abbott 650469ead6 mypy: Make zerver/lib/ccache.py support python 3. 2017-02-10 23:53:44 -08:00
Tim Abbott 0564bebdbe test-migrations: Fix inverted check. 2017-02-10 16:41:04 -08:00
Tim Abbott 1fbc3b508a test-migrations: Switch to --check from deprecated -e. 2017-02-10 16:08:13 -08:00
Umair Khan e5a16ceb0a testing: Use failfast instead of fatal_errors.
`failfast` has the same meaning as `fatal_errors` in Django's test
runner.
2017-02-10 16:01:43 -08:00
Umair Khan ef0d2a4bb5 logging: Use django.server to filter 200 and 304.
Previously, we were monkey patching the runserver command
in zerver/management/commands/rundjango.py for this.
2017-02-10 15:55:17 -08:00
Abhijeet Kaur 87e8d9036f contrib_bots: Restructure bots to follow a consistent structure.
Now all the bots that are stored in contrib_bots are in the
same file/directory format.
The format is specified here #3427. Add tests.py file for encrypt_bot as well.
Fixes #3427.
2017-02-10 06:44:03 -08:00
Brock Whittaker 1143ed7219 redesign: Change /#settings and /#administration to an overlay.
This also adds a box-shadow to the #deactivate_self_modal so that it
looks similar to the old backdrop.
2017-02-09 23:35:10 -08:00
Tim Abbott 0c363dffca lint: Ban use of deprecated assertEquals. 2017-02-08 16:38:43 -08:00
Feorlen 78b9b83650 Create new webhook walkthrough page from the integration guide.
Breaks out the Hello World example to create a new
webhook-walkthrough.md. Includes minor edits so the two docs
read well. Adds the new page, "Webhook walkthrough", to the TOC.

Fixes #3498
2017-02-07 18:22:31 -08:00
Tim Abbott d98c19ca98 lint: Include pep8 checks in pre-commit hook. 2017-02-07 13:22:01 -08:00
Tim Abbott 1005d70ff5 update-prod-static: Fix incorrect ordering of venv setup code.
We should check if we succeeded in using a venv only after we've
actually setup sys.path to use it.
2017-02-07 11:49:31 -08:00
sinwar eab355b0cd tools: Create more consistent checks for venv.
This helps make the Zulip development environment somewhat more robust
to new contributors, since it will give them a nice warning if they
try running any of our development tools outside the Zulip virtualenv.

Fixes #3468.
2017-02-06 21:50:32 -08:00
Tim Abbott d71f2e7b9b update-prod-static: Don't ship node_modules.
This saves more than 50MB of unnecessary duplicate content in release
tarballs (the static assets that will actually be served have already
been built at this point by tools/minify-js).
2017-02-06 17:21:34 -08:00
Tim Abbott e2ee1951e0 storage: Fix static files storage reuse issues.
Zulip's previous model for managing static asset files via Django
pipeline had some broken behavior around upgrades.  In particular, it
was for some reason storing the information as to which static files
should be used in a memcached cache that was shared between different
deployments of Zulip.  This means that during the upgrade process,
some clients might be served a version of the static assets that does
not correspond to the server they were connected to.

We've replaced that model with using ManifestStaticFilesStorage, which
instead allows each Zulip deployment directory to have its own
complete copy of the mapping of files to static assets, as it should
be.

We have to do a little bit of hackery with the staticfiles.json path
to make this work, basically because Django expects staticfiles.json
to be under STATIC_ROOT (aka the path nginx is serving to users), but
doing that doesn't really make sense for Zulip, since that directory
is shared between different deployments.
2017-02-06 16:10:24 -08:00
Tim Abbott c1f0ed5637 update-authors-json: Improve error handling. 2017-02-05 12:34:05 -08:00
hackerkid 90f8eb7c52 Add tool for scanning issues without area labels.
Fixes #3495
2017-02-03 09:59:35 -08:00
Tim Abbott fa02dfdff4 mobile: Add an endpoint for checking compatibility. 2017-02-03 09:55:34 -08:00
K.Kanakhin cb1d61cae0 run-dev: Add pid file to development server.
- Add pid file of development processes group, which allows to
  manage development processes group with os utils. Also it allows to
  kill subprocesses  when parent process was closed incorrectly.
- Add tool 'stop_dev_server' to stop development server by pid file.

Fixes #1547
2017-02-02 21:07:03 -08:00
Steve Howell bcfe1bcdbe linters: Handle comments better in template parser.
We now properly parse HTML comments that have HTML
block tags or handlebars/Django blocks within them.
2017-02-02 20:55:43 -08:00
Steve Howell 2a07b204bf css parser: Show line numbers for errors.
This is a fairly major overhaul of the CSS parser to support
line numbers in error messages.

Basically, instead of passing "slices" of tokens around, we pass
indexes into the token arrays to all of our sub-parsers, which
allows them to have access to previous tokens in certain cases.
This is particularly important for errors where stuff is missing
(vs. being wrong).

In testing this out I found a few more places to catch errors.
2017-02-01 10:02:03 -08:00
Harshit Bansal 59d22e7cb8 realm_emoji: Cleanup an unreachable try/except block.
Fixes: #3515.
2017-01-30 16:43:02 -08:00
Tim Abbott 884aa2b184 streams: Eliminate last use of get_stream in views. 2017-01-29 22:07:14 -08:00
Tim Abbott b1c2ff9d05 lint: Ban most use of get_stream from zerver/lib/actions.py. 2017-01-29 20:27:00 -08:00
Tim Abbott 7be34357b2 rename_stream: Move stream name taken check to view. 2017-01-29 20:27:00 -08:00
Tim Abbott 3f83ea3879 lint: Ban use of get_stream in most views files. 2017-01-29 20:26:59 -08:00
Tim Abbott de68dd2860 lint: Ban use of Stream.objects.* in zerver/views. 2017-01-29 20:26:59 -08:00
Tim Abbott bb86bba20d stream_exists_backend: Use access_stream_by_name. 2017-01-29 20:26:59 -08:00
Tim Abbott 0af34ee710 streams: Add zerver/lib/streams.py library for security checks.
The goal of this library is to make it a lot easier to prevent bugs
like CVE-2017-0881 by having all of our views logic for fetching a
stream go through a couple carefully tested code paths.
2017-01-29 20:26:58 -08:00
Tim Abbott 234eb7a723 emoji: Add a bunch of documentation in comments for emoji rules. 2017-01-29 12:33:44 -08:00
Rishi Gupta e19f3d5534 emoji: Make minor adjustments to emoji names list. 2017-01-29 12:19:54 -08:00
Rishi Gupta 6f307ffd08 emoji: Switch the order of thumbs_up and thumbs_down in autocomplete. 2017-01-28 23:38:03 -08:00
Rishi Gupta 8ef5197d5c emoji: Remove problematic color emoji from autocomplete and picker. 2017-01-28 23:38:03 -08:00
Rishi Gupta a2890f7d7a emoji: Remove duplicates from autocomplete and emoji picker.
Previously, if you searched for ':offi..' you would see both 🏢 and
:office_building: as possible completions, both of which are shortcodes for
the same unicode codepoint (and hence which have the same image). Also, we
sort the emoji in our emoji pickers alphabetically by shortcode, and so the
images for 🏢 and :office_building: show up next to each other, which
looks like a bug. This removes :office_building: as a shortcode, along with
several hundred other duplicates. It leaves some duplicates in that won't
give autocomplete or alphabetical ordering a problem, like (🚗,
:automobile:).
2017-01-28 23:38:03 -08:00
Yago González 87a7691bfc translations: Improve some strings. 2017-01-28 18:58:09 -08:00
Tim Abbott bd6f71580e docs: Remove obsolete terms-enterprise page.
This was documentation for the old zulip.com enterprise service that
no longer exists.
2017-01-28 18:12:19 -08:00
Rishi Gupta 6b3abce541 build_emoji: Generate emoji names and codepoints from emoji_map.
Replaces the hardcoded list of emoji_names and unicode_emoji_names in
static/js/emoji.js with a list generated from emoji_map.json, both to get
the list out of version control and so we can start modifying it for our
autocomplete. This does not change the contents of emoji_names. It sorts and
removes duplicates from unicode_emoji_names (causes no change in behavior,
since unicode_emoji_names is only used as if it were a set).
2017-01-28 17:05:32 -08:00
Tim Abbott f6f8168f4d emoji: Build emoji before minifying JS.
Since build_emoji will soon be generated
static/generated/emoji_data.js (containing the emoji data), we need to
generate those JavaScript files before minifying them.
2017-01-28 12:15:34 -08:00
Brock Whittaker 1dd8fb7966 Display realm emojis in the emoji picker container.
This displays the realm emojis in the emoji picker container in their
own divs styled similarly to the existing .emoji divs.
2017-01-27 15:39:22 -08:00
Tomasz Kolek 6e6cbeb89d Split webhooks doc and move to particular directories. 2017-01-26 11:56:45 -08:00
Tomasz Kolek 7de45951e2 Make webhooks as separate modules with view and tests.
Create python packege for every webhook with view.py and tests.py
2017-01-25 23:14:19 -08:00
Tim Abbott 06cd40d461 travis: Run test-api in Travis CI. 2017-01-25 16:42:17 -08:00
Tim Abbott 015ab412bc test-api: Log API tests status. 2017-01-25 16:42:09 -08:00
Steve Howell 9177f17d73 Simplify tools/test-help-documentation.py.
It now uses the test_server_running() context manager to
get a test server running.
2017-01-25 16:33:19 -08:00
Steve Howell 5799183e10 Add use_db flag to test_server_running(). 2017-01-25 16:33:19 -08:00
Steve Howell 38f5f3a76e tests: Move logging into test_server.py for Casper. 2017-01-25 16:33:19 -08:00
Steve Howell 6de1e8be46 Add test-api to tools/test-all. 2017-01-25 16:33:19 -08:00
Tim Abbott 126b1c4edc upgrade: Don't require authors updates deploying from Git.
Fixes #3392.
2017-01-23 23:00:09 -08:00
Tim Abbott 4e171ce787 lint: Clean up E126 PEP-8 rule. 2017-01-23 22:06:13 -08:00
Tim Abbott 31e7dcd86b lint: Tag remaining PEP-8 rules with explanations. 2017-01-23 21:43:33 -08:00
Tim Abbott 376aa3e404 lint: Clean up E702 PEP-8 rule. 2017-01-23 21:37:27 -08:00
Tim Abbott de99f48ce7 lint: Clean up E401 PEP-8 rule. 2017-01-23 21:36:39 -08:00
Tim Abbott d6e38e2a5c lint: Clean up E123 PEP-8 rule. 2017-01-23 21:34:26 -08:00
Tim Abbott 9cc83f87fc lint: Clean up E241 PEP-8 rule. 2017-01-23 21:21:14 -08:00
Tim Abbott fe4f7b1170 lint: Clean up E711 PEP-8 rule. 2017-01-23 21:11:49 -08:00
Tim Abbott 9640a9e864 lint: Clean up E712 PEP-8 rule. 2017-01-23 21:11:18 -08:00
Tim Abbott e385b93448 lint: Clean up E713 PEP-8 rule. 2017-01-23 21:08:52 -08:00
Tim Abbott a088cdaa04 lint: Clean up E714 PEP-8 rule. 2017-01-23 21:07:45 -08:00
Tim Abbott d96f392147 lint: Clean up E741 PEP-8 rule. 2017-01-23 21:07:04 -08:00
Tim Abbott e5daec46ec lint: Clean up E306 PEP-8 rule. 2017-01-23 21:05:08 -08:00
Tim Abbott e3e92903eb lint: Document why E305 is turned off. 2017-01-23 21:03:46 -08:00
Tim Abbott e9158dd520 lint: Clean up E121 PEP-8 rule. 2017-01-23 21:02:39 -08:00
Tim Abbott 6f0d2a9445 lint: Clean up E115 PEP-8 rule. 2017-01-23 20:55:37 -08:00
Feorlen 378ac3abf3 Lint yaml files using text file rules.
Fixes #3404
2017-01-23 20:53:20 -08:00
Tim Abbott df3d6aee5d lint: Clean up E114 PEP-8 lint rule. 2017-01-23 20:52:58 -08:00
Tim Abbott 22d1aa396b lint: Clean up W503 PEP-8 warning. 2017-01-23 20:50:04 -08:00
Tim Abbott bde2da7dfd lint: clean up PEP-8 W391 rule. 2017-01-23 20:39:02 -08:00
Zev Benjamin f4d3cc6545 Annotate ignored pep8 rules to explain why they're ignored 2017-01-23 20:19:58 -08:00
Robert Hönig bef93959d3 Restructure converter bot.
Apply the new layout for 'contrib_bots' bots to the converter bot
to make it an exemplary model for new bots.
2017-01-22 05:42:46 -08:00
Robert Hönig 4415d6085f Restructure contrib_bots bots to new layout.
In order to make the layout of all bots consistent, this commit
moves each bot into a folder with its name and modifies 'run.py'
so that only bots with such a structure can be executed. 'lib'
gets renamed to 'bots'.
2017-01-22 05:42:46 -08:00
Rohith Asrk 9088c46e4c templates: Fix filename ending with .html.txt.
Fixes a part of #3136.
2017-01-21 22:44:13 -08:00
Tim Abbott aadf621466 test-backend: Only check for unrendered templates if tests passed. 2017-01-20 10:56:03 -08:00
Tim Abbott 1a536f381c lint: Fix some PEP-8 lint errors. 2017-01-19 16:42:50 -08:00
Tim Abbott d091691b3d lint: Require access_message to access Message objects. 2017-01-19 15:59:06 -08:00
Steve Howell 0ff2c5881e provision: Simplify messaging in tools/provision.
The script now outputs bullet points to the user when
it fails, and there are some basic comments at the top
of the file.  I also fixed the path of the log file.

Fixes #3230
2017-01-19 14:55:22 -08:00
Tim Abbott 286f640194 minify: Clean up unnecessary tuple/list complexity. 2017-01-19 14:51:16 -08:00
Tommy Ip 23a7685fa5 deps: Add option to skip minifying Javascript files.
Plotly.js take around 20 seconds to minify with the Closure
compiler so it is taken out.

Fixes #3076.
2017-01-19 14:31:38 -08:00
Sampriti Panda 6484af6854 tools: Fix regressions in tools/tests/test_html_branches.py 2017-01-19 08:02:34 -08:00
Tim Abbott 699d30b1eb provision: Ensure that stderr output isn't buffered badly.
Previously, if a script called by provision threw an error, the
traceback for the called script would be lost far above the traceback
from provision itself in the terminal history, resulting in a great
deal of confusion about what the actual problem was.
2017-01-17 14:28:10 -08:00
Robert Hönig 789ae8648a Add wrapper and log file output for provisioning.
Before this commit, provisioning was done by executing provision.py,
which printed the log directly to stdout, making debugging harder.
This commit creates a wrapper bash script 'provision' in tools, which
calls 'zulip/scripts/tools/provision_vm.py' (the new location of
provision.py) and prints all the output to
'zulip/var/log/zulip/zulip_provision.log' via 'tee'.
Travis tests and docs have been modified accordingly.
2017-01-17 14:23:28 -08:00
Tim Abbott 4f67b9802d travis: Use fixture for authors page in CI. 2017-01-17 13:42:37 -08:00
Tommy Ip c407919db3 Add /authors page.
Contributor visualization showing the avatar, user name and number
of commits for each contributors. The JSON data would be updated
upon deployment, triggered by the `update-prod-static` script.
2017-01-17 13:35:55 -08:00
Tim Abbott 747f66bfe1 docs: Add README.md files for scripts/ and tools/. 2017-01-17 11:01:27 -08:00
Steve Howell 7afb19e0d4 Add test driver for the API. 2017-01-16 21:12:39 -08:00
Steve Howell c6b2d531ef Extract tools/lib/test_server.py
This new module abstracts the setting up of a test
server for tests to run, pulling existing code from
casper and paving the way for API tests in the future.
2017-01-16 21:12:39 -08:00
hackerkid c55a0dd237 provision: Check for shell_profile files before creating them. 2017-01-16 19:58:01 -08:00
adnrs96 153ad18807 Lint for duplicate ids in templates.
In this commit we enhance our current template linter to detect
duplicate ids and report them during lint checks. html_branches.py
was topped up with a new function build_id_dict for the purpose.

Also the get_tag_info function in same file was updated to parse
ids and classes more robustly in cases of template variables.
split_for_id_and_class function was added to serve this purpose.

Unit tests for both the functions were created under
tests/test_html_branches. Also a directory under tests called
test_template_data was created to hold templates for testing under
newly created functionality.

check_templates was modified to print to console any duplicates
detected.
showell reviewed my commit and helped me out.

Fixes #2950.
2017-01-13 17:00:22 -08:00
hackerkid 510659d402 Add virtualenv activation in .zprofile. 2017-01-13 15:13:44 -08:00
Tim Abbott a64a1de023 lint: Be more permissive with Markdown links. 2017-01-12 16:42:51 -08:00
Steve Howell baef662dcb Add tools/review for reviewing PRs.
This script ensures you are starting on master in a pristine
state, and then it creates a branch called review-NNNN for
PR #NNNN in your local repo, along with some basic stats about
the PR.
2017-01-12 15:26:40 -08:00
Steve Howell 7bd16b3946 dev tools: Diagnose venv problems more clearly.
In tools/diagnose, we now catch an ImportError if
we cannot import django, and we instruct the
devloper about the mostly likely remedies.
2017-01-12 13:46:05 -08:00
Steve Howell 5ec0bc1213 Fix typing import in tools/diagnose. 2017-01-12 10:49:11 -08:00
K.Kanakhin aaf82ae090 documentation-crawler: Check images in help documentation.
This checks both that all images under static/images/help/ are used in
the help documentation, and also that none of the image tags are broken.

- Improve documentation spiders and crawler with spider error state.

Fixes #3070.
2017-01-12 10:02:32 -08:00
JefftheBest1 110398bf36 Fixed typos in test-queue-worker-reload 2017-01-12 04:51:27 -08:00
Tim Abbott 3f8d4193da lint: Fix % comprehensions being used without a tuple. 2017-01-09 11:45:11 -08:00
sinwar 3f350391ce docs: Ban the term realm from user documentation.
Fixes #3031.
2017-01-09 10:58:19 -08:00
Tim Abbott 3a64857a4c lint: Fix long lines not being treated as actual errors.
This led to Travis CI not reporting on line-too-long errors.
2017-01-08 22:48:27 -08:00
Tim Abbott b54f8b3b14 lint: Fix incorrect line length calculations in Python 2.
Previously, we would incorrectly be counting bytes in Python 2, which
meant lines with unicode characters in them appeared to the linter to
be far longer than they actually were.
2017-01-08 22:46:02 -08:00
Tommy Ip 89dc739856 tools: Fix bare except clause. 2017-01-08 16:22:21 -08:00
Tommy Ip e04afe9bda tools: Fix bare except clause. 2017-01-08 16:22:21 -08:00
Tim Abbott 24df5fbd97 Delete remains of deprecated inject-messages. 2017-01-07 10:53:20 -08:00
AZtheAsian 0dc9ac7dac Delete deprecated iframe-bot. 2017-01-07 10:53:20 -08:00
Tim Abbott e228243723 install-aws-server: Add support for installing zulip.conf. 2017-01-06 21:58:16 -08:00
Tim Abbott c6bdc2130b install-aws-server: secrets enhancements. 2017-01-06 21:57:20 -08:00
Tim Abbott ed0da5f874 install-aws-server: Fix usage output. 2017-01-06 21:57:20 -08:00
Tim Abbott 246bdbd829 update-prod-static: Fix node_modules/.bin being unavailable in prod.
Apparently `manage.py collectstatic` by default strips files starting
with "." from what it collects.  This is a reasonably precaution,
though mostly irrelevant to us, since Zulip primarily runs that as
part of build-release tarball, which runs in a clean directory.

It also breaks our current approach for transferring node_modules to
prod machines via release tarballs; this change fixes that bug.
2017-01-06 20:23:46 -08:00
Tim Abbott 7df44f2e87 minify-js: Auto-detect virtualenv when possible.
Usually, update-prod-static takes care of this, but it's useful for
debugging purposes to be able to rerun this manually.
2017-01-06 19:55:08 -08:00
Tim Abbott 3a3a1872e7 travis: Prevent upgrading oracle-java9-installer.
This fixes a minor performance problem, and also avoids errors when
Oracle's Java installer site is down.
2017-01-06 19:30:16 -08:00
Tim Abbott 0f50ef12f5 scripts: Fix path to install-node. 2017-01-06 16:48:18 -08:00
Tim Abbott e4b065e03a Move tools/setup/install-node to scripts/setup/. 2017-01-06 16:18:29 -08:00
Tim Abbott a39643da61 lint: Require space after likely ends of sentences in help. 2017-01-06 11:18:45 -08:00
Tim Abbott 1262db40ea lint: Check for invalid '!!! warning'. 2017-01-05 15:15:19 -08:00
Tim Abbott 8b839c96d4 lint: Check for long lines in all markdown files in general.
This has a few excludes for cases involving code blocks where it would
have been difficult to clean up.
2017-01-05 15:06:34 -08:00
Tim Abbott bc4a9ff722 lint: Enforce no lines longer than 120 characters in help docs.
This requires some somewhat messy changes to the all-streams macro.
2017-01-05 14:54:04 -08:00
AZtheAsian e8dafcd905 mypy: Add annotations to api/integrations/asana/zulip_asana_mirror. 2017-01-05 11:08:21 -08:00
ausDensk 059b124027 mypy: Annotate /api/integrations/rss/rss-bot.
With a few tweaks by tabbott.
2017-01-04 22:42:11 -08:00
Tim Abbott 0a6d960f37 emoji: Fix graphical artifacts of adjacent emoji in sprite sheet.
We didn't have any margin between the different emoji symbols
previously.
2017-01-04 17:12:23 -08:00
Steve Howell 8655472135 Use zproject.settings in tools/diagnose. 2017-01-04 08:48:54 -08:00
Steve Howell 7029917129 Add check_migrations() to tools/diagnose script. 2017-01-04 07:51:22 -08:00
Steve Howell cd16a26c9a Add check_venv() to tools/diagnose script. 2017-01-04 07:51:22 -08:00
Steve Howell 0fd9f23505 Add tools/diagnose script.
This script does a basic sanity check on a dev environment.
2017-01-04 07:51:22 -08:00
AZtheAsian c155b9162d mypy: Annotate api/integrations/codebase/zulip_codebase_mirror. 2017-01-03 20:23:06 -08:00
Jackson 98ca518461 mypy: Add annotations to api/integrations/basecamp/zulip_basecamp_mirror 2017-01-03 18:34:26 -08:00
Jackson 566d55b7c6 mypy: Annotate api/integrations/hg/zulip-changegroup.py 2017-01-03 11:44:43 -08:00
Rafid Aslam f897cc5a8b tests: Add --force option to `tools/test-all`
Fixes #2996.
2017-01-03 11:42:53 -08:00
Rafid Aslam fdaed99222 tests: Add `--force` option to `tools/test-help-documentation.py` 2017-01-03 11:42:53 -08:00
anirudhjain75 5f4a822655 mypy: Annotate zerver/tests/test_decorators.py. 2017-01-02 08:59:49 -08:00
Sampriti Panda 246ac7cadc mypy: Annotate api/integrations/twitter/twitter-search-bot 2017-01-02 08:01:37 -08:00
Jackson 88da3dea7e mypy: Annotate api/integrations/trac/zulip_trac.py 2016-12-30 20:05:14 -08:00
K.Kanakhin 0d8c18a6dd nagios-plugins: Add websocket checking to nagios message sending test.
- Add websocket client to create connection with SockJS websocket server.
  It contains callback method to launch after connection setup.
- Add '--websocket' parameter to 'check_send_receive_time' script to
  check websocket connection.
- Add testing  websocket connection to production installation checking.
- Add cronjob to launch websocket connection nagios test.

This makes it possible for Zulip Nagios monitoring to check for
problems impacting the websockets sending code path, which is what all
web users use.
2016-12-30 15:36:37 -08:00
Tommy Ip 29c291b981 mypy: Annotate *api/integrations/perforce/zulip_change-commit.py*. 2016-12-30 15:19:34 -08:00
Tim Abbott a0f3f3dfa0 lint: Forbid script tags in handlebars templates. 2016-12-30 12:43:56 -08:00
lonerz 3c1c65eaf8 mypy: Annotate api/integrations/twitter/twitter-bot 2016-12-30 11:40:45 -08:00
Rishi Gupta 52c18e9c9d run-dev: Change provisioning error messages to not reference tests.
Previously, we got the following as a part of the output when running
`tools/run-dev.py` without provisioning:

    It looks like you checked out a branch that has added
    dependencies beyond what you last provisioned.  Your tests
    are likely to fail until you add dependencies by provisioning.

which is a bit confusing.
2016-12-29 16:13:49 -08:00
Tommy Ip 7f187418d4 mypy: Annotate *api/integrations/nagios/nagios-notify-zulip*. 2016-12-28 15:44:47 -08:00
Steve Howell 178b3898d5 Add TODO to deprecated show-last-messages. 2016-12-28 15:17:24 -08:00
Tommy Ip 3d015eb259 mypy: Annotate *api/integrations/svn/post-commit*. 2016-12-28 08:54:53 -08:00
Tim Abbott 45324e08c1 bots: Fix jabber_mirror_backend annotations.
mypy was super confused because the name "zulip" was both an import
and a global variable in the file.
2016-12-27 21:39:32 -08:00
Tim Abbott 39f0ffdedd Move static/third/gemoji to static/generated/emoji.
Fixes #1153.
2016-12-27 20:16:23 -08:00
Tim Abbott 08dae5108e emoji: Move tools/setup/emoji_dump to tools/setup/emoji. 2016-12-27 19:58:41 -08:00
Tim Abbott 726e2649b4 lint: Run linters on settings.py files.
This finishes clearing unnecessarily excluded items from the global
tools/lint-all exclude list.  The remaining items are third-party code
or generated code that doesn't make sense to lint.

Fixes #822.
2016-12-27 19:53:44 -08:00
Tim Abbott d47ea7a608 lint: Add comments to EXCLUDED_FILES entries. 2016-12-27 19:48:43 -08:00
Tim Abbott f46d99ba85 lint: Remove zerver/migrations from main exclude list. 2016-12-27 19:45:33 -08:00
Tim Abbott ab89664d90 lint: Clean up main exclude list and move to pyflakes. 2016-12-27 19:45:33 -08:00
Tim Abbott 1c5e8cd47b lint: Check for spelling of organization and fix errors. 2016-12-27 17:25:01 -08:00
Tim Abbott cd7d8bfbea travis: Add test-help-documentation to CI for real.
75c4e3191d actually only added it to
`test-all`.
2016-12-26 16:17:42 -08:00
Steve Howell 680ff3f80c Remove mypy exemption for api/zulip/__init__.py.
This required instead exempting these files:

    bots/jabber_mirror_backend.py
    tools/deprecated/iframe-bot/show-last-messages

Turning on mypy for the API exposes issues in the annotations
of other files.
2016-12-21 11:22:42 -08:00
Steve Howell efc2d1a675 Simplify, document, and fix the API code.
We used to create endpoints with Client._register.

Now we now have explicit methods for the endpoints.

This allows us to add docstrings and stricter mypy annotations.

This fix also introduces a call_endpoint() method that avoids
the need for manually building urls with API_VERSTRING when you
know the URL pattern of the endpoint you want to hit (and when
the API doesn't have a convenient wrapper).

I fixed a bug with create_users where it now uses PUT instead
of POST.

I also removed client.export(), which was just broken.

I had to change recent-messages and zulip-export, which were
using client.do_api_query and Client._register.

Now it's easier to just call client.call_endpoint() for
situations where our API doesn't have convenient wrappers,
so that's what I did with those scripts.
2016-12-21 11:22:42 -08:00
K.Kanakhin e122dcab5c dev-proxy-logging: Add client ip transference to proxy server.
- Add rewriting 'X-REAL-IP' header for each request through dev
  proxy server.
- Change webpack configuration ip to 0.0.0.0 to fix socket.io build
  for launching remote dev server.
2016-12-21 17:18:02 +06:00
K.Kanakhin 4750d30341 dev-proxy-logging: Disable dev proxy logging by default.
- Add parameter to proxy launchig script, which enables logging
  for dev proxy server (disabled by default).
2016-12-21 17:18:02 +06:00
K.Kanakhin 75c4e3191d tests: Add help documentation checking script to CI 2016-12-19 08:31:39 -08:00
K.Kanakhin 589ae27190 documentation-crawler: Exclude privacy page from documentation checking 2016-12-19 08:31:39 -08:00
Sampriti Panda c0326d1938 Add lint rule to disallow python calls with versions (e.g: python2, python3)
Fixes #2435
2016-12-19 08:00:48 -08:00
Arpith Siromoney f144009c6d Change color of white emojis (1️⃣, 2️⃣, etc) to blue.
The following emojis are colored white (with a transparent background)
and are hard to read in the context of Zulip. This commit changes their
colors to blue. The emojis are:

hash, zero, one, two, three, four, five, six, seven, eight and nine.

This fixes #1969.
2016-12-16 09:46:37 -08:00
K.Kanakhin fa68a678cc help-documentation-tool: Add tools for checking user help documentation.
- Add spider for documentation crawler, which processes user help
  documentation on test development server.
- Add tool script for help documentation checking launching.

Fixes #2639
2016-12-16 09:04:04 -08:00
K.Kanakhin 2cbc7bb2c1 documentation-crawler: Create common spider for documentation checking.
Fixes #2639
2016-12-16 09:04:04 -08:00
Tomasz Kolek 34511065dc Fix tests problem with backward incompatible function name.
Add __init__ methods to some of testing clases with overriding method name.
2016-12-16 07:04:55 -08:00
Umair Khan 6c1d805495 travis: Fix production suite flakiness.
Previously, we were doing this request to the production server before
waiting for all the supervisord processes to start; it's possible this
could cause failures where we hit the server before the Django uwsgi
processes are up.

Hopefully fixes #2723.
2016-12-15 22:04:57 -08:00
Tim Abbott 81dbf8c80a lint: Enforce no external resources in CSS. 2016-12-15 22:02:10 -08:00
Tim Abbott bf80873d4f tests: s/assertRaisesRegexp/assertRaisesRegex/ due to deprecation. 2016-12-15 17:11:42 -08:00
Umair Khan d85e85c9eb linter: Add rule to check title attribute for i18n.
Fixes #2698
2016-12-15 13:44:13 -08:00
Umair Khan efccefc386 Upgrade to the latest Django release, 1.10.4.
Most of the changes to support this were merged some time ago; what
remains are these changes:

* Update requirements.txt
* Django 1.10: Upgrade success-http-headers.txt file.

- We no longer get the absolute urls, see
  https://docs.djangoproject.com/en/1.10/releases/1.9/#http-redirects-no-longer-forced-to-absolute-uris
- The headers are capitalized, previously, they were in upper case.

* Bump PROVISON_VERSION to 3.0 since this is a disruptive change.

Fixes #3.
2016-12-14 22:43:20 -08:00
reallyly 94b28e0afb pep8: Fix E128 violations.
With some line-wrapping tweaks by tabbott.
2016-12-13 10:50:14 -08:00
Tim Abbott 441c92e42f travis: Remove postgres-9.6 from production suite as well. 2016-12-12 10:12:08 -08:00
Steve Howell a119719b79 Make provision messaging more explicit.
Say "do this" when we want users to run `./tools/provision.py`.
2016-12-10 08:57:41 -08:00
Adarsh S 31be2534b3 Fix Error: templates have no tests! while running TemplateTestCase.
We need to test all the templates only when we are running the full
 test suite. While running just the Test Class we need not check all
 the templates.
2016-12-09 12:09:55 -08:00
Brock Whittaker 1886f0a015 redesign: Convert subscriptions page to overlay.
This is a major change to the /#subscriptions page, converting it to
by a side-by-side list of streams and their settings in an overlay.
There are no new features added/removed, but it's a huge changeset,
because it replaces the old navigation logic and moves the stream
creation modal to appear in the right side of this overlay.
2016-12-09 11:08:08 -08:00
Zac Pullar-Strecker 4eb6adf547 mypy: Annotate zerver/tests/test_narrow.py 2016-12-09 05:48:22 -08:00
Tim Abbott d2d404afcc travis: Remove npm cache in prod installation.
With this change in place, we would have been able to catch the bug
fixed in the last commit in CI.
2016-12-08 10:34:09 -08:00
Tim Abbott 8b77889f8a test-all: Run the pep8 linter by default. 2016-12-07 23:22:59 -08:00
anirudhjain75 beaa62cafa mypy: Convert several directories to use typing.Text.
Specifically, these directories are converted: [analytics/, scripts/,
tools/, zerver/management/, zilencer/, zproject/]
2016-12-07 20:51:05 -08:00
Tim Abbott 90f76c079d lint: Require space after headings in markdown. 2016-12-07 17:15:53 -08:00
Tim Abbott 279d160f99 lint-all: Fix markdown_whitespace_rules indentation. 2016-12-07 17:15:47 -08:00
anirudhjain75 4bb6735e77 Annotate zephyr_mirror_backend.py.
With some tweaks by tabbott to update tuple->Tuple and update comments.
2016-12-07 15:57:55 -08:00
Rafid Aslam ce94fb2eb1 deps: Change zxcvbn download method from download-zxcvbn to npm.
- Replace download-zxcvbn with downloading it from npm.
- Change zxcvbn.js path to node_modules (because npm put it to
`node_modules` directory.
- Bump `PROVISION_VERSION` in `version.py` to 2.4.

Fixes #2423.
2016-12-06 17:54:56 -08:00
Rafid Aslam 0951b838ca deps: Update zxcvbn to 4.4.1
Update zxcvbn to 4.4.1, and change `crack_time` to
`crack_times_seconds` because `crack_time` has been changed to
`crack_times_seconds` in 4.4.1.
2016-12-06 17:51:33 -08:00
Tudor Nazarie 5b22959f1c Annotate bots/jabber_mirror_backend.py 2016-12-06 09:52:08 -08:00
Tim Abbott 15bfedec99 travis: Improve debuggability of server wget failures.
The main improvement here is causing `wget` errors to be ignored so
that we see the server logs in the event of a `wget` failure.
2016-12-03 20:48:57 -08:00
Tim Abbott d5dd7a27d5 Remove tools/deprecated/inject-messages. 2016-12-03 16:58:17 -08:00
Tim Abbott 1a161c6e33 eslint: Fix comma-dangle rules in JS support files.
This was done via eslint --fix.
2016-12-03 15:00:24 -08:00
Joy Chen 77938f6247 mypy: Annotate *bots/githook-post-receive* 2016-12-03 15:58:22 -06:00
Jason Le 144d82305d mypy: Annotate puppet/zulip_ops. 2016-12-03 11:00:25 -08:00
bulat22101 a6f91064a2 pep8: Fix E129 violations 2016-12-03 10:56:36 -08:00
bulat22101 adebc75740 pep8: Fix E502 violations 2016-12-03 10:56:36 -08:00
Tim Abbott 8259adaba5 lint: Add custom lint check for console.log statements.
This was previously checked for by jslint, and eslint doesn't seem to
have a nice exclude rule for it.
2016-12-02 20:05:18 -08:00
kevv87 1fb9220354 lint: Remove old jslint linter.
Now that we're using eslint, jslint is no longer required.
2016-12-02 18:49:42 -08:00
Sidhant Bhavnani 8c0c12c1d9 pep8: Fix E303 violations. 2016-12-02 15:34:11 -08:00
Alex Huang 007b693cc7 pep8: Fix E131. 2016-12-01 23:16:47 -08:00
Alex Huang c8ddea16c3 pep8: Fix E122. 2016-12-01 23:16:35 -08:00
AZtheAsian 62494eeb97 pep8: fix E201 violations 2016-12-01 23:06:02 -08:00
AZtheAsian 7e14fe65ab pep8: fix E202 violations 2016-12-01 23:06:02 -08:00
AZtheAsian 1ba150fa85 pep8: Fix E203 violations 2016-12-01 20:37:57 -08:00
AZtheAsian c23f9e0df7 pep8: Fix E111 violations 2016-12-01 14:18:11 -08:00
AZtheAsian f7582f0050 pep8: Fix E124 violations 2016-12-01 14:18:11 -08:00
Tim Abbott 1a8a329b44 production-helper: Expand the apt-mark hold list. 2016-12-01 12:29:31 -08:00
Tim Abbott 87879c3916 travis: Workaround broken Travis CI java configuration.
Travis CI seems to have broken /usr/bin/java in a recent
infrastructure change.
2016-12-01 11:46:21 -08:00
Tim Abbott 0ac78ca454 setup-production: Fix path to update-prod-static.log.
This regressed in 55f2c49bbf.
2016-12-01 11:15:20 -08:00
Rafid Aslam c5316b4002 lint: Fix E127 pep8 violations.
Fix pep8: E127 continuation line over-indented for visual indent
style issue.
2016-12-01 10:23:55 -08:00
Tim Abbott fd81cc1d93 test-backend: Clarify missing template tests error message. 2016-12-01 10:12:38 -08:00
Vamshi Balanaga 5f60258a85 pep8: Fix E211 violations. 2016-11-30 20:13:10 -08:00
Bickio 6b0df43463 pep8: Fix E125. 2016-11-30 20:03:29 -08:00
Bickio e009383460 pep8: Fix E231. 2016-11-30 19:59:25 -08:00
Tim Abbott 995a692f7f provision: Check whether the system has at least 2GB of RAM.
Fixes #2336.
2016-11-30 16:07:57 -08:00
Tim Abbott e73ee5a4c4 test-backend: Fix count for templates without tests. 2016-11-30 15:38:19 -08:00
Tommy Ip e4091c6413 pep8: Fix E222 violations. 2016-11-30 21:49:02 +00:00
Tommy Ip 46b7d54b3e pep8: Fix E701 violations. 2016-11-30 20:45:09 +00:00
Heidi Dong ba7d4e7452 mypy: Annotate bots/gcal-bot. 2016-11-29 20:49:11 -08:00
Anders Kaseorg 6549dfd1d0 build-release-tarball: Add --py3 option for python3 shebang lines.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-29 17:45:18 -08:00
Tim Abbott 4f6a075331 test-backend: Fix missing output for untested templates.
Our enforcement logic for untested templates unfortunately did not
give a clear error message unless you passed the --verbose option.
2016-11-29 16:38:18 -08:00
Tommy Ip 844e32ccc5 tools: Remove deprecated generate-activity-metrics.py.
The script uses hardcoded hostnames that do not exist anymore,
its functionality is available through directly querying the Zulip
database.
2016-11-29 09:27:59 -08:00
Rafid Aslam 41bd88d5ed pep8: Fix E301 pep8 violations.
Fix "E301: expected (1 or 2) blank line" pep8 violations.
2016-11-29 08:51:44 -08:00
Rafid Aslam 7a2282986a pep8: Fix E225 pep8 violations. 2016-11-28 15:21:15 -08:00
sylvan1 443cf92640 mypy: Change Generator[None, None, None] to Iterator[None].
Fixes #1648.
2016-11-27 10:42:16 -08:00
Tim Abbott 1fcf2ff525 tornado: Move zerver.tornadoviews to zerver.tornado.views.
This furthers the overall goal of moving all the Tornado-specific code
to zerver/tornado/.
2016-11-26 22:29:28 -08:00
Tim Abbott 8739f4d9f1 tornado: Move tornado_ioloop_logging to new zerver/tornado tree. 2016-11-26 21:24:05 -08:00
Tim Abbott 92d1b6d6da run-dev: Fix regression ignoring --interface argument.
When we migrated run-dev.py from Twisted to Tornado a few weeks ago,
the --interface argument wasn't properly ported and thus was ignored.

This restores the original functionality of defaulting to only
listening on localhost.

Ideally, we'd replace the vagrant/zulipdev user check with something
that just checks whether a special file that is created by the
Vagrant/remote-dev-vm creation process exists; that would be more
robust.
2016-11-26 17:23:31 -08:00
Steve Howell 6ed1dc9341 Create api docs from url coverage data from tests.
I also retire tools/analyze-url-coverage in this commit,
since the API docs cover most of the functionality.
2016-11-26 14:49:23 -08:00
Anders Kaseorg 207cf6302b Always start python via shebang lines.
This is preparation for supporting using Python 3 in production.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-26 14:46:37 -08:00
Anders Kaseorg 1ea8abe493 Replace python -u with PYTHONUNBUFFERED=1
(Why is -u needed at all?  I’m not sure, but test-run-dev spins forever
“Polling run-dev...” without it.)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-26 13:20:22 -08:00
Arpith Siromoney f0df1db9fb tools: Remove tools/node and call node directly instead.
Previously, we didn't install/pin our own node.js version, and thus
had this wrapper script to manage it.  Now that install our own node
via nvm, there's no reason we still need this.

Fixes #2409.
2016-11-26 12:42:58 -08:00
Tim Abbott 25c6b9f586 pre-commit: Call lint-all with --force. 2016-11-26 12:30:16 -08:00
Steve Howell 8110c3f799 tools: Check provisioning version in lint-all. 2016-11-26 11:36:53 -08:00
Steve Howell 5f5e6b6d83 tests: Enforce 100% URL coverage.
We now instrument URL coverage whenever you run the back end tests,
and if you run the full suite and fail to test all endpoints, we
exit with a non-zero exit code and report failures to you.

If you are running just a subset of the test suite, you'll still
be able to see var/url_coverage.txt, which has some useful info.

With some tweaks to the output from tabbott.

Fixes #1441.
2016-11-18 18:10:29 -08:00
Tim Abbott 2abe11e209 lint-all: Fix progress bar from `npm run lint` in linter.
Also fixes printing the `eslint` help output in the event that there
are no files to check.

See https://github.com/zulip/zulip/pull/2246#issuecomment-261673662
for details on the original problem.
2016-11-18 16:19:05 -08:00
Arpith Siromoney 497c7702cc Run eslint in tools/lint-all with npm run --silent lint
This commit adds a basic eslintrc that emulates jslint defaults.
Rules that conflict with our existing code have been switched to
warnings instead of errors. Globals have been added to the eslintrc. The
bundled js file (generated by webpack) and blueslip.js are ignored with
.eslintignore.

To display warnings, run npm run lint-loud. This runs eslint without the
--quiet option on static/js and frontend_tests.

npm run --silent lint is run by tools/lint-all (in addition to jslint).
The --silent option is used to suppress the default output from npm run.

Fixes #535.
2016-11-18 16:15:45 -08:00
Vladislav Manchev d7e1e4a2c0 Add initial implementation of custom realm filters.
This PR was abandoned by Vladislav and then substantially modified by
Igor Tokarev and Tim Abbott to complete it and fix a number of bugs.

Fixes #544.
2016-11-17 17:11:25 -08:00
paxapy 012ec2beda test-backend: Use a fixed whitelist of shallow-tested templates.
This enforces the requirement that all templates not on this list are
tested.  Part of #1677.
2016-11-17 11:34:50 -08:00
Pweaver (Paul Weaver) 059cd1e7aa tests: enable the pep8 linter in travis CI. 2016-11-17 00:11:00 -08:00
Pweaver (Paul Weaver) 8f05ea877d lint: Fix pep8 linter error regressions.
Since `lint-all --pep8` wasn't running in CI, a few errors have leaked
in.
2016-11-17 00:09:21 -08:00
Christie Koehler 391ff638d5 build_emoji: Add nice error message for symlink errors. 2016-11-15 21:10:39 -08:00
Christie Koehler 2488698430 provision: Add symlink creation check.
This helps automatically detect a common issue where users try to use
the Vagrant development environment on windows without administrator
permissions, which results in errors trying to create symlinks.
2016-11-15 21:10:39 -08:00
Tomasz Kolek 2335e1b8b9 Add escaping charactes (=,>,<) by checking correct spelling of GitHub word 2016-11-15 10:48:12 -08:00
Brock Whittaker 75db036733 Add toggle component.
This adds the toggle component which removes the necessity to have HTML.
2016-11-15 10:20:37 -08:00
Steve Howell 59750a1cb9 Move more unread logic out of stream_list.js.
There are two split-outs code of the code here:

    - Animation stuff is in unread_ui.js.
    - PM unread counts get handled by pm_list.js.
2016-11-14 17:50:55 -08:00
Umair Khan 3d3800314f Django 1.10: Setup django before running queue processors. 2016-11-14 16:09:12 -08:00
Steve Howell 7b0c6459b4 Extract static/js/pm_list.js.
This handles most of the details of building the Private Messages
section in the upper left corner of the app.
2016-11-11 12:12:13 -08:00