Skip to content

Commit

Permalink
Add support for Chevah JS linter. Release 0.5.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban committed Sep 11, 2018
1 parent 7346711 commit 0a45d97
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ install:

# Command to run the tests.
script:
- python test.py
- nosetests scame/
9 changes: 8 additions & 1 deletion release-notes.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
scame-0.5.0 - 2018/09/11
========================

* Switch from deprecated Google Closure Linter to Chevah JS Linter.
* Allow passing full command line arguments to chevah js linter.


scame-0.4.2 - 2017/10/29
========================

Expand All @@ -9,7 +16,7 @@ scame-0.4.1 - 2017/10/29

* Force flush the output on progress.


scame-0.4.0 - 2017/10/29
========================

Expand Down
2 changes: 1 addition & 1 deletion scame/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
Keeps the version of the project.
"""
VERSION = '0.4.2'
VERSION = '0.5.0'
17 changes: 11 additions & 6 deletions scame/formatcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,14 @@ def __init__(self):
'max_complexity': -1
}

self.closure_linter = {
self.chevah_js_linter = {
# Disabled by default, since jslint is the default linter.
'enabled': False,
# List of Google Closure Errors to ignore.
# List of errors to ignore.
# Ex 110 is line to long which is already provided by pocket-lint.
'ignore': [110],
# Extra flags to pass to linter.
'flags': []
}

# See pycodestyle.StyleGuide for available options.
Expand Down Expand Up @@ -1047,21 +1049,24 @@ class JavascriptChecker(BaseChecker, AnyTextMixin):

def check(self):
"""Check the syntax of the JavaScript code."""
self.check_closure_linter()
self.check_chevah_js_linter()
self.check_text()
self.check_windows_endlines()

def check_closure_linter(self):
"""Check file using Google Closure Linter."""
def check_chevah_js_linter(self):
"""Check file using Chevah JS Linter."""

options = self.options.get('closure_linter', self.file_path)
options = self.options.get('chevah_js_linter', self.file_path)

if not options['enabled']:
return

from closure_linter import runner
from closure_linter.common import erroraccumulator

import gflags as flags
flags.FLAGS(['scame-js-linter'] + options['flags'])

error_handler = erroraccumulator.ErrorAccumulator()
runner.Run(self.file_path, error_handler)
for error in error_handler.GetErrors():
Expand Down

0 comments on commit 0a45d97

Please sign in to comment.