-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from jamescooke/docs
Add RTD
- Loading branch information
Showing
11 changed files
with
322 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,5 +36,8 @@ venv/ | |
# Custom: python2 venv | ||
venv2/ | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# isort | ||
/isort.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = sphinx-build | ||
SPHINXPROJ = Flake8-AAA | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
import os | ||
import sys | ||
|
||
# Base directory of project | ||
basedir = os.path.dirname(os.path.dirname(__file__)) | ||
|
||
sys.path.insert(0, basedir) | ||
|
||
# --- Load __about__ info ---------------------------------------------------- | ||
|
||
about = {} | ||
with open(os.path.join(basedir, 'flake8_aaa', '__about__.py')) as f: | ||
exec(f.read(), about) | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = about['__name__'] | ||
copyright = about['__copyright__'] | ||
author = about['__author__'] | ||
|
||
# Version == release (strategy copied from Warehouse) | ||
version = release = about['__version__'] | ||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.doctest', | ||
'sphinx.ext.napoleon', | ||
] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ['_templates'] | ||
|
||
# The suffix(es) of source filenames. | ||
# You can specify multiple suffix as a list of string: | ||
# | ||
# source_suffix = ['.rst', '.md'] | ||
source_suffix = '.rst' | ||
|
||
# The master toctree document. | ||
master_doc = 'index' | ||
|
||
# The language for content autogenerated by Sphinx. Refer to documentation | ||
# for a list of supported languages. | ||
# | ||
# This is also used if you do content translation via gettext catalogs. | ||
# Usually you set "language" from the command line for these cases. | ||
language = None | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path . | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
# The name of the Pygments (syntax highlighting) style to use. | ||
pygments_style = 'sphinx' | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = 'sphinx_rtd_theme' | ||
|
||
# Theme options are theme-specific and customize the look and feel of a theme | ||
# further. For a list of options available for each theme, see the | ||
# documentation. | ||
# | ||
# html_theme_options = {} | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ['_static'] | ||
|
||
# Custom sidebar templates, must be a dictionary that maps document names | ||
# to template names. | ||
# | ||
# The default sidebars (for documents that don't match any pattern) are | ||
# defined by theme itself. Builtin themes are using these templates by | ||
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', | ||
# 'searchbox.html']``. | ||
# | ||
# html_sidebars = {} | ||
|
||
# -- Options for HTMLHelp output --------------------------------------------- | ||
|
||
# Output file base name for HTML help builder. | ||
htmlhelp_basename = 'Flake8-AAAdoc' | ||
|
||
# -- Options for LaTeX output ------------------------------------------------ | ||
|
||
latex_elements = { | ||
# The paper size ('letterpaper' or 'a4paper'). | ||
# | ||
# 'papersize': 'letterpaper', | ||
|
||
# The font size ('10pt', '11pt' or '12pt'). | ||
# | ||
# 'pointsize': '10pt', | ||
|
||
# Additional stuff for the LaTeX preamble. | ||
# | ||
# 'preamble': '', | ||
|
||
# Latex figure (float) alignment | ||
# | ||
# 'figure_align': 'htbp', | ||
} | ||
|
||
# Grouping the document tree into LaTeX files. List of tuples | ||
# (source start file, target name, title, | ||
# author, documentclass [howto, manual, or own class]). | ||
latex_documents = [ | ||
( | ||
master_doc, | ||
'flake8-aaa.tex', | ||
'{} Documentation'.format(project), | ||
author, | ||
'manual', | ||
), | ||
] | ||
|
||
# -- Options for manual page output ------------------------------------------ | ||
|
||
# One entry per manual page. List of tuples | ||
# (source start file, name, description, authors, manual section). | ||
man_pages = [(master_doc, 'flake8-aaa', '{} Documentation'.format(project), [author], 1)] | ||
|
||
# -- Options for Texinfo output ---------------------------------------------- | ||
|
||
# Grouping the document tree into Texinfo files. List of tuples | ||
# (source start file, target name, title, author, | ||
# dir menu entry, description, category) | ||
texinfo_documents = [ | ||
( | ||
master_doc, | ||
project, | ||
'{} Documentation'.format(project), | ||
author, | ||
'Flake8-AAA', | ||
about['__description__'], | ||
'Miscellaneous', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Test discovery | ||
============== | ||
|
||
* Filename must start with ``test_`` and have been collected for linting by | ||
``flake8``. | ||
|
||
* Test must be a function where its name starts with ``test``. | ||
|
||
* Tests that contain only comments, docstrings or ``pass`` are skipped. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Welcome to Flake8-AAA's documentation! | ||
====================================== | ||
|
||
.. include:: ../README.rst | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
discovery | ||
rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Rules and error codes | ||
===================== | ||
|
||
AAA01: no Act block found in test | ||
--------------------------------- | ||
|
||
Test found to have no Act block. | ||
|
||
An Act block is usually a line like ``result =`` or a check that an exception | ||
is raised using ``with pytest.raises(Exception):``. | ||
|
||
Resolution | ||
.......... | ||
|
||
Add an Act block to the test or mark a line that should be considered the | ||
action. | ||
|
||
Even if the result of a test action is ``None``, assign that result and pint it | ||
with a test:: | ||
|
||
result = action() | ||
|
||
assert result is None | ||
|
||
If you can not assign a ``result``, then mark the end of the line considered | ||
the Act block with ``# act`` (case insensitive):: | ||
|
||
data['new_key'] = 1 # act | ||
|
||
AAA02: multiple Act blocks found in test | ||
---------------------------------------- | ||
|
||
There must be one and only one Act block in every test. The linter found more | ||
than one potential Act block in this test. | ||
|
||
A test that contains more than one ``result =`` statement or more than one line | ||
marked ``# act`` creates ambiguity and raises this error code. | ||
|
||
Resolution | ||
.......... | ||
|
||
Splitting the failing test into multiple tests. Where there is complicated or | ||
reused set-up code then that should be extracted into one or more fixtures. |
Oops, something went wrong.