52 changed files with 960 additions and 422 deletions
@ -1,125 +0,0 @@
@@ -1,125 +0,0 @@
|
||||
version: 2 |
||||
|
||||
common: &common |
||||
docker: |
||||
- image: neomake/vims-for-tests:47@sha256:b540d84bb5ca445ee28625a5c2f72ce790908a23cd9e6f0b05150840ad15e8b3 |
||||
working_directory: ~/repo |
||||
steps: |
||||
- checkout |
||||
- run: |
||||
name: Run tests |
||||
command: | |
||||
cc-test-reporter before-build |
||||
make --keep-going testcoverage TEST_VIM=$TEST_VIM |
||||
- run: |
||||
name: Handle coverage |
||||
command: | |
||||
set -x |
||||
mkdir test-results |
||||
cp -a .coverage_covimerage test-results/.coverage_covimerage.$CIRCLE_BUILD_NUM |
||||
|
||||
# Upload to codecov, which handles this per job itself. |
||||
coverage xml |
||||
# -Z: exit with 1 in case of failures. |
||||
codecov -Z -X search -X gcov -X pycov -f coverage.xml \ |
||||
-n "$CIRCLE_JOB" -F "${CIRCLE_JOB%%-*}" -e CIRCLE_JOB |
||||
set +x |
||||
- persist_to_workspace: |
||||
root: . |
||||
paths: |
||||
- test-results/ |
||||
|
||||
jobs: |
||||
nvim-038: |
||||
<<: *common |
||||
environment: |
||||
TEST_VIM=/vim-build/bin/neovim-v0.3.8 |
||||
nvim-017: |
||||
<<: *common |
||||
environment: |
||||
TEST_VIM=/vim-build/bin/neovim-v0.1.7 |
||||
nvim-master: |
||||
<<: *common |
||||
environment: |
||||
TEST_VIM=/vim-build/bin/neovim-master |
||||
vim-master: |
||||
<<: *common |
||||
environment: |
||||
TEST_VIM=/vim-build/bin/vim-master |
||||
vim-81: |
||||
<<: *common |
||||
environment: |
||||
TEST_VIM=/vim-build/bin/vim81 |
||||
vim-80: |
||||
<<: *common |
||||
environment: |
||||
TEST_VIM=/vim-build/bin/vim80 |
||||
vim-74-xenial: |
||||
<<: *common |
||||
environment: |
||||
TEST_VIM=/vim-build/bin/vim74-xenial |
||||
vim-74-trusty: |
||||
<<: *common |
||||
environment: |
||||
TEST_VIM=/vim-build/bin/vim74-trusty |
||||
vim-73: |
||||
<<: *common |
||||
environment: |
||||
TEST_VIM=/vim-build/bin/vim73 |
||||
|
||||
checkqa: |
||||
<<: *common |
||||
steps: |
||||
- checkout |
||||
- run: make checkqa |
||||
|
||||
coverage: |
||||
<<: *common |
||||
steps: |
||||
# TODO: checkout only necessary for covimerage plugin?! |
||||
# Writing/using .coveragerc only might be enough. |
||||
- checkout |
||||
- attach_workspace: |
||||
at: /tmp/workspace |
||||
- run: |
||||
name: Upload global coverage results |
||||
command: | |
||||
set -x |
||||
cp -a /tmp/workspace/test-results/.coverage_covimerage.* . |
||||
|
||||
coverage combine |
||||
coverage xml |
||||
|
||||
# Coveralls. |
||||
# Only TRAVIS_JOB_ID is used by python-coveralls. |
||||
env -u COVERALLS_PARALLEL TRAVIS_JOB_ID=$CIRCLE_WORKFLOW_ID coveralls |
||||
|
||||
# Codeclimate. |
||||
cc-test-reporter after-build |
||||
set +x |
||||
|
||||
workflows: |
||||
version: 2 |
||||
test: |
||||
jobs: |
||||
- nvim-038 |
||||
- nvim-017 |
||||
- vim-81 |
||||
- vim-80 |
||||
- vim-74-xenial |
||||
- vim-74-trusty |
||||
- vim-73 |
||||
- nvim-master |
||||
- vim-master |
||||
- checkqa |
||||
- coverage: |
||||
requires: |
||||
- nvim-master |
||||
- nvim-038 |
||||
- nvim-017 |
||||
- vim-master |
||||
- vim-81 |
||||
- vim-80 |
||||
- vim-74-xenial |
||||
- vim-74-trusty |
||||
- vim-73 |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
[run] |
||||
plugins = covimerage |
||||
data_file = .coverage_covimerage |
||||
|
||||
[report] |
||||
include = autoload/*,plugin/*,syntax/*,tests/* |
||||
omit = tests/fixtures/vim/* |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
policies: |
||||
ProhibitImplicitScopeVariable: |
||||
enabled: false |
@ -1,63 +0,0 @@
@@ -1,63 +0,0 @@
|
||||
# From https://github.com/tweekmonster/vim-testbed. |
||||
FROM testbed/vim:16@sha256:ce0e3c0407e9af4c41868636199906e3c2a6c6f02b97f6bb3e2767aeba6d5c85 |
||||
|
||||
# Currently tested versions: |
||||
# - v7.3.429 (Ubuntu Precise, 12.04LTS) |
||||
# - v7.4.052 (Ubuntu Trusty, 14.04LTS) |
||||
# - v7.4.1689 (Ubuntu Xenial, 16.04LTS) |
||||
# - v8.0.586 (Updated Vim 8, https://vim.sourceforge.io/download.php) |
||||
# TODO: clean up names to make them usable as-is in CircleCI config. |
||||
# Uses fixed-profiling patch with vim81 (https://github.com/vim/vim/pull/2499). |
||||
RUN install_vim -tag v7.3.429 -name vim73 --with-features=huge -build \ |
||||
-tag v7.4.052 -name vim74-trusty --with-features=huge -build \ |
||||
-tag v7.4.1689 -name vim74-xenial --with-features=huge -build \ |
||||
-tag v8.0.0586 -name vim80 -py2 -build \ |
||||
-tag neovim:v0.1.7 -build \ |
||||
&& rm -rf /vim-build/**/runtime/tutor |
||||
RUN install_vim -tag v8.1.0622 -name vim81 -build \ |
||||
-tag neovim:v0.3.8 -py3 -build \ |
||||
&& rm -rf /vim-build/**/runtime/tutor |
||||
|
||||
ENV NEOMAKE_DOCKERFILE_UPDATE=2019-09-19 |
||||
|
||||
# Git master in a separate layer, since the above is meant to be stable. |
||||
RUN install_vim -tag master -build \ |
||||
-tag neovim:master -build \ |
||||
&& rm -rf /vim-build/**/runtime/tutor |
||||
|
||||
# Install tools for running tests (busybox's grep does not have --line-number). |
||||
# openssh for CircleCI to improve Git checkout. |
||||
RUN apk --no-cache add bash curl grep make openssh-client |
||||
|
||||
# Codeclimate reporter. |
||||
RUN curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /usr/local/bin/cc-test-reporter \ |
||||
&& chmod +x /usr/local/bin/cc-test-reporter |
||||
|
||||
# Install dep plugins (test runner and those used during tests). |
||||
# Keeps git and installs ssh for CircleCI's checkout (and diffing for changed |
||||
# files). grep for checks. |
||||
ENV NEOMAKE_TESTS_DEP_PLUGINS_DIR=/neomake-deps |
||||
ENV VIMHELPLINT_DIR=$NEOMAKE_TESTS_DEP_PLUGINS_DIR/vim-vimhelplint |
||||
RUN mkdir $NEOMAKE_TESTS_DEP_PLUGINS_DIR |
||||
RUN apk --no-cache add git \ |
||||
&& git clone -q --depth=1 -b display-source-with-exceptions https://github.com/blueyed/vader.vim $NEOMAKE_TESTS_DEP_PLUGINS_DIR/vader \ |
||||
&& git clone -q --depth=1 https://github.com/tpope/vim-fugitive $NEOMAKE_TESTS_DEP_PLUGINS_DIR/vim-fugitive \ |
||||
&& git clone -q --depth=1 https://github.com/machakann/vim-vimhelplint $NEOMAKE_TESTS_DEP_PLUGINS_DIR/vim-vimhelplint \ |
||||
&& git clone -q --depth=1 https://github.com/syngan/vim-vimlint /tools/vim-vimlint \ |
||||
&& git clone -q --depth=1 https://github.com/ynkdir/vim-vimlparser /tools/vim-vimlparser |
||||
RUN test -f /vim-build/bin/vim81 && ln -s /vim-build/bin/vim81 /usr/local/bin/vim |
||||
RUN printf '#!/bin/sh -x\n/tools/vim-vimlint/bin/vimlint.sh -l /tools/vim-vimlint -p /tools/vim-vimlparser "$@"\n' > /usr/local/bin/vimlint |
||||
RUN chmod +x /usr/local/bin/vimlint |
||||
|
||||
# Install covimerage and vint. |
||||
RUN apk --no-cache add python3 \ |
||||
&& pip3 install -U pip \ |
||||
&& pip3 install --no-cache-dir python-coveralls covimerage==0.1.7 vim-vint==0.3.21 \ |
||||
&& rm -rf /usr/include /usr/lib/python*/turtle* /usr/lib/python*/tkinter \ |
||||
&& pip3 uninstall --yes pip \ |
||||
&& curl https://codecov.io/bash -o /usr/bin/codecov \ |
||||
&& chmod +x /usr/bin/codecov \ |
||||
&& cd /usr/bin && ln -s python3 python |
||||
|
||||
RUN adduser -D -s /bin/bash neomake |
||||
USER neomake |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
" vim: ts=4 sw=4 et |
||||
|
||||
function! neomake#makers#ft#clojure#EnabledMakers() abort |
||||
return ['clj_kondo'] |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#clojure#clj_kondo() abort |
||||
let maker = { |
||||
\ 'exe': 'clj-kondo', |
||||
\ 'args': ['--lint'], |
||||
\ 'errorformat': |
||||
\ '%f:%l:%c: Parse %t%*[^:]: %m,'. |
||||
\ '%f:%l:%c: %t%*[^:]: %m,'. |
||||
\ '%-Glinting took %.%#' |
||||
\ } |
||||
|
||||
function! maker.supports_stdin(_jobinfo) abort |
||||
let self.args = ['--filename', '%'] + self.args |
||||
return 1 |
||||
endfunction |
||||
|
||||
return maker |
||||
endfunction |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
function! neomake#makers#ft#javascriptreact#SupersetOf() abort |
||||
return 'javascript' |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#javascriptreact#EnabledMakers() abort |
||||
return ['jshint', executable('eslint_d') ? 'eslint_d' : 'eslint'] |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#javascriptreact#javascriptreacthint() abort |
||||
return neomake#makers#ft#javascript#jshint() |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#javascriptreact#stylelint() abort |
||||
return neomake#makers#ft#css#stylelint() |
||||
endfunction |
||||
|
||||
" vim: ts=4 sw=4 et |
@ -1,14 +1,49 @@
@@ -1,14 +1,49 @@
|
||||
#!/usr/bin/env python |
||||
|
||||
from __future__ import print_function |
||||
from sys import argv, exit |
||||
|
||||
import warnings |
||||
import sys |
||||
|
||||
|
||||
def main(argv): |
||||
if len(argv) != 2: |
||||
exit(64) |
||||
|
||||
with open(argv[1]) as fp: |
||||
contents = fp.read() |
||||
|
||||
exitcode = 0 |
||||
syntax_err = None |
||||
with warnings.catch_warnings(record=True) as wc: |
||||
try: |
||||
compile(open(argv[1]).read(), argv[1], 'exec', 0, 1) |
||||
except SyntaxError as err: |
||||
print('%s:%s:%s: %s' % (err.filename, err.lineno, err.offset, err.msg)) |
||||
exit(1) |
||||
compile(contents, argv[1], "exec", 0, 1) |
||||
except SyntaxError as exc: |
||||
syntax_err = exc |
||||
|
||||
# Output any warnings (caught during `compile`). |
||||
# This could/should maybe only handle SyntaxWarnings? |
||||
for wm in wc: |
||||
print( |
||||
"%s:%s: W: %s (%s)" |
||||
% (wm.filename, wm.lineno, wm.message, wm.category.__name__) |
||||
) |
||||
exitcode |= 2 |
||||
|
||||
# Output any SyntaxError. |
||||
if syntax_err: |
||||
print( |
||||
"%s:%s:%s: E: %s" |
||||
% ( |
||||
syntax_err.filename, |
||||
syntax_err.lineno, |
||||
syntax_err.offset, |
||||
syntax_err.msg, |
||||
) |
||||
) |
||||
exitcode |= 1 |
||||
return exitcode |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
sys.exit(main(sys.argv)) |
||||
|
@ -0,0 +1,139 @@
@@ -0,0 +1,139 @@
|
||||
" vim: ts=4 sw=4 et |
||||
|
||||
function! neomake#makers#ft#terraform#EnabledMakers() abort |
||||
return ['tfsec', 'tflint', 'terrascan', 'tfvalidate'] |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#terraform#terrascan() abort |
||||
return { |
||||
\ 'exe' : 'terrascan', |
||||
\ 'append_file': 0, |
||||
\ 'cwd': '%:p:h', |
||||
\ 'args': ['scan', '--use-colors', 'f', '--output', 'json', '--log-level', 'fatal'], |
||||
\ 'process_json': function('neomake#makers#ft#terraform#ProcessTerrascan') |
||||
\ } |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#terraform#tfvalidate() abort |
||||
return { |
||||
\ 'exe' : 'terraform', |
||||
\ 'append_file': 0, |
||||
\ 'cwd': '%:p:h', |
||||
\ 'args': ['validate', '-no-color', '-json'], |
||||
\ 'process_json': function('neomake#makers#ft#terraform#ProcessTfvalidateJSON') |
||||
\ } |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#terraform#tflint() abort |
||||
return { |
||||
\ 'exe' : 'tflint', |
||||
\ 'append_file': 0, |
||||
\ 'cwd': '%:p:h', |
||||
\ 'args': ['--no-color', '--format', 'json'], |
||||
\ 'process_json': function('neomake#makers#ft#terraform#ProcessTflintJSON') |
||||
\ } |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#terraform#tfsec() abort |
||||
return { |
||||
\ 'exe' : 'tfsec', |
||||
\ 'append_file': 0, |
||||
\ 'cwd': '%:p:h', |
||||
\ 'args': ['--format', 'json', '.'], |
||||
\ 'process_json': function('neomake#makers#ft#terraform#ProcessTfsecJSON') |
||||
\ } |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#terraform#ProcessTflintJSON(context) abort |
||||
let entries = [] |
||||
for line in a:context['json']['errors'] |
||||
" filename:line,col1-col2: message |
||||
let l:msg = split(line['message'], ':') |
||||
let l:filename = l:msg[0] |
||||
let l:position = split(l:msg[1], ',') |
||||
let l:line = l:position[0] |
||||
let l:col1 = split(l:position[1], '-')[0] |
||||
let l:col2 = split(l:position[1], '-')[1] |
||||
|
||||
let l:message = l:msg[2] |
||||
|
||||
let entry = { |
||||
\ 'filename': l:filename, |
||||
\ 'text': l:message, |
||||
\ 'lnum': l:line, |
||||
\ 'col': l:col1, |
||||
\ 'type': "e", |
||||
\ } |
||||
call add(entries, entry) |
||||
endfor |
||||
return entries |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#terraform#ProcessTfvalidateJSON(context) abort |
||||
let entries = [] |
||||
|
||||
if (!has_key(a:context, 'json') || !has_key(a:context['json'], 'diagnostics')) |
||||
return [] |
||||
endif |
||||
|
||||
for line in a:context['json']['diagnostics'] |
||||
let l:f = has_key(line, 'range') ? line['range']['filename'] : expand('%:t') |
||||
let l:l = has_key(line, 'range') ? line['range']['start']['line'] : 1 |
||||
let l:c = has_key(line, 'range') ? line['range']['start']['column'] : 1 |
||||
|
||||
let entry = { |
||||
\ 'filename': l:f, |
||||
\ 'text': line['summary'] . (has_key(line, 'detail') ? ': ' . line['detail'] : ''), |
||||
\ 'lnum': l:l, |
||||
\ 'col': l:c, |
||||
\ 'type': line['severity'], |
||||
\ } |
||||
call add(entries, entry) |
||||
endfor |
||||
return entries |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#terraform#ProcessTfsecJSON(context) abort |
||||
let entries = [] |
||||
|
||||
if (type(a:context['json']['results']) != v:t_list) |
||||
return [] |
||||
endif |
||||
|
||||
for line in a:context['json']['results'] |
||||
let entry = { |
||||
\ 'filename': fnamemodify(line['location']['filename'], ':t'), |
||||
\ 'text': line['rule_id'] . ': ' . line['description'] . ' ' . line['link'], |
||||
\ 'lnum': line['location']['start_line'], |
||||
\ 'col': 1, |
||||
\ 'type': line['severity'], |
||||
\ } |
||||
call add(entries, entry) |
||||
endfor |
||||
return entries |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#terraform#ProcessTerrascan(context) abort |
||||
let entries = [] |
||||
|
||||
if (!has_key(a:context, 'json') || !has_key(a:context['json'], 'results')) |
||||
return [] |
||||
endif |
||||
|
||||
if (type(a:context['json']['results']['violations']) != v:t_list) |
||||
return [] |
||||
endif |
||||
|
||||
for line in a:context['json']['results']['violations'] |
||||
let entry = { |
||||
\ 'filename': fnamemodify(line['file'], ':t'), |
||||
\ 'text': line['rule_id'] . ': ' . line['description'], |
||||
\ 'lnum': line['line'], |
||||
\ 'col': 1, |
||||
\ 'type': get({ 'HIGH': 'error', 'MEDIUM': 'warning', 'LOW': 'warning' }, line['severity'], 'info'), |
||||
\ } |
||||
call add(entries, entry) |
||||
endfor |
||||
return entries |
||||
endfunction |
||||
|
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
function! neomake#makers#ft#typescriptreact#SupersetOf() abort |
||||
return 'typescript' |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#typescriptreact#EnabledMakers() abort |
||||
return ['tsc', 'tslint'] |
||||
endfunction |
||||
|
||||
function! neomake#makers#ft#typescriptreact#tsc() abort |
||||
let config = neomake#makers#ft#typescript#tsc() |
||||
let config.args = config.args + ['--jsx', 'preserve'] |
||||
return config |
||||
endfunction |
||||
|
||||
" vim: ts=4 sw=4 et |
@ -1,2 +1 @@
@@ -1,2 +1 @@
|
||||
if not this or foo bar: |
||||
meh |
||||
invalid_syntax( |
||||
|
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
Include: include/setup.vader |
||||
|
||||
Execute (clojure: clj_kondo: errorformat): |
||||
let maker = NeomakeTestsGetMakerWithOutput(neomake#makers#ft#clojure#clj_kondo(), [ |
||||
\ 'file1.clj:2:1: error: unresolved symbol unknown', |
||||
\ 'linting took 12ms, errors: 1, warnings: 0', |
||||
\ ]) |
||||
let maker.name = 'clojure' |
||||
new |
||||
file file1.clj |
||||
CallNeomake 1, [maker] |
||||
AssertEqualQf getloclist(0), [ |
||||
\ {'lnum': 2, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, |
||||
\ 'nr': -1, 'type': 'e', 'pattern': '', |
||||
\ 'text': 'unresolved symbol unknown'}] |
||||
bwipe |
||||
|
||||
Execute (clojure: clj_kondo: supports_stdin): |
||||
new |
||||
noautocmd setfiletype clojure |
||||
|
||||
let b:neomake = {'clj_kondo': {'exe': 'echo', 'errorformat': '%m'}} |
||||
CallNeomake 1, ['clj_kondo'] |
||||
AssertNeomakeMessage '\vStarting .{-}: echo --filename '''' --lint -.', 2 |
||||
|
||||
file file1.clj |
||||
CallNeomake 1, ['clj_kondo'] |
||||
AssertNeomakeMessage '\vStarting .{-}: echo --filename file1.clj --lint -.', 2 |
||||
bwipe |
Loading…
Reference in new issue