Skip to content

Commit

Permalink
plugin prepared to support unit tested anaconda version
Browse files Browse the repository at this point in the history
  • Loading branch information
DamnWidget committed May 10, 2016
1 parent 53ec7b8 commit 9405867
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions anaconda_lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def get_settings(view, name, default=None):
# reuse anaconda helper functions
active_view = anaconda_helpers.active_view
get_view = anaconda_helpers.get_view
check_linting = anaconda_helpers.check_linting


__all__ = ['get_settings', 'active_view', 'get_view']
1 change: 0 additions & 1 deletion commands/phpcpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def run(self, edit, paths=False):
else:
file_path = os.path.normpath(paths[0])

print(file_path)
data = {
'vid': self.view.id(),
'filename': file_path,
Expand Down
9 changes: 8 additions & 1 deletion listeners/linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from ..anaconda_lib.sublime import run_linter
from ..anaconda_lib.anaconda_plugin import linting
from ..anaconda_lib.helpers import check_linting, get_settings


class BackgroundLinter(linting.BackgroundLinter):
Expand All @@ -19,4 +20,10 @@ def __init__(self):
def on_modified(self, view):
"""PHP tools doesn't works on buffer, just in files
"""
pass

if check_linting(view, 0, code=self.lang.lower()):
# remove prvious linting marks if configured to do so
if not get_settings(view, 'anaconda_linter_persistent', False):
linting.erase_lint_marks(view)
else:
self._erase_marks_if_no_linting(view)
2 changes: 1 addition & 1 deletion plugin/handlers_php/linting/anaconda_phplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def parse_errors(self):
"""

errors = {'E': [], 'W': [], 'V': []}
if not 'No syntax errors detected' in self.output:
if 'No syntax errors detected' not in self.output:
split_lines = str(self.output.splitlines())
for i in range(len(split_lines) - 1):
if not split_lines[i]:
Expand Down
8 changes: 4 additions & 4 deletions plugin/handlers_php/php_lint_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ def lint(self, settings, code=None, filename=None):
func(settings, code, filename)

if len(self._errors) == 0 and len(self._failures) > 0:
return {
self.callback({
'success': False,
'errors': '. '.join([str(e) for e in self._failures]),
'uid': self.uid,
'vid': self.vid
}
})

return {
self.callback({
'success': True,
'errors': self._errors,
'uid': self.uid,
'vid': self.vid
}
})

def phplint(self, settings, code=None, filename=None):
"""Run the php linter
Expand Down
2 changes: 1 addition & 1 deletion plugin_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
version = tuple([int(i) for i in ver.split('.')])

# Minimum required anaconda version
anaconda_required_version = (1, 3, 0)
anaconda_required_version = (1, 4, 25)

0 comments on commit 9405867

Please sign in to comment.