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

The staging branch #117

Merged
merged 117 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
fc02cc8
Enable tokenized_validator to accept multiple tokens Close #5
Askanio234 Mar 16, 2018
0472db5
Update docs
Askanio234 Mar 16, 2018
6df1d56
Add tests for tokenized_validator
Askanio234 Mar 16, 2018
c3f4b35
Split tokenized validator into three: if_any, if_all and if
Askanio234 Mar 20, 2018
26928f6
Rename tokenized validators
Askanio234 Mar 20, 2018
0ce594a
Remove debuging print statements
Askanio234 Mar 20, 2018
5103467
Fix style for long import line
Askanio234 Mar 20, 2018
ad13a5d
Reworked tests to match tokenized validator interface
Askanio234 Mar 20, 2018
9161bcf
Rename test file to better suit purpose
Askanio234 Mar 20, 2018
93ebf7d
Add a function to check args of code_validator
Askanio234 Mar 20, 2018
f34d854
Implement checking args of code_validator for tokens after pre_valida…
Askanio234 Mar 20, 2018
c33d5ed
Add tests for checking args for tokens in code_validator
Askanio234 Mar 20, 2018
ace86dd
Rename function for checking tokens to ensure_repo_tokens_mutually_ex…
Askanio234 Mar 21, 2018
993210c
Update docs
Askanio234 Mar 21, 2018
cb30cae
fix markup in docs
Askanio234 Mar 21, 2018
1cc93ee
Move tokenized_validators to separate package with the same name
Askanio234 Mar 22, 2018
78fd089
Remove function ensure_repo_tokens_mutually_exclusive from code_valid…
Askanio234 Mar 22, 2018
356723c
Rafactor _general_tokenized_validator function
Askanio234 Mar 22, 2018
638b8e2
Rename _general_tokenized_validator to run_if_tokens_satisfy conditio…
Askanio234 Mar 22, 2018
69c5082
Move everything but tokenized validators from tokenized_validators mo…
Askanio234 Mar 22, 2018
a23defc
Add a call to ensure_repo_tokens_mutually_exclusive function in valid…
Askanio234 Mar 22, 2018
2270511
Update tests, move tests for exclusivity of token(s) to tokenized_val…
Askanio234 Mar 23, 2018
8117b85
Remove old tests for exclusivity of token(s)
Askanio234 Mar 23, 2018
9538a3c
Update docs
Askanio234 Mar 23, 2018
ac466fa
Remove unnecessary imports in fiasko_bro __init__
Askanio234 Mar 30, 2018
1f0b404
Refactor if_any function, generator now works with boolean values
Askanio234 Mar 30, 2018
dbc202f
Refactor test disjunct tokens to be more obvious that disjunction is …
Askanio234 Mar 30, 2018
a37c3e8
Change logic behind tokenized validator with single token
Askanio234 Apr 2, 2018
1a9b447
Rename 'if_' to 'if_in' for clarity
Askanio234 Apr 3, 2018
cd17c28
Ensure repo_token is always iterable
Askanio234 Apr 3, 2018
f02aab7
Rework test single token validator to cover non-iterable token
Askanio234 Apr 3, 2018
66f4967
Remove debug print statements
Askanio234 Apr 4, 2018
bf3176e
Refactor run_if_tokens_satisfy_condition
Askanio234 Apr 4, 2018
af0c735
Merge branch 'master' into make_tokenized_validator_accept_multiple_t…
Askanio234 Apr 4, 2018
0ea1f2d
Keep .get method when calling 'validator_tokens' keyword arg
Askanio234 Apr 4, 2018
4704494
Move metadata to declarative file
Apr 5, 2018
40d6d48
Improve classifiers
Apr 5, 2018
bed0fd5
Add python version requirement
Apr 5, 2018
4c1b788
Add validator for pdb breakpoint
Apr 5, 2018
48aef04
Add multiple imports on the same line validator
Apr 5, 2018
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
f6408d2
Turn validator function names into error slugs
Apr 20, 2018
d178c81
Add get_error_slugs for easier slug existence check
Apr 20, 2018
fecc824
issue #110 create module utils.
Ranc58 Apr 26, 2018
a363126
Merge pull request #1 from Ranc58/issue/#110_orginize_helper_files
Ranc58 Apr 26, 2018
a1bb76f
issue #111 replace has_no_long_files validator to pre-validate
Ranc58 Apr 26, 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
7d4b079
Merge remote-tracking branch 'Askanio234/make_tokenized_validator_acc…
Apr 30, 2018
2d5704c
Merge branch 'setup' into staging
Apr 30, 2018
b1b9017
Merge branch 'pdb_validator' into staging
Apr 30, 2018
40fbec3
Merge branch 'multiple_imports' into staging
Apr 30, 2018
c21d902
Merge branch 'get_ast_trees' into staging
May 1, 2018
ccd3e3c
Merge remote-tracking branch 'Ranc58/master' into staging
May 1, 2018
e1dec06
Actually move has_no_long_files to pre validators
May 1, 2018
2cf72af
Fix a typo
May 1, 2018
382510a
Make bom pre validation check resistant to large files
May 1, 2018
69ae5e4
Add clarifying comment
May 1, 2018
525e6bb
Fix the warnings test
May 1, 2018
2e9ad18
Make the tabs validator test more granular
May 1, 2018
ffea59c
Move ast_nodes_validators into appropriate module
May 1, 2018
caad3f4
Merge branch 'error_slugs' into staging
May 2, 2018
60a6910
Fix IDE highlighting
May 2, 2018
9aca078
Give error_slugs semantically correct data structure
May 2, 2018
5692555
Fix pep8
May 2, 2018
49eb570
Use raw strings for consistency
May 2, 2018
86d787f
Fix wrong dict order for python3.5
May 2, 2018
fefa1fa
Add the changelog
May 9, 2018
f1052fd
Update docs for new error slugs
May 9, 2018
9f3b4b3
Fix broken indent
May 9, 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
commit_messages_from_blacklist add files via upload
too_many_pep8_violations 33 PEP8 violations
too_difficult_by_mccabe has_changed_readme
star_import __init__.py
local_import setup.py
has_variables_from_blacklist name, n
short_variable_name i, r, n, t, l
file_too_long ast_helpers.py
too_nested code_validator.py:54
indent_not_multiple_of_tab_size ast_helpers.py:130
variables_that_shadow_default_names 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/')
[('commit_messages_from_blacklist', 'add files via upload'), ('too_many_pep8_violations', '33 PEP8 violations'), ('too_difficult_by_mccabe', 'has_changed_readme'), ('star_import', '__init__.py'), ('local_import', 'setup.py'), ('has_variables_from_blacklist', 'name, n'), ('short_variable_name', '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'), ('variables_that_shadow_default_names', '_, 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