diff --git a/docker/Gemfile b/docker/Gemfile index b4716815..d434a212 100644 --- a/docker/Gemfile +++ b/docker/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -gem 'rubocop' -gem 'puppet-lint' -gem 'foodcritic' +gem 'rubocop', '~>0.49' +gem 'puppet-lint', '~>2.2' +gem 'foodcritic', '~>12.0' diff --git a/docker/ruby2.Dockerfile b/docker/ruby2.Dockerfile index 3aa63f04..01050406 100644 --- a/docker/ruby2.Dockerfile +++ b/docker/ruby2.Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.5-alpine +FROM ruby:2.4-alpine RUN mkdir /src \ && mkdir /tool \ diff --git a/lintreview/tools/eslint.py b/lintreview/tools/eslint.py index 063fc03c..3af6029e 100644 --- a/lintreview/tools/eslint.py +++ b/lintreview/tools/eslint.py @@ -2,6 +2,7 @@ import logging import os import re +from lintreview.config import comma_value from lintreview.review import IssueComment from lintreview.tools import Tool, process_checkstyle import lintreview.docker as docker @@ -23,7 +24,8 @@ def match_file(self, filename): """ base = os.path.basename(filename) name, ext = os.path.splitext(base) - return ext == '.js' or ext == '.jsx' + extensions = comma_value(self.options.get('extensions', '.js,.jsx')) + return ext in extensions def has_fixer(self): """Eslint has a fixer that can be enabled diff --git a/settings.sample.py b/settings.sample.py index db2de88a..dcc92558 100644 --- a/settings.sample.py +++ b/settings.sample.py @@ -14,9 +14,9 @@ def env(key, default=None, cast=str): # gunicorn config bind = env('LINTREVIEW_GUNICORN_BIND', '127.0.0.1:5000') errorlog = env('LINTREVIEW_GUNICORN_LOG_ERROR', - 'lintreview.error.log') + 'lintreview.error.log') accesslog = env('LINTREVIEW_GUNICORN_LOG_ACCESS', - 'lintreview.access.log') + 'lintreview.access.log') debug = env('LINTREVIEW_GUNICORN_DEBUG', True, bool) loglevel = env('LINTREVIEW_GUNICORN_LOGLEVEL', 'debug') @@ -87,8 +87,9 @@ def env(key, default=None, cast=str): SUMMARY_THRESHOLD = env('LINTREVIEW_SUMMARY_THRESHOLD', 50, int) # Used as the author information when making commits -GITHUB_AUTHOR_NAME = 'lintreview' -GITHUB_AUTHOR_EMAIL = 'lintreview@example.com' +GITHUB_AUTHOR_NAME = env('LINTREVIEW_GITHUB_AUTHOR_NAME', 'lintreview') +GITHUB_AUTHOR_EMAIL = env('LINTREVIEW_GITHUB_AUTHOR_EMAIL', + 'lintreview@example.com') # Status Configuration ###################### diff --git a/tests/tools/test_eslint.py b/tests/tools/test_eslint.py index d800b586..7e7c04cf 100644 --- a/tests/tools/test_eslint.py +++ b/tests/tools/test_eslint.py @@ -29,6 +29,16 @@ def test_match_file(self): self.assertTrue(self.tool.match_file('test.jsx')) self.assertTrue(self.tool.match_file('dir/name/test.js')) + def test_match_file__extensions(self): + options = { + 'extensions': '.js,.jsm' + } + tool = Eslint(self.problems, options) + self.assertFalse(tool.match_file('test.php')) + self.assertFalse(tool.match_file('test.jsx')) + self.assertTrue(tool.match_file('test.js')) + self.assertTrue(tool.match_file('test.jsm')) + @requires_image('nodejs') def test_check_dependencies(self): self.assertTrue(self.tool.check_dependencies())