Archive

Posts Tagged ‘flake8’

Using Version Control Hooks

September 27, 2018 Leave a comment

Flake8 can be integrated into your development workflow in many ways. A default installation of Flake8 can install pre-commit hooks for both Git and Mercurial. To install a built-in hook, you can use the flake8 –install-hook command-line option.

https://flake8.readthedocs.io/en/latest/user/using-hooks.html

Advertisements
Categories: Interesting Tags: ,

pycodestyle.py:113: FutureWarning: Possible nested set at position 1

September 11, 2018 Leave a comment

Problem:

You get the following error when running flake8

$ flake8 sample.py
/usr/local/lib/python3.7/site-packages/pycodestyle.py:113: FutureWarning: Possible nested set at position 1
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
sample.py:7:1: E302 expected 2 blank lines, found 1

Solution:
# Uninstall flake8

$ pip3 uninstall flake8
Uninstalling flake8-3.5.0:
  Would remove:
    /usr/local/bin/flake8
    /usr/local/lib/python3.7/site-packages/flake8-3.5.0.dist-info/*
    /usr/local/lib/python3.7/site-packages/flake8/*
Proceed (y/n)? y
  Successfully uninstalled flake8-3.5.0

# Install the working version

$ pip3 install -e git+https://gitlab.com/pycqa/flake8@9631dac5#egg=flake8 --src /usr/local/lib/python3.7/site-packages
Obtaining flake8 from git+https://gitlab.com/pycqa/flake8@9631dac5#egg=flake8
  Cloning https://gitlab.com/pycqa/flake8 (to revision 9631dac5) to /usr/local/lib/python3.7/site-packages/flake8
  Did not find branch or tag '9631dac5', assuming revision or ref.
Collecting pyflakes<2.1.0,>=2.0.0 (from flake8)
  Downloading https://files.pythonhosted.org/packages/44/98/af7a72c9a543b1487d92813c648cb9b9adfbc96faef5455d60f4439aa99b/pyflakes-2.0.0-py2.py3-none-any.whl (53kB)
    100% |████████████████████████████████| 61kB 460kB/s
Collecting pycodestyle<2.5.0,>=2.4.0 (from flake8)
  Using cached https://files.pythonhosted.org/packages/e5/c6/ce130213489969aa58610042dff1d908c25c731c9575af6935c2dfad03aa/pycodestyle-2.4.0-py2.py3-none-any.whl
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /usr/local/lib/python3.7/site-packages (from flake8) (0.6.1)
Requirement already satisfied: setuptools>=30 in /usr/local/lib/python3.7/site-packages (from flake8) (40.0.0)
Installing collected packages: pyflakes, pycodestyle, flake8
  Found existing installation: pyflakes 1.6.0
    Uninstalling pyflakes-1.6.0:
      Successfully uninstalled pyflakes-1.6.0
  Found existing installation: pycodestyle 2.3.1
    Uninstalling pycodestyle-2.3.1:
      Successfully uninstalled pycodestyle-2.3.1
  Running setup.py develop for flake8
Successfully installed flake8 pycodestyle-2.4.0 pyflakes-2.0.0

Source:
https://github.com/PyCQA/pycodestyle/issues/728#issuecomment-405341335

Categories: python Tags: ,

QuickFix

December 21, 2016 Leave a comment

quickfix-window

QuickFix is designed to display compiler errors — a list of errors is displayed and can be selected to jump to a specific file and line.

:cn — Go to the next location in the list
:cp — Go to the previous location
:ccl — Close the quickfix window

Depending on where your quickfix window is. You can use below keys to move in and out of the window. (If quickfix window is at the bottom part of your screen)
CTRL-w + j — Move into the quickfix window
CTRL-w + k — Move out of the quickfix window

The window commands will work here. See link in source section below for more details.

Source:
http://usevim.com/2012/08/24/vim101-quickfix/
http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
http://vimdoc.sourceforge.net/htmldoc/windows.html#windows

Categories: python, vim Tags: