Commit Graph

1709 Commits

Author SHA1 Message Date
Steve Howell c0a6038a95 css: Enforce one selector per line.
While it's sometimes nice to put a few selectors on the same line,
it is generally better to have a consistent way of formatting our
selectors, and most of our code up until now lists them vertically.
This change fixes the linter to enforce one selector per line, and
it cleans up the places in the CSS where we had multiple selectors
on the same line.

The advantages of one-per-line are as followers:
    * cleaner diffs
    * easier to see when multiple areas of the app may have the
      same format
    * less likely to go over 80 cols
    * makes it more clear where we have deep nesting in the
      individual selectors
    * makes it easier for our linting tools to enforce
      whitespace violations

This also fixed an old bug where we had ".landing_page h2, h4", which
sets "h4" styles outside of the landing page.
2017-03-26 16:57:33 -07:00
Steve Howell 3d76088f59 tools: Make CSS style more consistent with opening brace.
We now always put the opening brace of a CSS section on
the same line as the last selector (with a space in front).
2017-03-26 16:57:33 -07:00
Tim Abbott 36bb2bf54a AdminZulipHandler: Bring logging_handlers.py to 100% test coverage.
This involved fixing some unupdated code in one code path.
2017-03-26 13:10:43 -07:00
Rishi Gupta b416587aab Change sender_domain to sender_realm_str in message dict. 2017-03-25 19:50:24 -07:00
Tim Abbott c7f1a7aa19 test_script: Use LooseVersion for version conparisons.
Fixes #4292.
2017-03-25 19:49:03 -07:00
Elliott Jin 98ddb4453e test-backend: Raise zerver/views/home.py test coverage to 100%. 2017-03-25 18:16:16 -07:00
Elliott Jin 1c0d58f897 test-backend: Raise zerver/views/auth.py test coverage to 100%. 2017-03-25 18:16:16 -07:00
Tim Abbott 3617ebfd41 api: Rename get_old_messages to get_messages in the backend.
Fixes #1315.
2017-03-23 23:52:44 -07:00
wizsid11 95789eb879 Add Slack webhook.
Adds a new webhook integration for Slack to receive messages
from one's Slack team's public channels.
Contains negative tests for broken, missing or invalid data.

Allows two different option for integration:
1. Receive notification on a single stream with different topics
for each of Slack's public channels.
2. Receive notification on different streams for each of Slack's
public channels.

Steps to choose between the two options is described in the documentation.

Fixes #3569.
2017-03-23 23:32:38 -07:00
Tim Abbott a6ae546f59 test_events: Bring zerver/lib/events.py to 100% coverage. 2017-03-23 22:43:10 -07:00
Tim Abbott eb19a25aba events: Fix races in stream creation event and add tests.
This fixes 2 issues:
* Being added to an invite_only stream did not correctly update the
  "streams" key of the initial state.

* Once that's resolved, subscribe_to_stream when called on a
  nonexistant stream would both send a "create" event (from
  create_stream_if_needed) and an "occupy" event (from
  bulk_add_subscriptions).

  The second event should just be suppressed in that case, and this
  implements that suppression.
2017-03-23 22:43:09 -07:00
Umair Khan 2d4a1f93ff testing: Bring zproject.backends coverage to 100%. 2017-03-23 17:12:58 -07:00
Tim Abbott debb00b190 lint: Fix get_stream lint error in actions.py. 2017-03-23 15:50:33 -07:00
Tim Abbott 06492738b5 dev: Expose coverage and built documentation to web.
This makes it much more convenient for developers to access coverage
and built developer documentation.
2017-03-23 13:10:06 -07:00
Umair Khan 0fc946aef4 testing: Add reverse option to test runner. 2017-03-22 12:07:21 -07:00
Umair Khan 2f243d8808 testing: Control parallelism through cmd args. 2017-03-22 11:59:30 -07:00
Steve Howell 8c0a1bddb0 linter: Deprecate ui.report_success/error(). 2017-03-22 06:57:23 -07:00
Eeshan Garg b8f71c5d24 Document how to set up an Asana integration via Zapier.
Fixes #3948.
2017-03-21 19:56:47 -07:00
Yago González 34a9e1ae11 markdown: Add TeX typesetting support.
Co-authored-by: Reid Barton <rwbarton@gmail.com>

Fixes #2056.
2017-03-21 16:40:00 -07:00
adnrs96 b3cbb13a79 linter: Add support for automatic checking for 4 space indents in CSS.
In this commit we modify our CSS parser not only to render the text from
a given CSS tokens produced but also enforce 4 space indentation on it.
Also we enforce some basic rules we would like our CSS to follow such as
* Always have "\n" in between the starting of body({) and body itself
  and ending of the body and the closing of body(}).
* Use 4 space indents while having but something within the block
  structure ( { .... } ).
* Have single space after ',' in between multiple selectors.
* Have only a single space in between selector and the starting of
  block structure ({ ... }) if block structure starts on same line as
  of selector.
  eg. body {
          body content here
      }
  Notice single space between 'body' and '{'.

Fixes: #1659.
2017-03-21 13:40:05 -07:00
adnrs96 a91012bd70 Move thirdparty-fonts.css from static/styles to static/third. 2017-03-21 13:40:05 -07:00
Umair Khan a2aeddba6b testing: Add infrastructure for running backend tests in parallel.
This doesn't yet provide an option to actually run the backend tests
parallelized yet.
2017-03-21 10:59:12 -07:00
Steve Howell 36b29a966e Add roadmap feature to js-dep-visualizer.
The js-dep-visualizer tool now attempts to find a set of edges
to remove from a call graph that would reduce it to having only
trivial mutual dependencies, and it produces a roadmap of the
changes that need to happen.

If the tool can't reduce the graph all the way, it still produces
a DOT file that can be visualized.

This fix also has some significant code cleanup.
2017-03-21 07:39:30 -07:00
Umair Khan 38572311f9 linter: Add a rule to check render_to_response. 2017-03-20 07:54:28 -07:00
Tim Abbott 24c2e62ae1 capitalization: Add exception for selected message.
This fixes a test that's been failing overnight.
2017-03-20 07:52:58 -07:00
Yago González df94719707 lint: Ban redundant linkified URLs. 2017-03-19 22:46:25 -07:00
Steve Howell edb8b0cb5e Improve js-dep-visualizer.
This adds a report of nodes, handles some errors better, adds
some helpful output, cleans up some abspath calls, and
updates which modules and/or dependencies we temporarily are
ignoring for the report.
2017-03-19 21:03:45 -07:00
Tim Abbott 9866124b78 mypy: Fix some new errors flagged by latest mypy master.
Mostly list -> List bugs in annotations.
2017-03-19 21:03:45 -07:00
Elliott Jin 356f57c831 refactor: Simplify pattern for adding external linters. 2017-03-19 14:13:38 -07:00
Elliott Jin ac488fd45f tools: Don't lint in pre-commit hook if no files changed. 2017-03-19 14:13:38 -07:00
Elliott Jin 5ada385b91 refactor: Check for empty list with `len(X) == 0` instead of `not X`. 2017-03-19 14:13:38 -07:00
Elliott Jin 750769f637 tools: Only lint changed template files in pre-commit hook. 2017-03-19 14:13:38 -07:00
Elliott Jin 2e246a936f tools: Support checking specific files in `check-templates`. 2017-03-19 14:13:38 -07:00
Elliott Jin 357e1a001f refactor: Move `check-templates` argument parsing to top level. 2017-03-19 14:13:38 -07:00
Elliott Jin 0d677042e7 tools: Remove assert in template linter.
Currently, in the case where `--modified` is not passed, the linter asserts
that it's checking at least 10 files.  Removing this (somewhat arbitrary)
check makes it easier to:

- Add support for specifying files to check via command line arguments
- Reason about cases where `check-templates` is called from `lint-all`
2017-03-19 14:13:38 -07:00
Elliott Jin bdf4b22772 tools: Only lint changed css files in pre-commit hook. 2017-03-19 11:49:19 -07:00
Elliott Jin ac5b62359a refactor: Use consistent naming for lint functions. 2017-03-19 11:49:19 -07:00
Steve Howell 6f3f031791 Make visualizer tool scan each file just once.
Rather than having a bunch of regexes to look for, we just
have a single regex for a function call.  And now we process
line by line, which allows us to more easily ignore comments.
2017-03-19 06:25:10 -07:00
Elliott Jin 1138057209 test-backend: Raise zerver/views/registration.py test coverage to 100%. 2017-03-18 18:11:59 -07:00
Steve Howell 16a37754cf Add recipient() and composing() shims. 2017-03-18 15:52:50 -07:00
Tim Abbott ecea8c2d43 run-dev: Fix missing type annotation. 2017-03-17 21:03:35 -07:00
Steve Howell 623a486c5c tools: Extract is_exterior_node(). 2017-03-17 20:53:27 -07:00
Steve Howell 758ff2e756 Exclude more nodes/edges from our JS visualization.
This also provides a roadmap for how to break some dependencies.
2017-03-17 20:53:02 -07:00
Tim Abbott 25488b550f casper: Fix issues with server autoreloading on save.
This fixes an issue where if you saved a Python file (even just
changing whitespace) while casper tests were running, the Tornado
server being used would restart, triggering a confusing error like
this:

ReferenceError: Can't find variable: $
Traceback:
  undefined:2
  :4
Suite explicitly interrupted without any message given.
2017-03-17 20:45:07 -07:00
Tim Abbott af8732fd42 py3: Remove unnecesary use of filter. 2017-03-17 20:30:22 -07:00
Tommy Ip da49db0201 Create tools/js-dep-visualizer.py.
This tools lets us view circular dependencies in our JS
code.  It does regex parsing, so it has a few false positives,
but it's an early draft of the tools.  Steve Howell helped
with this commit.
2017-03-17 16:09:21 -07:00
Steve Howell e04a9d38b5 Add tools/lib/graph.py.
This library helps us produce nice graphs for documentation.
2017-03-17 16:00:50 -07:00
Tim Abbott 497b24d7a6 lint: Ban use of i18n.t in portico js. 2017-03-17 14:14:54 -07:00
Tim Abbott 5db3f60c7d travis: Temporarily disable failing Nagios tests.
Apparently Travis CI has a very strange issue today that causes our
Nagios/E2E tests to have Tornado failing to connect to RabbitMQ.
Causes unknown, but I've spent a day trying to debug this without
luck, and we need our test suites passing in the meantime.
2017-03-15 22:01:04 -07:00
Rishi Gupta 40fb6ea80e lint: Prevent importing from zerver in migrations. 2017-03-15 12:02:24 -07:00