Commit Graph

15 Commits

Author SHA1 Message Date
Oleh Prypin
4710d73999 Apply rules to docstrings 2023-10-16 22:41:10 +02:00
Oleh Prypin
b6ff158d9a Don't abort mkdocs serve for build errors during rebuilds (#3255) 2023-06-12 12:02:18 +02:00
Oleh Prypin
00a71ba0be Move more documentation from Markdown into docstrings 2022-09-18 16:39:20 +02:00
Oleh Prypin
df3739d519 Add a lot more type annotations, fix new type warnings (#2970)
(including some behavior changes, assumed to be no-op)

This is based on auto-generated annotations from "monkeytype".
2022-09-07 18:04:39 +02:00
Oleh Prypin
5f5ba07db8 from __future__ import annotations everywhere 2022-08-23 21:29:53 +02:00
Oleh Prypin
dca7cbb43f Format code with black -l100 --skip-string-normalization 2022-08-07 20:25:34 +02:00
Waylan Limberg
6a694fd87b Refactor Logging and Error handling
Provide for better reporting to users, make for easier maintenance going forward, and allow future expandability. The following major changes were made:

1. The logging config is now defined in a way which will allow future expandability. For example, we could add additional levels of `strict` or `verbosity` (see  #1756) . All log messages are fed to a single log, which has two handlers (one for strict mode and one for verbosity). All level restrictions are defined per handler so that one restriction does not interfere with another. As filters do not have a level assigned to them, the previous count filter is now a nullhandler which counts all messages is receives (restricted only by level). The previous filter still exists (as a do-nothing instance) for any third-party plugins which called it. Those plugins should remove the call going forward.
2. A new exception `mkdocs.exceptions.Abort` was added. Rather than calling `SystemExit`, we now call `Abort`, which is a custom `click` exception that aborts with a readable error message and no traceback. Where appropriate, we catch errors, log them, and then call `Abort`. This allows us to remove all error handling from the CLI code and include it where errors originate from. Of course, as previously, unanticipated errors will still generate a traceback to allow debugging.
3. Log formatting has been improved. All log messages are now hard wrapped and indented for easier reading and color is used to identify each by type. Note that colors are only used to highlight errors, warnings and debug messages. Under normal operation with no issues, the user will not see any color.
2021-04-14 16:09:25 -04:00
Timothée Mazzucotelli
3c9358bb6a Add plugin error exception and event
Related to #2082.
2020-12-23 19:23:31 -05:00
Waylan Limberg
c9032bd6bf Drop Python 2.7.
* Disable Linkchecker Test.
* Switch to unittest.mock in standard lib.
* Apply `pyupgrade --py3-plus`.
* Note: Using `builtins.open` mocks all calls to `open`, including test setup
(such as in `load_config`). Whereas, `path.to.namespace.open` only mocks
`open` in that namepsace. This all worked differently when we used `io.open`
as that wasn't a builtin to begin with. 
* Add a helpful error msg for PY2 users who use non-standard install methods.

Closes #1926.
2019-12-20 08:44:07 -05:00
Waylan Limberg
9b116b5fbc Warn on relative paths in nav. (#1613)
While this feels like a feature change/addition, it is addressing a regression and is therefore being treated as a bug-fix.

Note that prior to 1.0 this was handled as part of the config validation. t is now handled after config validation completes. In strict mode, warnings issued in config validation interrupt the build after config validation is complete--causing the build to not complete. Warnings issued during the build (after config validation passes) allow the build to complete and only exit with a failed return code.

Closes #1604.

This also deletes relative_path_ext.py. That file was supposed to be removed some time ago. Not sure how it managed to return.
2018-08-29 13:25:07 -04:00
Waylan Limberg
975b216c79 Removed six dependency. 2015-06-03 11:26:12 -04:00
Dougal Matthews
c3ab1cc95b Refactor the current CLI implementation to use Click
This reimplements the CLI interface to use Click, which in turn gives us
a much easier to use interface as it provides help messages for all the
commands and individual commands.

Fixes #259
2015-04-28 20:06:57 +01:00
Dougal Matthews
e5b1e71547 Add a test for the strict mode and change to an exception rather than
assert
2014-12-17 19:27:00 +00:00
Ng Zhi An
7b458f340c Remove pass in ConfigurationExpection 2014-10-26 18:37:16 -04:00
Ng Zhi An
8a4e47ebcb Add ConfigurationError exception class 2014-10-25 15:46:10 -04:00