Skip to content

Commit

Permalink
Merge pull request #9243 from steff456/remove_pyflakes_pep8_checks
Browse files Browse the repository at this point in the history
PR: Remove unused Pyflakes and Pep8 check functions
  • Loading branch information
ccordoba12 authored May 1, 2019
2 parents f5dec42 + 1085637 commit aeedf61
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 253 deletions.
4 changes: 2 additions & 2 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from spyder.config.fonts import MEDIUM, MONOSPACE, SANS_SERIF, SMALL
from spyder.config.user import UserConfig
from spyder.config.utils import IMPORT_EXT
from spyder.utils import codeanalysis
from spyder.plugins.editor.utils.findtasks import TASKS_PATTERN
from spyder.utils.introspection.module_completion import PREFERRED_MODULES


Expand Down Expand Up @@ -288,7 +288,7 @@
'exclude_regexp': False,
'search_text_regexp': False,
'search_text': [''],
'search_text_samples': [codeanalysis.TASKS_PATTERN],
'search_text_samples': [TASKS_PATTERN],
'more_options': True,
'case_sensitive': False
}),
Expand Down
1 change: 0 additions & 1 deletion spyder/plugins/editor/confpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from spyder.config.base import _
from spyder.config.main import CONF
import spyder.utils.icon_manager as ima
from spyder.utils import codeanalysis, programs


NUMPYDOC = "https://numpydoc.readthedocs.io/en/latest/format.html"
Expand Down
33 changes: 33 additions & 0 deletions spyder/plugins/editor/utils/findtasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)

"""
Source code analysis utilities.
"""

import re

# Local import
from spyder.config.base import get_debug_level

DEBUG_EDITOR = get_debug_level() >= 3

# =============================================================================
# Find tasks - TODOs
# =============================================================================
TASKS_PATTERN = r"(^|#)[ ]*(TODO|FIXME|XXX|HINT|TIP|@todo|" \
r"HACK|BUG|OPTIMIZE|!!!|\?\?\?)([^#]*)"


def find_tasks(source_code):
"""Find tasks in source code (TODO, FIXME, XXX, ...)."""
results = []
for line, text in enumerate(source_code.splitlines()):
for todo in re.findall(TASKS_PATTERN, text):
todo_text = (todo[-1].strip(' :').capitalize() if todo[-1]
else todo[-2])
results.append((todo_text, line + 1))
return results
5 changes: 0 additions & 5 deletions spyder/plugins/editor/widgets/codeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3332,13 +3332,8 @@ def test(fname):
win.load(fname)
win.resize(900, 700)

# from spyder.utils.codeanalysis import (check_with_pyflakes,
# check_with_pep8)
source_code = to_text_string(win.editor.toPlainText())
# results = check_with_pyflakes(source_code, fname) + \
# check_with_pep8(source_code, fname)
results = win.editor.document_did_change()
# win.editor.process_code_analysis(results)

sys.exit(app.exec_())

Expand Down
6 changes: 3 additions & 3 deletions spyder/plugins/editor/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
get_filter, is_kde_desktop, is_anaconda)
from spyder.py3compat import qbytearray_to_str, to_text_string
from spyder.utils import icon_manager as ima
from spyder.utils import (codeanalysis, encoding, sourcecode,
syntaxhighlighters)
from spyder.utils import encoding, sourcecode, syntaxhighlighters
from spyder.utils.qthelpers import (add_actions, create_action,
create_toolbutton, MENU_SEPARATOR,
mimedata2url)
Expand All @@ -55,6 +54,7 @@
from spyder.plugins.editor.widgets.status import (CursorPositionStatus,
EncodingStatus, EOLStatus,
ReadWriteStatus, VCSStatus)
from spyder.plugins.editor.utils.findtasks import find_tasks
from spyder.widgets.tabs import BaseTabs
from spyder.config.main import CONF
from spyder.plugins.explorer.widgets import show_in_external_file_explorer
Expand Down Expand Up @@ -208,7 +208,7 @@ def get_source_code(self):
def run_todo_finder(self):
"""Run TODO finder"""
if self.editor.is_python():
self.threadmanager.add_thread(codeanalysis.find_tasks,
self.threadmanager.add_thread(find_tasks,
self.todo_finished,
self.get_source_code(), self)

Expand Down
187 changes: 0 additions & 187 deletions spyder/utils/codeanalysis.py

This file was deleted.

55 changes: 0 additions & 55 deletions spyder/utils/tests/test_codeanalysis.py

This file was deleted.

0 comments on commit aeedf61

Please sign in to comment.