Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: micbou/flake8-ycm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.1.0
Choose a base ref
...
head repository: micbou/flake8-ycm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 6 commits
  • 8 files changed
  • 1 contributor

Commits on May 30, 2018

  1. Copy the full SHA
    2598af8 View commit details
  2. Add PyPI badges

    micbou committed May 30, 2018
    Copy the full SHA
    1c44125 View commit details
  3. Copy the full SHA
    73fbf4d View commit details
  4. Do not ignore E211 rule

    micbou committed May 30, 2018
    Copy the full SHA
    8046265 View commit details

Commits on Jun 18, 2018

  1. Copy the full SHA
    4c0c2c9 View commit details
  2. Fix TypeError exception for YCM201 and YCM202 rules

    Check that the next start position and the previous end position are well
    defined before accessing them.
    micbou committed Jun 18, 2018
    Copy the full SHA
    60eb837 View commit details
Showing with 35 additions and 3 deletions.
  1. +5 −0 HISTORY.rst
  2. +9 −0 README.rst
  3. +2 −0 flake8_ycm.py
  4. +1 −1 setup.py
  5. +1 −0 test_requirements.txt
  6. +13 −0 tests/spaces_inside_brackets_test.py
  7. +3 −1 tests/test_utils.py
  8. +1 −1 tox.ini
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -2,6 +2,11 @@
Release history
===============

0.2.0 (pending)
---------------

* Fix TypeError exception for YCM201 and YCM202 rules.

0.1.0 (2018-05-30)
------------------

9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -2,6 +2,15 @@
flake8-ycm
==========

.. image:: https://img.shields.io/pypi/v/flake8-ycm.svg
:target: https://pypi.org/project/flake8-ycm/

.. image:: https://img.shields.io/pypi/l/flake8-ycm.svg
:target: https://pypi.org/project/flake8-ycm/

.. image:: https://img.shields.io/pypi/pyversions/flake8-ycm.svg
:target: https://pypi.org/project/flake8-ycm/

.. image:: https://img.shields.io/travis/micbou/flake8-ycm.svg?label=Linux
:target: https://travis-ci.com/micbou/flake8-ycm

2 changes: 2 additions & 0 deletions flake8_ycm.py
Original file line number Diff line number Diff line change
@@ -73,13 +73,15 @@ def SpacesInsideBrackets( logical_line, tokens ):
yield end, code + message
if ( next_token_type not in [ tokenize.NL, tokenize.NEWLINE ] and
next_text != CORRESPONDING_BRACKET[ text ] and
next_start and
next_start[ 0 ] == start[ 0 ] and
next_start[ 1 ] - start[ 1 ] != 2 ):
code = 'YCM201'
message = ' exactly one space required after {}'.format( text )
yield end, code + message
if text in RIGHT_BRACKETS:
if ( prev_text != CORRESPONDING_BRACKET[ text ] and
prev_end and
prev_end[ 0 ] == end[ 0 ] and
end[ 1 ] - prev_end[ 1 ] != 2 ):
code = 'YCM202'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ def ReadFile( *args ):
zip_safe = False,
keywords = 'flake8, YouCompleteMe, ycmd, coding style',
classifiers=[
'Development Status :: 1 - Planning',
'Development Status :: 4 - Beta',
'Framework :: Flake8',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
1 change: 1 addition & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
flake8 >= 3.0.0
flake8-comprehensions >= 1.4.1
flake8-ycm >= 0.1.0
nose >= 1.3.7
PyHamcrest >= 1.8.0
# coverage.py 4.4 removed the path from the filename attribute in its reports.
13 changes: 13 additions & 0 deletions tests/spaces_inside_brackets_test.py
Original file line number Diff line number Diff line change
@@ -85,3 +85,16 @@ def test( ):
Error( 2, 14, 'YCM204', 'no spaces between [ and ] for empty content' ),
Error( 3, 14, 'YCM204', 'no spaces between { and } for empty content' ) ]
)


def InvalidSyntax_test():
RunTest(
"""
{
'key': 'value' )
}
{
""",
[]
)
4 changes: 3 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -53,9 +53,11 @@ def RunTest( content, expected_errors ):
'-m', 'flake8',
'--jobs=1',
'--select=YCM',
'--exit-zero',
filename ], env = env )
except subprocess.CalledProcessError as exception:
output = exception.output
print( exception.output.decode( 'utf8' ) )
raise

actual_errors = []
for line in output.decode( 'utf8' ).splitlines():
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
ignore = E111,E114,E121,E125,E126,E127,E128,E129,E131,E133,E201,E202,E203,E211,E221,E222,E241,E251,E261,E303,E402,W503
ignore = E111,E114,E121,E125,E126,E127,E128,E129,E131,E133,E201,E202,E203,E221,E222,E241,E251,E261,E303,E402,W503
max-complexity = 10
max-line-length = 80