Move old documentation out of the way

This commit is contained in:
Ian Cordasco 2016-03-17 15:10:35 -05:00
parent 0f2a2614ee
commit 55cc996368
11 changed files with 0 additions and 0 deletions

View file

@ -1,130 +0,0 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Raclette.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Raclette.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Raclette"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Raclette"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

View file

@ -1,38 +0,0 @@
==========
Flake8 API
==========
.. module:: flake8
flake8.engine
=============
.. autofunction:: flake8.engine.get_parser
.. autofunction:: flake8.engine.get_style_guide
flake8.hooks
============
.. autofunction:: flake8.hooks.git_hook
.. autofunction:: flake8.hooks.hg_hook
flake8.main
===========
.. autofunction:: flake8.main.main
.. autofunction:: flake8.main.check_file
.. autofunction:: flake8.main.check_code
.. autoclass:: flake8.main.Flake8Command
flake8.util
===========
For AST checkers, this module has the ``iter_child_nodes`` function and
handles compatibility for all versions of Python between 2.5 and 3.3. The
function was added to the ``ast`` module in Python 2.6 but is redefined in the
case where the user is running Python 2.5

View file

@ -1,17 +0,0 @@
Buildout integration
=====================
In order to use Flake8 inside a buildout, edit your buildout.cfg and add this::
[buildout]
parts +=
...
flake8
[flake8]
recipe = zc.recipe.egg
eggs = flake8
${buildout:eggs}
entry-points =
flake8=flake8.main:main

View file

@ -1,5 +0,0 @@
Changes
=======
.. include:: ../CHANGES.rst
:start-line: 3

View file

@ -1,240 +0,0 @@
# -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# This environment variable makes decorators not decorate functions, so their
# signatures in the generated documentation are still correct
os.environ['GENERATING_DOCUMENTATION'] = "flake8"
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
import flake8
# -- General configuration ----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# 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']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'flake8'
copyright = u'2012-2013 - Tarek Ziade, Ian Cordasco, Florent Xicluna'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = flake8.__version__
# The full version, including alpha/beta/rc tags.
release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for
# all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
# pygments_style = 'flask_theme_support.FlaskyStyle'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- 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 = 'nature'
# 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 themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# 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']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = False
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = False
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'flake8_doc'
# -- Options for LaTeX output -------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto/manual]).
latex_documents = [
('index', 'flake8.tex', u'flake8 Documentation',
u'Tarek Ziade', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output -------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'flake8', u'flake8 Documentation',
[u'Tarek Ziade', u'Ian Cordasco', u'Florent Xicluna'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- 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 = [
('index', 'flake8', u'flake8 Documentation', u'Tarek Ziade',
'flake8', 'Code checking using pep8, pyflakes and mccabe',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
texinfo_appendices = []

View file

@ -1,55 +0,0 @@
Configuration
=============
The behaviour may be configured at two levels.
Global
------
The user settings are read from the ``~/.config/flake8`` file (or the ``~/.flake8`` file on Windows).
Example::
[flake8]
ignore = E226,E302,E41
max-line-length = 160
exclude = tests/*
max-complexity = 10
Per-Project
-----------
At the project level, the ``tox.ini``, ``setup.cfg``, ``.pep8`` or ``.flake8``
files are read if present. Only the first file is considered. If this file
does not have a ``[flake8]`` section, no project specific configuration is
loaded.
Default
-------
If the ``ignore`` option is not in the configuration and not in the arguments,
only the error codes ``E123/E133``, ``E226`` and ``E241/E242`` are ignored
(see the :ref:`warning and error codes <error-codes>`).
Settings
--------
This is a (likely incomplete) list of settings that can be used in your config
file. In general, any settings that pep8 supports we also support and we add
the ability to set ``max-complexity`` as well.
- ``exclude``: comma-separated filename and glob patterns
default: ``.svn,CVS,.bzr,.hg,.git,__pycache``
- ``filename``: comma-separated filename and glob patterns
default: ``*.py``
- ``select``: select errors and warnings to enable which are off by default
- ``ignore``: skip errors or warnings
- ``max-line-length``: set maximum allowed line length
default: 79
- ``format``: set the error format
- ``max-complexity``: McCabe complexity threshold

View file

@ -1,149 +0,0 @@
Writing an Extension for Flake8
===============================
Since Flake8 is now adding support for extensions, we require ``setuptools``
so we can manage extensions through entry points. If you are making an
existing tool compatible with Flake8 but do not already require
``setuptools``, you should probably add it to your list of requirements. Next,
you'll need to edit your ``setup.py`` file so that upon installation, your
extension is registered. If you define a class called ``PackageEntryClass``
then this would look something like the following::
setup(
# ...
entry_points={
'flake8.extension': ['P10 = package.PackageEntryClass'],
}
# ...
)
If you intend to publish your extension, choose a unique code prefix
following the convention for :ref:`error codes <error-codes>`.
In addition, you can open a request in the `issue tracker
<https://bitbucket.org/tarek/flake8/issues>`_ to register the prefix in the
documentation.
.. TODO: describe the API required for the 3 kind of extensions:
* physical line checkers
* logical line checkers
* AST checkers
A real example: McCabe
----------------------
Below is an example from mccabe_ for how to write your ``setup.py`` file for
your Flake8 extension.
.. code-block:: python
# https://github.com/flintwork/mccabe/blob/0.2/setup.py#L38:L42
# -*- coding: utf-8 -*-
from setuptools import setup
# ...
setup(
name='mccabe',
# ...
install_requires=[
'setuptools',
],
entry_points={
'flake8.extension': [
'C90 = mccabe:McCabeChecker',
],
},
# ...
)
In ``mccabe.py`` you can see that extra options are added to the parser when
flake8 registers the extension:
.. code-block:: python
# https://github.com/flintwork/mccabe/blob/0.2/mccabe.py#L225:L254
class McCabeChecker(object):
"""McCabe cyclomatic complexity checker."""
name = 'mccabe'
version = __version__
_code = 'C901'
_error_tmpl = "C901 %r is too complex (%d)"
max_complexity = 0
def __init__(self, tree, filename):
self.tree = tree
@classmethod
def add_options(cls, parser):
parser.add_option('--max-complexity', default=-1, action='store',
type='int', help="McCabe complexity threshold")
parser.config_options.append('max-complexity')
@classmethod
def parse_options(cls, options):
cls.max_complexity = options.max_complexity
def run(self):
if self.max_complexity < 0:
return
visitor = PathGraphingAstVisitor()
visitor.preorder(self.tree, visitor)
for graph in visitor.graphs.values():
if graph.complexity() >= self.max_complexity:
text = self._error_tmpl % (graph.entity, graph.complexity())
yield graph.lineno, 0, text, type(self)
Since that is the defined entry point in the above ``setup.py``, flake8 finds
it and uses it to register the extension.
If we wanted the extension or a check to be optional, you can add
``off_by_default = True`` to our entry point. For example, we could
update ``mccabe.py`` with this variable as shown below:
.. code-block:: python
# https://github.com/flintwork/mccabe/blob/0.2/mccabe.py#L225:L254
class McCabeChecker(object):
"""McCabe cyclomatic complexity checker."""
name = 'mccabe'
version = __version__
off_by_default = True
If we wanted to run the optional extension or check, we need to specify the
error and warnings via the ``--enable-extension`` command line argument. In our
case, we could run ``flake8 --enable-extension=C90`` which would enable our
off_by_default example version of the mccabe extension.
Existing Extensions
===================
This is not at all a comprehensive listing of existing extensions but simply a
listing of the ones we are aware of:
* `flake8-debugger <https://github.com/JBKahn/flake8-debugger>`_
* `flake8-immediate <https://github.com/schlamar/flake8-immediate>`_
* `flake8-print <https://github.com/JBKahn/flake8-print>`_
* `flake8-todo <https://github.com/schlamar/flake8-todo>`_
* `pep8-naming <https://github.com/flintwork/pep8-naming>`_
* `radon <https://github.com/rubik/radon>`_
* `flake8-import-order <https://github.com/public/flake8-import-order>`_
* `flake8-respect-noqa <https://pypi.python.org/pypi/flake8-respect-noqa>`_
.. links
.. _mccabe: https://github.com/flintwork/mccabe
.. _PyPI: https://pypi.python.org/pypi/

View file

@ -1,26 +0,0 @@
.. include:: ../README.rst
Documentation
=============
.. toctree::
config
warnings
vcs
buildout
setuptools
api
extensions
changes
Original Projects
=================
Flake8 is just a glue project, all the merits go to the creators of the original
projects:
- pep8: https://github.com/jcrocholl/pep8
- PyFlakes: https://launchpad.net/pyflakes
- McCabe: http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html

View file

@ -1,25 +0,0 @@
Setuptools integration
======================
Upon installation, Flake8 enables a setuptools command that checks Python
files declared by your project.
Running ``python setup.py flake8`` on the command line will check the files
listed in your ``py_modules`` and ``packages``. If any warning is found,
the command will exit with an error code::
$ python setup.py flake8
Also, to allow users to be able to use the command without having to install
flake8 themselves, add flake8 to the setup_requires of your setup() like so::
setup(
name="project",
packages=["project"],
setup_requires=[
"flake8"
]
)

View file

@ -1,50 +0,0 @@
VCS Hooks
=========
flake8 can install hooks for Mercurial and Git so that flake8 is run
automatically before commits. The commit will fail if there are any
flake8 issues.
You can install the hook by issuing this command in the root of your
project::
$ flake8 --install-hook
In the case of Git, the hook won't be installed if a custom
``pre-commit`` hook file is already present in
the ``.git/hooks`` directory.
You can control the behavior of the pre-commit hook using configuration file
settings or environment variables:
``flake8.complexity`` or ``FLAKE8_COMPLEXITY``
Any value > 0 enables complexity checking with McCabe. (defaults
to 10)
``flake8.strict`` or ``FLAKE8_STRICT``
If True, this causes the commit to fail in case of any errors at
all. (defaults to False)
``flake8.ignore`` or ``FLAKE8_IGNORE``
Comma-separated list of errors and warnings to ignore. (defaults to
empty)
``flake8.lazy`` or ``FLAKE8_LAZY``
If True, also scans those files not added to the index before
commit. (defaults to False)
You can set these either through the git command line
.. code-block:: bash-session
$ git config flake8.complexity 10
$ git config flake8.strict true
Or by directly editing ``.git/config`` and adding a section like
.. code-block:: ini
[flake8]
complexity = 10
strict = true
lazy = false

View file

@ -1,51 +0,0 @@
.. _error-codes:
Warning / Error codes
=====================
The convention of Flake8 is to assign a code to each error or warning, like
the ``pep8`` tool. These codes are used to configure the list of errors
which are selected or ignored.
Each code consists of an upper case ASCII letter followed by three digits.
The recommendation is to use a different prefix for each plugin. A list of the
known prefixes is published below:
- ``E***``/``W***``: `pep8 errors and warnings
<http://pep8.readthedocs.org/en/latest/intro.html#error-codes>`_
- ``F***``: PyFlakes codes (see below)
- ``C9**``: McCabe complexity plugin `mccabe
<https://github.com/flintwork/mccabe>`_
- ``N8**``: Naming Conventions plugin `pep8-naming
<https://github.com/flintwork/pep8-naming>`_
The original PyFlakes does not provide error codes. Flake8 patches the
PyFlakes messages to add the following codes:
+------+--------------------------------------------------------------------+
| code | sample message |
+======+====================================================================+
| F401 | ``module`` imported but unused |
+------+--------------------------------------------------------------------+
| F402 | import ``module`` from line ``N`` shadowed by loop variable |
+------+--------------------------------------------------------------------+
| F403 | 'from ``module`` import \*' used; unable to detect undefined names |
+------+--------------------------------------------------------------------+
| F404 | future import(s) ``name`` after other statements |
+------+--------------------------------------------------------------------+
+------+--------------------------------------------------------------------+
| F811 | redefinition of unused ``name`` from line ``N`` |
+------+--------------------------------------------------------------------+
| F812 | list comprehension redefines ``name`` from line ``N`` |
+------+--------------------------------------------------------------------+
| F821 | undefined name ``name`` |
+------+--------------------------------------------------------------------+
| F822 | undefined name ``name`` in __all__ |
+------+--------------------------------------------------------------------+
| F823 | local variable ``name`` ... referenced before assignment |
+------+--------------------------------------------------------------------+
| F831 | duplicate argument ``name`` in function definition |
+------+--------------------------------------------------------------------+
| F841 | local variable ``name`` is assigned to but never used |
+------+--------------------------------------------------------------------+