Skip to content

Commit

Permalink
Add usage information to the readme, and examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Mar 2, 2021
1 parent 489a810 commit 0e8c466
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
72 changes: 72 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,75 @@ To install with ``pip``:
$ python -m pip install flake2lint
.. end installation
Usage
--------

.. code-block:: bash
flake2lint [-v] [-r] [FILENAMES]
``-v / --verbose``
^^^^^^^^^^^^^^^^^^

Show verbose output.

``-r / --recursive``
^^^^^^^^^^^^^^^^^^^^^

Permits the use of the pattern ``**`` to match any files, directories and subdirectories.


See `the documentation <https://flake2lint.readthedocs.io/en/latest/usage.html>`_ for more details.

Supported Flake8 Codes
------------------------

``flake2lint`` currently augments the following flake8 codes:

* ``A001`` ➞ ``redefined-builtin``
* ``A002`` ➞ ``redefined-builtin``
* ``A003`` ➞ ``redefined-builtin``

Contributions to add support for more codes are more than welcome. The relevant code is `here <https://github.com/domdfcoding/flake2lint/blob/98da9322512d28921bd9cbabb66d6f476066f1f8/flake2lint/__init__.py#L53-L56>`_.


Example
-----------

Before:

.. code-block:: python
class FancyDialog(wx.Dialog):
def __init__(
self,
parent,
id=wx.ID_ANY, # noqa: A002
title='My Fancy Dialog',
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.DEFAULT_DIALOG_STYLE,
name=wx.DialogNameStr,
data=None
): ...
After:

.. code-block:: python
class FancyDialog(wx.Dialog):
def __init__(
self,
parent,
id=wx.ID_ANY, # noqa: A002 # pylint: disable=redefined-builtin
title='My Fancy Dialog',
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.DEFAULT_DIALOG_STYLE,
name=wx.DialogNameStr,
data=None
): ...
51 changes: 51 additions & 0 deletions doc-source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,54 @@ Sample ``.pre-commit-config.yaml``:
:rev: v0.3.0

See `pre-commit <https://github.com/pre-commit/pre-commit>`_ for further information.

Supported Flake8 Codes
------------------------

``flake2lint`` currently augments the following flake8 codes:

* ``A001`` ➞ ``redefined-builtin``
* ``A002`` ➞ ``redefined-builtin``
* ``A003`` ➞ ``redefined-builtin``

Contributions to add support for more codes are more than welcome. The relevant code is `here <https://github.com/domdfcoding/flake2lint/blob/98da9322512d28921bd9cbabb66d6f476066f1f8/flake2lint/__init__.py#L53-L56>`_.


Example
-----------

Before:

.. code-block:: python
class FancyDialog(wx.Dialog):
def __init__(
self,
parent,
id=wx.ID_ANY, # noqa: A002
title='My Fancy Dialog',
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.DEFAULT_DIALOG_STYLE,
name=wx.DialogNameStr,
data=None
): ...
After:

.. code-block:: python
class FancyDialog(wx.Dialog):
def __init__(
self,
parent,
id=wx.ID_ANY, # noqa: A002 # pylint: disable=redefined-builtin
title='My Fancy Dialog',
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.DEFAULT_DIALOG_STYLE,
name=wx.DialogNameStr,
data=None
): ...

0 comments on commit 0e8c466

Please sign in to comment.