Skip to content

Commit

Permalink
16.4.1/2 with some minor packaging fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ambv committed May 6, 2016
1 parent 4980cc5 commit 379ef5b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 9 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include *.rst
recursive-include tests *.txt *.py
35 changes: 34 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ List of warnings
B001
~~~~

Do not use bare ``except:``, it also catches unexpected events " "like
Do not use bare ``except:``, it also catches unexpected events like
memory errors, interrupts, system exit, and so on. Prefer ``except
Exception:``. If you're sure what you're doing, be explicit and write
``except BaseException:``.
Expand All @@ -35,6 +35,25 @@ Just run::
python setup.py test


OMG, this is Python 3 only!
---------------------------

Relax, you can run ``flake8`` with all popular plugins as a *tool*
perfectly fine under Python 3.5+ even if you want to analyze Python 2
code. This way you'll be able to parse all of the new syntax supported
on Python 3 but also *effectively all* the Python 2 syntax at the same
time.

If you're still invested in Python 2, there might be a small subset of
deprecated syntax that you'd have to abandon... but you're already doing
that, right? `six <https://pypi.python.org/pypi/six>`_ or
`python-future <https://pypi.python.org/pypi/future>`_ bridge the gaps.

By making the code exclusively Python 3.5+, I'm able to focus on the
quality of the checks and re-use all the nice features of the new
releases (check out `pathlib <docs.python.org/3/library/pathlib.html>`_)
instead of wasting cycles on Unicode compatiblity, etc.

License
-------

Expand All @@ -44,6 +63,20 @@ MIT
Change Log
----------

16.4.2
~~~~~~

* packaging herp derp

16.4.1
~~~~~~

* bugfix: include tests in the source package (to make ``setup.py test``
work for everyone)

* bugfix: explicitly open README.rst in UTF-8 in setup.py for systems
with other default encodings

16.4.0
~~~~~~

Expand Down
5 changes: 3 additions & 2 deletions bugbear.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pep8


__version__ = '16.4.0'
__version__ = '16.4.2'


@attr.s
Expand Down Expand Up @@ -57,6 +57,7 @@ class BugBearVisitor(ast.NodeVisitor):
lines = attr.ib()
node_stack = attr.ib(default=attr.Factory(list))
errors = attr.ib(default=attr.Factory(list))
futures = attr.ib(default=attr.Factory(set))

if False:
# Useful for tracing what the hell is going on.
Expand All @@ -75,6 +76,7 @@ def visit_ExceptHandler(self, node):
self.errors.append(
B001(node.lineno, node.col_offset)
)
self.generic_visit(node)


error = namedtuple('error', 'lineno col message type')
Expand All @@ -86,4 +88,3 @@ def visit_ExceptHandler(self, node):
"be explicit and write `except BaseException:`.",
type=BugBearChecker,
)

9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@


current_dir = os.path.abspath(os.path.dirname(__file__))
ld_file = open(os.path.join(current_dir, 'README.rst'))
try:
with open(os.path.join(current_dir, 'README.rst'), encoding='utf8') as ld_file:
long_description = ld_file.read()
finally:
ld_file.close()


_version_re = re.compile(r'__version__\s+=\s+(?P<version>.*)')


with open('bugbear.py', 'rb') as f:
version = _version_re.search(f.read().decode('utf-8')).group('version')
with open(os.path.join(current_dir, 'bugbear.py'), 'r') as f:
version = _version_re.search(f.read()).group('version')
version = str(ast.literal_eval(version))


Expand Down

0 comments on commit 379ef5b

Please sign in to comment.