Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate global state, reducing technical debt #100

Merged
merged 50 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3caba2d
Add an abstraction over the filepath, filecontent, ast_tree tuple
Apr 7, 2018
9b6835e
Update gitpython
Apr 7, 2018
492611f
Move to the new validator aPI
Apr 7, 2018
f4dea0b
Remove the old validator API
Apr 7, 2018
001de2e
Fix the wrong test name
Apr 7, 2018
ee2d6a1
Revert "Remove the old validator API"
Apr 7, 2018
ab5f999
Remove the old API
Apr 7, 2018
b32b58a
Allow validation of folders, not repositories
Apr 7, 2018
0671dc8
Update the docs to reflect the changes in the API
Apr 9, 2018
ef652d7
Make whitelists and blacklists overridable by kwargs
Apr 9, 2018
000a46d
Return a list instead of iterator for more intuitive behavior
Apr 9, 2018
1574ccd
Remove unused logger
Apr 9, 2018
eeaa399
Rename config to defaults
Apr 9, 2018
7804203
Make the pre validators less dependent on global state
Apr 9, 2018
cf66a39
Fix the wrong usage of the API by the fiasko command
Apr 9, 2018
e8600cd
Make repo size prevalidator less dependent on global state
Apr 9, 2018
8ab2dc8
Abolish CodeValidator object and rewrite tests without it
Apr 9, 2018
4f5ae0d
Fix possible TypeError because of unexpected None
Apr 10, 2018
6e3d3b0
Improve naming
Apr 10, 2018
5509db4
Make validators aware of directories_to_skip parameter
Apr 10, 2018
52ae88d
Make the commit warning return the bad commit message
Apr 10, 2018
019c6dd
Close #95 and update the examples
Apr 10, 2018
67ce7dc
Fix badge display
Apr 10, 2018
fd88158
Adjust usage of default warning groups
Apr 10, 2018
fc130d0
Make the str method more usable
Apr 13, 2018
d741364
Remove duplicated logic
Apr 13, 2018
f725107
Rename VALIDATION_SETTINGS to parameters for consistency with docs te…
Apr 13, 2018
e0a791e
Sync docs with the latest interface changes
Apr 13, 2018
9749bee
Turn whitelists/blacklists into validation parameters
Apr 16, 2018
1e08c01
Make defaults actually immutable
Apr 16, 2018
21d190e
Add the docs for ignored files
Apr 16, 2018
57d1813
Make docs clearer
Apr 16, 2018
27cefce
Add docs for pre-validation checks
Apr 16, 2018
409df11
Fix the typo with keyword argument name
Apr 16, 2018
311af12
Fix the package hashes
Apr 16, 2018
f3a03c8
Merge branch 'master' of https://github.com/devmanorg/fiasko_bro into…
Apr 19, 2018
41501db
Make init repo work for all the files
Apr 28, 2018
e7b79ba
Make test utils file available to all the tests
Apr 28, 2018
978a27b
Turn general repo into an actual git repo
Apr 28, 2018
ee44f10
Make the validator tests faster
Apr 28, 2018
0bdc7f5
Fix PEP8 indent
Apr 28, 2018
784a0c2
Make validators ignore .git folder by default
Apr 28, 2018
f587a8d
Fix tox invocation error because of utils import
Apr 28, 2018
e6e1fef
Fix the test names
Apr 28, 2018
697bac2
Fix OSError: Lock at could not be obtained
Apr 28, 2018
acd692d
Make has_no_directories_from_blacklist take into account git tracking
Apr 28, 2018
a9aed94
Add .tox directory to gitignore
Apr 30, 2018
cb7a723
Fix incorrect exception for bad paths
Apr 30, 2018
9322739
Remove unused imports
Apr 30, 2018
2ff25f0
Put name:line format into the common place
Apr 30, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ htmlcov/
.idea
*.mo
*.pot
.tox
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "pypi"

[packages]

gitpython = "*"
GitPython = "*"
stdlib-list = "*"
mccabe = "*"
"pep8" = "*"
Expand All @@ -18,5 +18,5 @@ mccabe = "*"
pytest = "*"
pytest-cov = "*"
codecov = "*"
babel = "*"
Babel = "*"
tox = "*"
23 changes: 9 additions & 14 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 0 additions & 76 deletions README.md

This file was deleted.

114 changes: 114 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
Fiasko Bro
==========

When flake8 is not enough.

.. image:: https://travis-ci.org/devmanorg/fiasko_bro.svg?branch=master
:target: https://travis-ci.org/devmanorg/fiasko_bro
:alt: Build Status

.. image:: https://codecov.io/gh/devmanorg/fiasko_bro/branch/master/graph/badge.svg
:target: https://codecov.io/gh/devmanorg/fiasko_bro
:alt: codecov

.. image:: https://readthedocs.org/projects/fiasko-bro/badge/?version=latest
:target: http://fiasko-bro.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

.. image:: https://api.codeclimate.com/v1/badges/4f26aec50f07294b37e3/maintainability
:target: https://codeclimate.com/github/devmanorg/fiasko_bro/maintainability
:alt: Maintainability

.. image:: https://badge.fury.io/py/Fiasko-Bro.svg
:target: https://badge.fury.io/py/Fiasko-Bro
:alt: PyPI version

Fiasko is a static analysis tool for Python code that catches common style errors.

.. image:: http://melevir.com/static/fiasko.jpg

Example
~~~~~~~

From command line:

.. code-block:: bash

$ fiasko -p ~/projects/fiasko_bro
git_history_warning add files via upload
pep8 33 PEP8 violations
mccabe_failure has_changed_readme
has_star_import __init__.py
has_local_import setup.py
bad_titles name, n
bad_titles i, r, n, t, l
file_too_long ast_helpers.py
too_nested code_validator.py:54
indent_not_four_spaces ast_helpers.py:130
title_shadows slice
==================================================
Total 11 violations

See ``fiasko --help`` for more CLI arguments.

From Python code:

.. code-block:: python

>>> from fiasko_bro import validate
>>> validate('/user/projects/fiasko_bro/')
[('git_history_warning', 'add files via upload'), ('pep8', '33 PEP8 violations'), ('mccabe_failure', 'has_changed_readme'), ('has_star_import', '__init__.py'), ('has_local_import', 'setup.py'), ('bad_titles', 'name, n'), ('bad_titles', 'n, r, l, t, i'), ('file_too_long', 'ast_helpers.py'), ('too_nested', 'code_validator.py:54'), ('indent_not_four_spaces', 'ast_helpers.py:130'), ('title_shadows', '_, slice')]

The ``validate`` method returns list of tuples which consist of an error slug and an error message.

Fiasko has a flexible Python API which you can read more about `in the docs <https://fiasko-bro.readthedocs.io/en/latest/advanced_usage.html>`_.

Installation
~~~~~~~~~~~~

With pip:

.. code-block:: bash

pip install fiasko_bro

With Pipenv:

.. code-block:: bash

pipenv install fiasko_bro

Or just clone the project and install the requirements:

.. code-block:: bash

$ git clone https://github.com/devmanorg/fiasko_bro.git
$ cd fiasko_bro
$ pip install -r requirements.txt

Docs
~~~~

`fiasko-bro.readthedocs.io <http://fiasko-bro.readthedocs.io/>`_


Contributing
~~~~~~~~~~~~

To contribute, `pick an issue <https://github.com/devmanorg/fiasko_bro/issues>`_ to work on and leave a comment saying
that you've taken the issue. Don't forget to mention when you want to submit the pull request.

You can read more about contribution guidelines in `the docs <http://fiasko-bro.readthedocs.io/en/latest/contributing.html>`_

If your suggestion (or bug report) is new, be sure to `create an issue <https://github.com/devmanorg/fiasko_bro/issues/>`_ first.

Launch tests
~~~~~~~~~~~~

``python -m pytest``


Versioning
~~~~~~~~~~

We follow `semantic versioning <https://github.com/dbrock/semver-howto/blob/master/README.md)>`_.
5 changes: 2 additions & 3 deletions bin/fiasko.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import argparse

import fiasko_bro
from fiasko_bro import validate
from fiasko_bro.configparser_helpers import extract_fiasko_config_from_cfg_file


Expand All @@ -16,8 +16,7 @@ def main():
args = parse_args()
config_path = args.config_path or os.path.join(args.path, 'setup.cfg')
updated_config = extract_fiasko_config_from_cfg_file(config_path)
fiasko_bro.config.VALIDATOR_SETTINGS.update(updated_config)
violations = fiasko_bro.validate_repo(args.path)
violations = validate(args.path, **updated_config)
for violation_slug, violation_message in violations:
print('%-40s\t%s' % (violation_slug, violation_message))
print('=' * 50)
Expand Down
Loading