Fix minor errors and improve flow of text

This commit is contained in:
Claire Cavanaugh 2016-07-31 21:43:54 -07:00
parent 57f256e80d
commit f261490dab

View File

@ -11,9 +11,9 @@ This document contains guidelines for contributing to qutebrowser, as well as
useful hints when doing so. useful hints when doing so.
If anything mentioned here would prevent you from contributing, please let me If anything mentioned here would prevent you from contributing, please let me
know, and contribute anyways! The guidelines are only meant to make life easier know, and contribute anyways! The guidelines are meant to make life easier for
for me, but if you don't follow anything in here, I won't be mad at you. I will me, but if you don't follow everything in here, I won't be mad at you. In
probably change it for you then, though. fact, I will probably change it for you.
If you have any problems, I'm more than happy to help! You can get help in If you have any problems, I'm more than happy to help! You can get help in
several ways: several ways:
@ -44,7 +44,7 @@ require little/no coding]
There are also some things to do if you don't want to write code: There are also some things to do if you don't want to write code:
* Help the community, e.g. on the mailinglist and the IRC channel. * Help the community, e.g., on the mailinglist and the IRC channel.
* Improve the documentation. * Improve the documentation.
* Help on the website and graphics (logo, etc.). * Help on the website and graphics (logo, etc.).
@ -60,7 +60,7 @@ git clone https://github.com/The-Compiler/qutebrowser.git
If you don't know git, a http://git-scm.com/[git cheatsheet] might come in If you don't know git, a http://git-scm.com/[git cheatsheet] might come in
handy. Of course, if using git is the issue which prevents you from handy. Of course, if using git is the issue which prevents you from
contributing, feel free to send normal patches instead, e.g. generated via contributing, feel free to send normal patches instead, e.g., generated via
`diff -Nur`. `diff -Nur`.
Getting patches Getting patches
@ -77,7 +77,7 @@ based on your changes like this:
---- ----
git format-patch origin/master <1> git format-patch origin/master <1>
---- ----
<1> Replace `master` by the branch your work was based on, e.g. <1> Replace `master` by the branch your work was based on, e.g.,
`origin/develop`. `origin/develop`.
Useful utilities Useful utilities
@ -89,7 +89,7 @@ Checkers
qutebrowser uses http://tox.readthedocs.org/en/latest/[tox] to run its qutebrowser uses http://tox.readthedocs.org/en/latest/[tox] to run its
unittests and several linters/checkers. unittests and several linters/checkers.
Currently, following tox environments are available: Currently, the following tox environments are available:
* Tests using https://www.pytest.org[pytest]: * Tests using https://www.pytest.org[pytest]:
- `py34`: Run pytest for python-3.4. - `py34`: Run pytest for python-3.4.
@ -117,18 +117,18 @@ Currently, following tox environments are available:
- VCS conflict markers - VCS conflict markers
- common spelling mistakes - common spelling mistakes
The default test suite is run with `tox`, the list of default The default test suite is run with `tox`; the list of default
environments is obtained with `tox -l` . environments is obtained with `tox -l`.
Please make sure the checks run without any warnings on your new contributions. Please make sure the checks run without any warnings on your new contributions.
There's of course the possibility of false-positives, and the following There's always the possibility of false positives; the following
techniques are useful to handle these: techniques are useful to handle these:
* Use `_foo` for unused parameters, with `foo` being a descriptive name. Using * Use `_foo` for unused parameters, with `foo` being a descriptive name. Using
`_` is discouraged. `_` is discouraged.
* If you think you have a good reason to suppress a message, add the following * If you think you have a good reason to suppress a message, then add the
comment: following comment:
+ +
---- ----
# pylint: disable=message-name # pylint: disable=message-name
@ -186,10 +186,10 @@ the output in four different ways:
Debugging Debugging
~~~~~~~~~ ~~~~~~~~~
In the `qutebrowser.utils.debug` module there are some useful functions for There are some useful functions for debugging in the `qutebrowser.utils.debug`
debugging. module.
When starting qutebrowser with the `--debug` flag you also get useful debug When starting qutebrowser with the `--debug` flag, you also get useful debug
logs. You can add +--logfilter _category[,category,...]_+ to restrict logging logs. You can add +--logfilter _category[,category,...]_+ to restrict logging
to the given categories. to the given categories.
@ -276,8 +276,8 @@ Hints
Python and Qt objects Python and Qt objects
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
For many tasks, there are solutions in both Qt and the Python standard library For many tasks, there are solutions available in both Qt and the Python
available. standard library available.
In qutebrowser, the policy is usually using the Python libraries, as they In qutebrowser, the policy is usually using the Python libraries, as they
provide exceptions and other benefits. provide exceptions and other benefits.
@ -292,7 +292,7 @@ slots.
When using Qt objects, two issues must be taken care of: When using Qt objects, two issues must be taken care of:
* Methods of Qt objects report their status by using their return values, * Methods of Qt objects report their status with their return values,
instead of using exceptions. instead of using exceptions.
+ +
If a function gets or returns a Qt object which has an `.isValid()` If a function gets or returns a Qt object which has an `.isValid()`
@ -304,13 +304,12 @@ on all such objects. It will raise
If a function returns something else on error, the return value should If a function returns something else on error, the return value should
carefully be checked. carefully be checked.
* Methods of Qt objects have certain maximum values, based on their * Methods of Qt objects have certain maximum values based on their
underlying C++ types. underlying C++ types.
+ +
When passing a numeric parameter to a Qt function, all numbers should To avoid passing too large of a numeric parameter to a Qt function, all
be range-checked using `qutebrowser.qtutils.check_overflow`, or numbers should be range-checked using `qutebrowser.qtutils.check_overflow`,
passing a value which is too large should be avoided by other means or by other means (e.g. by setting a maximum value for a config object).
(e.g. by setting a maximum value for a config object).
[[object-registry]] [[object-registry]]
The object registry The object registry
@ -339,8 +338,8 @@ window=_win-id_, tab=_tab-id_])+. The default scope is `global`.
All objects can be printed by starting with the `--debug` flag and using the All objects can be printed by starting with the `--debug` flag and using the
`:debug-all-objects` command. `:debug-all-objects` command.
The registry is mainly used for <<commands,command handlers>> but also can be The registry is mainly used for <<commands,command handlers>>, but it can
useful in places where using Qt's also be useful in places where using Qt's
http://doc.qt.io/qt-5/signalsandslots.html[signals and slots] mechanism would http://doc.qt.io/qt-5/signalsandslots.html[signals and slots] mechanism would
be difficult. be difficult.
@ -350,7 +349,7 @@ Logging
Logging is used at various places throughout the qutebrowser code. If you add a Logging is used at various places throughout the qutebrowser code. If you add a
new feature, you should also add some strategic debug logging. new feature, you should also add some strategic debug logging.
Unless other Python projects, qutebrowser doesn't use a logger per file, Unlike other Python projects, qutebrowser doesn't use a logger per file,
instead it uses custom-named loggers. instead it uses custom-named loggers.
The existing loggers are defined in `qutebrowser.utils.log`. If your feature The existing loggers are defined in `qutebrowser.utils.log`. If your feature
@ -413,11 +412,11 @@ selects which object registry (global, per-tab, etc.) to use. See the
<<object-registry,object registry>> section for details. <<object-registry,object registry>> section for details.
There are also other arguments to customize the way the command is There are also other arguments to customize the way the command is
registered, see the class documentation for `register` in registered; see the class documentation for `register` in
`qutebrowser.commands.cmdutils` for details. `qutebrowser.commands.cmdutils` for details.
The types of the function arguments are inferred based on their default values, The types of the function arguments are inferred based on their default values,
e.g. an argument `foo=True` will be converted to a flag `-f`/`--foo` in e.g., an argument `foo=True` will be converted to a flag `-f`/`--foo` in
qutebrowser's commandline. qutebrowser's commandline.
The type can be overridden using Python's The type can be overridden using Python's
@ -435,11 +434,11 @@ Possible values:
value. value.
- A python enum type: All members of the enum are possible values. - A python enum type: All members of the enum are possible values.
- A `typing.Union` of multiple types above: Any of these types are valid - A `typing.Union` of multiple types above: Any of these types are valid
values, e.g. `typing.Union[str, int]` values, e.g., `typing.Union[str, int]`
You can customize how an argument is handled using the `@cmdutils.argument` You can customize how an argument is handled using the `@cmdutils.argument`
decorator *after* `@cmdutils.register`. This can e.g. be used to customize the decorator *after* `@cmdutils.register`. This can, for example, be used to
flag an argument should get: customize the flag an argument should get:
[source,python] [source,python]
---- ----
@ -482,13 +481,13 @@ qutebrowser handles two different types of URLs: URLs as a string, and URLs as
the Qt `QUrl` type. As this can get confusing quickly, please follow the the Qt `QUrl` type. As this can get confusing quickly, please follow the
following guidelines: following guidelines:
* Convert a string to a QUrl object as early as possible, i.e. directly after * Convert a string to a QUrl object as early as possible, i.e., directly after
the user did enter it. the user did enter it.
- Use `utils.urlutils.fuzzy_url` if the URL is entered by the user - Use `utils.urlutils.fuzzy_url` if the URL is entered by the user
somewhere. somewhere.
- Be sure you handle `utils.urlutils.FuzzyError` and display an error - Be sure you handle `utils.urlutils.FuzzyError` and display an error
message to the user. message to the user.
* Convert a `QUrl` object to a string as late as possible, e.g. before * Convert a `QUrl` object to a string as late as possible, i.e., before
displaying it to the user. displaying it to the user.
- If you want to display the URL to the user, use `url.toDisplayString()` - If you want to display the URL to the user, use `url.toDisplayString()`
so password information is removed. so password information is removed.
@ -514,8 +513,8 @@ This is needed so valgrind handles self-modifying code correctly:
[quote] [quote]
____ ____
This option controls Valgrind's detection of self-modifying code. If no This option controls Valgrind's detection of self-modifying code. If no
checking is done, if a program executes some code, then overwrites it with new checking is done and a program executes some code, overwrites it with new
code, and executes the new code, Valgrind will continue to execute the code, and then executes the new code, Valgrind will continue to execute the
translations it made for the old code. This will likely lead to incorrect translations it made for the old code. This will likely lead to incorrect
behavior and/or crashes. behavior and/or crashes.