Skip to content

Commit

Permalink
Update contributing
Browse files Browse the repository at this point in the history
  • Loading branch information
mnot committed Jan 11, 2024
1 parent d00bb83 commit c77e533
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ Contributions - in the form of code, bugs, or ideas - are very welcome!

## Reporting bugs and suggesting enhancements

The [issues list](https://github.com/mnot/redbot/issues) is the best place to report
problems or suggest new features. Before you submit something, it would be great if you had a look
through the current issues to see if it's already there.
The [issues list](https://github.com/mnot/redbot/issues) is the best place to report problems or suggest new features. Before you submit something, it would be great if you had a look through the current issues to see if it's already there.


## Making code contributions
Expand All @@ -18,32 +16,23 @@ A quick overview of the repository contents:
* `bin/` has the command-line and Web (CGI and standalone daemon) executables that are the glue between the outside world and REDbot
* `redbot/` contains the redbot Python module:
* `assets/` contains static assets for the Web UI
* `formatter/` holds the different output formatters (e.g., HTML, plaintext, [HAR](http://www.softwareishard.com/blog/har-12-spec/)) for the check results
* `message/` checks one message, either request or response (but currently, mostly responses)
* `headers/` checks individual HTTP headers
* `formatter/` holds the different output formatters (e.g., HTML, plaintext, [HAR](http://www.softwareishard.com/blog/har-12-spec/)) for presenting the check results
* `resource/` defines the actual checker for a given URL, as `HTTPResource` in `__init__.py`. Lower-level fetching of resources is handled in `fetch.py`.
* `active_check/` doing a check on a resource might involve making additional requests, e.g., for ETag validation. Those checks are defined here
* `syntax/` has a collection of [ABNF](https://tools.ietf.org/html/rfc5234) translated into regex, for checking syntax
* `active_check/` Additional checks on a resource that involve making additional requests, e.g., for ETag validation
* `webui/` contains the engine for Web-based interaction with REDbot
* `src/` contains the source files for the JavaScript and CSS files
* `test/` guess what's here?

Generally, running a check involves instantiating a new `HTTPResource` object, which is a subclass
of `RedFetcher`. It's in charge of making all of the HTTP requests necessary to test that resource,
and feeds the results into `HttpMessage` objects that then checks its various aspects, especially
headers. If `descend` is true, the response will be parsed for links and `HTTPResource`s will be
created for each of them. When it's all done, the "root" `HTTPResource` will be fed to a
`Formatter` for presentation.
Most message-level checks are performed by the [httplint](https://pypi.org/project/httplint/) library; REDbot makes requests, feeds the responses into httplint, and presents the results. Additionally, REDbot makes "active" checks against resource behaviour for things like content negotiation and validation.

If you plan to support a new HTTP header in REDbot (a common task), see the [guide for Header
Development](https://github.com/mnot/redbot/blob/master/redbot/message/headers/README.md).
Checking a resource involves instantiating a new `HTTPResource` object, which is a subclass of `RedFetcher`. It's in charge of making all of the HTTP requests necessary to test that resource, and feeds the results into httplint's `HttpMessageLinter` objects that then checks various aspects of the messages, especially headers. If `descend` is true, the response will be parsed for links and `HTTPResource`s will be created for each of them. When it's all done, the "root" `HTTPResource` will be fed to a `Formatter` for presentation.


### Coding conventions

We use [black](https://pypi.org/project/black/) for Python formatting, and [standard](https://standardjs.com) for JavaScript; both can be run with `make tidy`.

All Python functions and methods need to have type annotations. See `pyproject.toml` for specific pylint and mypy settings.
All Python functions and methods need to have type annotations. See `pyproject.toml` for specific pylint and mypy settings. `make typecheck` and `make lint` are the relevant make targets.


### Setting up a development environment
Expand Down

0 comments on commit c77e533

Please sign in to comment.