From c00f8d7d3328a4d0400866f2aea72a4154d35372 Mon Sep 17 00:00:00 2001 From: herr kaste Date: Thu, 26 Apr 2018 10:58:44 +0200 Subject: [PATCH 1/4] Disable default stderr handler --- linter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/linter.py b/linter.py index 90828b4..730f62a 100644 --- a/linter.py +++ b/linter.py @@ -7,6 +7,7 @@ class Phpmd(Linter): r'(?P.+):(?P\d+)' r'\s*(?P.+)$' ) + on_stderr = None # handle stderr via regex default_type = WARNING tempfile_suffix = 'php' defaults = { From 21d43caa336cd2942c7e7c45db1f0bbd72bd59c7 Mon Sep 17 00:00:00 2001 From: herr kaste Date: Thu, 26 Apr 2018 11:10:21 +0200 Subject: [PATCH 2/4] Must use `${temp_file}` in cmd --- linter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linter.py b/linter.py index 730f62a..2446a95 100644 --- a/linter.py +++ b/linter.py @@ -2,7 +2,7 @@ class Phpmd(Linter): - cmd = ('phpmd', '${file}', 'text') + cmd = ('phpmd', '${temp_file}', 'text') regex = ( r'(?P.+):(?P\d+)' r'\s*(?P.+)$' From f31b48abd9d6277b92fa18dfbe48b9e774c7678c Mon Sep 17 00:00:00 2001 From: herr kaste Date: Thu, 26 Apr 2018 11:10:51 +0200 Subject: [PATCH 3/4] Hotfix `@ruleset` user arg by just using `args` --- linter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linter.py b/linter.py index 2446a95..1768162 100644 --- a/linter.py +++ b/linter.py @@ -12,5 +12,7 @@ class Phpmd(Linter): tempfile_suffix = 'php' defaults = { 'selector': 'source.php, text.html.basic', - '@rulesets:,': 'cleancode,codesize,controversial,design,naming,unusedcode' + # Not working, see https://github.com/SublimeLinter/SublimeLinter/issues/1349 + # '@rulesets:,': 'cleancode,codesize,controversial,design,naming,unusedcode', + 'args': 'cleancode,codesize,controversial,design,naming,unusedcode' } From e460c29be2f98e4db844de43cea1ffdd5fed69ad Mon Sep 17 00:00:00 2001 From: herr kaste Date: Thu, 26 Apr 2018 11:12:00 +0200 Subject: [PATCH 4/4] Add `.flake8` config file --- .flake8 | 12 ++++++++++++ .travis.yml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..1de405e --- /dev/null +++ b/.flake8 @@ -0,0 +1,12 @@ +[flake8] +max-line-length = 120 + +# D100 Missing docstring in public module +# D101 Missing docstring in public class +# D102 Missing docstring in public method +# D103 Missing docstring in public function +# D104 Missing docstring in public package +# D105 Missing docstring in magic method +# D107 Missing docstring in __init__ +ignore = D100,D101,D102,D103,D105,D107 + diff --git a/.travis.yml b/.travis.yml index 000f751..09b0e08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,4 @@ python: install: - pip install flake8 script: - - flake8 . --max-line-length=120 + - flake8