From 8b839c96d47c01d50f94ffa46f3ffc8e203b518b Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 5 Jan 2017 15:06:34 -0800 Subject: [PATCH] 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. --- docs/dev-setup-non-vagrant.md | 4 +++- docs/new-feature-tutorial.md | 4 +++- docs/prod-postgres.md | 3 ++- docs/roadmap.md | 9 ++++++--- docs/writing-views.md | 9 ++++++--- tools/lint-all | 14 +++++++++++++- 6 files changed, 33 insertions(+), 10 deletions(-) diff --git a/docs/dev-setup-non-vagrant.md b/docs/dev-setup-non-vagrant.md index ff11aaf63a..dfc0957762 100644 --- a/docs/dev-setup-non-vagrant.md +++ b/docs/dev-setup-non-vagrant.md @@ -111,7 +111,9 @@ git](https://github.com/zulip/tsearch_extras). Now continue with the [All Systems](#all-systems) instructions below. -#### Using the [official Zulip PPA](https://launchpad.net/~tabbott/+archive/ubuntu/zulip/+packages) (for 14.04 Trusty or 16.04 Xenial): +#### Using the [official Zulip PPA][zulip-ppa] (for 14.04 Trusty or 16.04 Xenial): + +[zulip-ppa]: https://launchpad.net/~tabbott/+archive/ubuntu/zulip/+packages Start by cloning this repository: `git clone https://github.com/zulip/zulip.git` diff --git a/docs/new-feature-tutorial.md b/docs/new-feature-tutorial.md index f9ed3305ff..2dff51418b 100644 --- a/docs/new-feature-tutorial.md +++ b/docs/new-feature-tutorial.md @@ -102,7 +102,9 @@ Create the migration file: `./manage.py makemigrations`. Make sure to commit the generated file to git: `git add zerver/migrations/NNNN_realm_invite_by_admins_only.py` (NNNN is a number that is equal to the number of migrations.) -If you run into problems, the [Django migration documentation](https://docs.djangoproject.com/en/1.8/topics/migrations/) is helpful. +If you run into problems, the +[Django migration documentation](https://docs.djangoproject.com/en/1.8/topics/migrations/) +is helpful. ### Test your migration changes diff --git a/docs/prod-postgres.md b/docs/prod-postgres.md index 94759c1cc0..d01e68d747 100644 --- a/docs/prod-postgres.md +++ b/docs/prod-postgres.md @@ -116,7 +116,8 @@ won't find any information there. pg_ctlcluster runs the following command underneath when it actually goes to start Postgres: ``` -/usr/lib/postgresql/9.1/bin/pg_ctl start -D /var/lib/postgresql/9.1/main -s -o '-c config_file="/etc/postgresql/9.1/main/postgresql.conf"' +/usr/lib/postgresql/9.1/bin/pg_ctl start -D /var/lib/postgresql/9.1/main -s -o \ + '-c config_file="/etc/postgresql/9.1/main/postgresql.conf"' ``` Since pg_ctl doesn't redirect stdout or stderr, running the above can diff --git a/docs/roadmap.md b/docs/roadmap.md index 01e69397fa..76c7f69a88 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -77,7 +77,8 @@ the end of 2016. "reactions"](https://github.com/zulip/zulip/issues/541) * [Open graph previews of generic websites](https://github.com/zulip/zulip/issues/406) -* [Add a "join Zulip chat" badge for projects that use Zulip to document that nicely](https://github.com/zulip/zulip/issues/2270) +* [Add a "join Zulip chat" badge for projects that use Zulip to + document that nicely](https://github.com/zulip/zulip/issues/2270) ## Real-time sync @@ -217,8 +218,10 @@ process and make bots that receive messages just as easy to build. * [Add an outgoing webhook integration system](https://github.com/zulip/zulip/issues/735) * [Make setting up a new integration a smooth flow](https://github.com/zulip/zulip/issues/692) -* [Default new incoming webhooks to permissions-limited incoming webhook bots](https://github.com/zulip/zulip/issues/2186) -* [Change how Zulip displays bot names to distinguish them from human users](https://github.com/zulip/zulip/issues/1107) +* [Default new incoming webhooks to permissions-limited incoming webhook + bots](https://github.com/zulip/zulip/issues/2186) +* [Change how Zulip displays bot names to distinguish them from human + users](https://github.com/zulip/zulip/issues/1107) ## Android app diff --git a/docs/writing-views.md b/docs/writing-views.md index f9658cdcf8..230eef7d91 100644 --- a/docs/writing-views.md +++ b/docs/writing-views.md @@ -87,8 +87,8 @@ redirects the browser to a login page. This is used in the root path (`/`) of the website for the web client. If a request comes from a browser without a valid session cookie, they are redirected to a login page. It is a small fork of Django's -[login_required](https://docs.djangoproject.com/en/1.8/topics/auth/default/#django.contrib.auth.decorators.login_required), -adding a few extra checks specific to Zulip. +[login_required][login-required-link], adding a few extra checks +specific to Zulip. ```py @zulip_login_required @@ -96,6 +96,8 @@ def home(request): # type: (HttpRequest) -> HttpResponse ``` +[login-required-link]: https://docs.djangoproject.com/en/1.8/topics/auth/default/#django.contrib.auth.decorators.login_required + ### Writing a template Templates for the main website are found in @@ -109,7 +111,8 @@ request bodies, and return JSON-string responses. Almost all Zulip view code is in the implementations of API REST endpoints. The REST API does authentication of the user through `rest_dispatch`, -which is documented in detail at [zerver/lib/rest.py](https://github.com/zulip/zulip/blob/master/zerver/lib/rest.py). +which is documented in detail at +[zerver/lib/rest.py](https://github.com/zulip/zulip/blob/master/zerver/lib/rest.py). This method will authenticate the user either through a session token from a cookie on the browser, or from a base64 encoded `email:api-key` string given via HTTP Basic Auth for API clients. diff --git a/tools/lint-all b/tools/lint-all index 92483aed10..e0859d9983 100755 --- a/tools/lint-all +++ b/tools/lint-all @@ -159,6 +159,7 @@ def build_custom_checkers(by_lang): traceback.print_exc() if (max_length is not None and len(line) > max_length and '# type' not in line and 'test' not in fn and 'example' not in fn and + not re.match("\[[a-z0-9_-]*\]: http.*", line) and "#ignorelongline" not in line and 'migrations' not in fn): print("Line too long (%s) at %s line %s: %s" % (len(line), fn, i+1, line_newline_stripped)) lastLine = line @@ -435,9 +436,20 @@ def build_custom_checkers(by_lang): if custom_check_file(fn, json_rules): failed = True + markdown_docs_length_exclude = { + "contrib_bots/lib/ConverterBot/docs.md", + "docs/bots-guide.md", + "docs/dev-env-first-time-contributors.md", + "docs/integration-guide.md", + "docs/life-of-a-request.md", + "docs/logging.md", + "docs/migration-renumbering.md", + "docs/readme-symlink.md", + "README.md", + } for fn in by_lang['md']: max_length = None - if '/help/' in fn: + if fn not in markdown_docs_length_exclude: max_length = 120 if custom_check_file(fn, markdown_rules, max_length=max_length): failed = True