Skip to content

Commit

Permalink
Merge from 3.x: PR #4218
Browse files Browse the repository at this point in the history
Fixes #3197
  • Loading branch information
ccordoba12 committed Mar 22, 2017
2 parents 047bf80 + 649ec7e commit f5054c2
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ a Python version greater than 2.7 (Python 3.2 is not supported anymore).
* **Sphinx**: Rich text mode for the Help pane.
* **Pygments** 2.0+: Syntax highlighting for all file types it supports.
* **Pylint**: Static code analysis.
* **Pep8**: Style analysis.
* **Pycodestyle**: Style analysis.
* **Psutil**: CPU and memory usage on the status bar.
* **Nbconvert**: Manipulation of notebooks in the Editor.
* **Qtawesome** 0.4.1+: To have an icon theme based on FontAwesome.
Expand Down
2 changes: 1 addition & 1 deletion conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requirements:
- nbconvert
- pygments >=2.0
- sphinx
- pep8
- pycodestyle
- psutil
- pylint
- qtawesome >=0.4.1
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/circle/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ "$CIRCLE_NODE_INDEX" = "3" ]; then
export CONDA_DEPENDENCIES=""
else
export CONDA_DEPENDENCIES_FLAGS="--quiet"
export CONDA_DEPENDENCIES="rope pyflakes sphinx pygments pylint pep8 psutil nbconvert \
export CONDA_DEPENDENCIES="rope pyflakes sphinx pygments pylint pycodestyle psutil nbconvert \
qtawesome pickleshare qtpy pyzmq chardet mock nomkl pandas \
pytest pytest-cov numpydoc scipy cython"
export PIP_DEPENDENCIES="coveralls pytest-qt pytest-xvfb flaky jedi"
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/conda-recipes/spyder/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ requirements:
- nbconvert
- pygments
- sphinx
- pep8
- pycodestyle
- psutil
- pylint
- qtawesome >=0.4.1
Expand Down
4 changes: 2 additions & 2 deletions create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_stdlib_modules():
shutil.copyfile('scripts/spyder', APP_MAIN_SCRIPT)

APP = [APP_MAIN_SCRIPT]
DEPS = ['pylint', 'logilab', 'astroid', 'pep8', 'setuptools']
DEPS = ['pylint', 'logilab', 'astroid', 'pycodestyle', 'setuptools']
EXCLUDES = DEPS + ['mercurial']
PACKAGES = ['spyder', 'spyder_breakpoints', 'spyder_io_dcm', 'spyder_io_hdf5',
'spyder_profiler', 'spyder_pylint', 'sphinx', 'jinja2', 'docutils',
Expand Down Expand Up @@ -157,7 +157,7 @@ def get_stdlib_modules():
shutil.copytree(osp.join(app_python_lib, p), osp.join(minimal_lib, p))

# Add necessary Python programs to the app
PROGRAMS = ['pylint', 'pep8']
PROGRAMS = ['pylint', 'pycodestyle']
system_progs = [find_program(p) for p in PROGRAMS]
progs_dest = [resources + osp.sep + p for p in PROGRAMS]
for i in range(len(PROGRAMS)):
Expand Down
2 changes: 1 addition & 1 deletion doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ The requirements to run Spyder are:

* `Pylint <http://www.logilab.org/project/pylint>`_ -- for static code analysis.

* `Pep8 <https://pypi.python.org/pypi/pep8>`_ -- for style analysis.
* `Pycodestyle <https://pypi.python.org/pypi/pycodestyle>`_ -- for style analysis.

* `Psutil <http://code.google.com/p/psutil/>`_ -- for memory/CPU usage in the status
bar.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def run(self):
'qtconsole>=4.2.0',
'nbconvert',
'sphinx',
'pep8',
'pycodestyle',
'pylint',
'psutil',
'qtawesome>=0.4.1',
Expand Down
4 changes: 2 additions & 2 deletions spyder/plugins/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ def setup_page(self):
codeanalysis.PYFLAKES_REQVER)
pep8_box = newcb(_("Real-time code style analysis"),
'code_analysis/pep8', default=False,
tip=_("<p>If enabled, Python source code will be analyzed"
"using pep8, lines that are not following PEP8 "
tip=_("<p>If enabled, Python source code will be analyzed "
"using pycodestyle, lines that are not following PEP8 "
"style guide will be highlighted.</p>"
"<p><u>Note</u>: add <b>analysis:ignore</b> in "
"a comment to ignore style analysis "
Expand Down
14 changes: 7 additions & 7 deletions spyder/utils/codeanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def check_with_pyflakes(source_code, filename=None):
dependencies.add("pyflakes", _("Real-time code analysis on the Editor"),
required_version=PYFLAKES_REQVER)

PEP8_REQVER = '>=0.6'
dependencies.add("pep8", _("Real-time code style analysis on the Editor"),
required_version=PEP8_REQVER)
PYCODESTYLE_REQVER = '>=2.3'
dependencies.add("pycodestyle", _("Real-time code style analysis on the Editor"),
required_version=PYCODESTYLE_REQVER)


def is_pyflakes_installed():
Expand All @@ -117,7 +117,7 @@ def get_checker_executable(name):
return [sys.executable, path1]
elif path2 is not None: # checker.py is available
# Checker package is available but its script has not been
# installed (this works with pep8 but not with pyflakes)
# installed (this works with pycodestyle but not with pyflakes)
return [sys.executable, path2]


Expand All @@ -129,7 +129,7 @@ def check(args, source_code, filename=None, options=None):
if options is not None:
args += options
if any(['pyflakes' in arg for arg in args]):
# Pyflakes requires an ending new line (pep8 don't! -- see Issue 1123)
# Pyflakes requires an ending new line (pycodestyle don't! -- see Issue 1123)
# Note: this code is not used right now as it is faster to invoke
# pyflakes in current Python interpreter (see `check_with_pyflakes`
# function above) than calling it through a subprocess
Expand Down Expand Up @@ -165,9 +165,9 @@ def check(args, source_code, filename=None, options=None):


def check_with_pep8(source_code, filename=None):
"""Check source code with pep8"""
"""Check source code with pycodestyle"""
try:
args = get_checker_executable('pep8')
args = get_checker_executable('pycodestyle')
results = check(args, source_code, filename=filename, options=['-r'])
except Exception:
# Never return None to avoid lock in spyder/widgets/editor.py
Expand Down
4 changes: 2 additions & 2 deletions spyder/utils/tests/test_codeanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def test_codeanalysis():
check_results = check_with_pyflakes(code, TEST_FILE) + \
check_with_pep8(code, TEST_FILE) + find_tasks(code)
if PY2:
num_results = 86
else:
num_results = 87
else:
num_results = 88
assert len(check_results) == num_results


Expand Down
2 changes: 1 addition & 1 deletion spyder/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def run_code_analysis(self, run_pyflakes, run_pep8):
"""Run code analysis"""
run_pyflakes = run_pyflakes and codeanalysis.is_pyflakes_installed()
run_pep8 = run_pep8 and\
codeanalysis.get_checker_executable('pep8') is not None
codeanalysis.get_checker_executable('pycodestyle') is not None
self.pyflakes_results = []
self.pep8_results = []
if self.editor.is_python():
Expand Down

0 comments on commit f5054c2

Please sign in to comment.