Run flake8 and vint in azure

This commit is contained in:
Ben Jackson 2019-05-08 23:23:33 +01:00
commit fc802b61bd
10 changed files with 78 additions and 46 deletions

View file

@ -15,8 +15,8 @@
" Boilerplate {{{
let s:save_cpo = &cpo
set cpo&vim
let s:save_cpo = &cpoptions
set cpoptions&vim
" }}}
@ -111,6 +111,6 @@ function! vimspector#ListBreakpoints() abort
endfunction
" Boilerplate {{{
let &cpo=s:save_cpo
let &cpoptions=s:save_cpo
unlet s:save_cpo
" }}}

View file

@ -15,11 +15,11 @@
" Boilerplate {{{
let s:save_cpo = &cpo
set cpo&vim
let s:save_cpo = &cpoptions
set cpoptions&vim
" }}}
function vimspector#internal#balloon#BalloonExpr()
function! vimspector#internal#balloon#BalloonExpr() abort
" winnr + 1 because for *no good reason* winnr is 0 based here unlike
" everywhere else
" int() because for *no good reason* winnr is a string.
@ -29,6 +29,6 @@ function vimspector#internal#balloon#BalloonExpr()
endfunction
" Boilerplate {{{
let &cpo=s:save_cpo
let &cpoptions=s:save_cpo
unlet s:save_cpo
" }}}

View file

@ -15,8 +15,8 @@
" Boilerplate {{{
let s:save_cpo = &cpo
set cpo&vim
let s:save_cpo = &cpoptions
set cpoptions&vim
" }}}
function! s:_OnServerData( channel, data ) abort
@ -26,15 +26,15 @@ EOF
endfunction
function! s:_OnServerError( channel, data ) abort
echom "Channel received error: " . a:data
echom 'Channel received error: ' . a:data
endfunction
function! s:_OnExit( channel, status ) abort
echom "Channel exit with status " . a:status
echom 'Channel exit with status ' . a:status
endfunction
function! s:_OnClose( channel ) abort
echom "Channel closed"
echom 'Channel closed'
" py3 _vimspector_session.OnChannelClosed()
endfunction
@ -52,7 +52,7 @@ endfunction
function! vimspector#internal#channel#StartDebugSession( config ) abort
if exists( 's:ch' )
echo "Channel is already running"
echo 'Channel is already running'
return v:none
endif
@ -66,7 +66,7 @@ function! vimspector#internal#channel#StartDebugSession( config ) abort
\ }
\ )
if ch_status( s:ch ) != 'open'
if ch_status( s:ch ) !=# 'open'
echom 'Unable to connect to debug adapter'
return v:none
endif
@ -79,7 +79,7 @@ function! vimspector#internal#channel#StopDebugSession() abort
return
endif
if ch_status( s:ch ) == 'open'
if ch_status( s:ch ) ==# 'open'
call ch_close( s:ch )
endif
@ -95,14 +95,14 @@ endfunction
function! vimspector#internal#channel#ForceRead() abort
if exists( 's:ch' )
let data = ch_readraw( s:ch, { 'timeout': 1000 } )
if data != ''
if data !=# ''
call s:_OnServerData( s:ch, data )
endif
endif
endfunction
" Boilerplate {{{
let &cpo=s:save_cpo
let &cpoptions=s:save_cpo
unlet s:save_cpo
" }}}

View file

@ -15,8 +15,8 @@
" Boilerplate {{{
let s:save_cpo = &cpo
set cpo&vim
let s:save_cpo = &cpoptions
set cpoptions&vim
" }}}
function! s:_OnServerData( channel, data ) abort
@ -28,13 +28,13 @@ function! s:_OnServerError( channel, data ) abort
endfunction
function! s:_OnExit( channel, status ) abort
echom "Channel exit with status " . a:status
echom 'Channel exit with status ' . a:status
unlet s:job
py3 _vimspector_session.OnServerExit( vim.eval( 'a:status' ) )
endfunction
function! s:_OnClose( channel ) abort
echom "Channel closed"
echom 'Channel closed'
endfunction
function! s:_Send( msg ) abort
@ -43,14 +43,14 @@ function! s:_Send( msg ) abort
return 0
endif
if job_status( s:job ) != 'run'
if job_status( s:job ) !=# 'run'
echom "Can't send message: Job is not running"
return 0
endif
let ch = job_getchannel( s:job )
if ch == 'channel fail'
echom "Channel was closed unexpectedly!"
if ch ==# 'channel fail'
echom 'Channel was closed unexpectedly!'
return 0
endif
@ -60,7 +60,7 @@ endfunction
function! vimspector#internal#job#StartDebugSession( config ) abort
if exists( 's:job' )
echom "Not starging: Job is already running"
echom 'Not starging: Job is already running'
return v:none
endif
@ -81,7 +81,7 @@ function! vimspector#internal#job#StartDebugSession( config ) abort
echom 'Started job, status is: ' . job_status( s:job )
if job_status( s:job ) != 'run'
if job_status( s:job ) !=# 'run'
echom 'Unable to start job, status is: ' . job_status( s:job )
return v:none
endif
@ -95,8 +95,8 @@ function! vimspector#internal#job#StopDebugSession() abort
return
endif
if job_status( s:job ) == 'run'
echom "Terminating job"
if job_status( s:job ) ==# 'run'
echom 'Terminating job'
call job_stop( s:job, 'kill' )
endif
endfunction
@ -108,13 +108,13 @@ endfunction
function! vimspector#internal#job#ForceRead() abort
if exists( 's:job' )
let data = ch_readraw( job_getchannel( s:job ), { 'timeout': 1000 } )
if data != ''
if data !=# ''
call s:_OnServerData( job_getchannel( s:job ), data )
endif
endif
endfunction
function! vimspector#internal#job#StartCommandWithLog( cmd, category )
function! vimspector#internal#job#StartCommandWithLog( cmd, category ) abort
if ! exists( 's:commands' )
let s:commands = {}
endif
@ -139,7 +139,7 @@ function! vimspector#internal#job#StartCommandWithLog( cmd, category )
\ } ) )
if job_status( s:commands[ a:category ][ index ] ) !=# 'run'
echom "Unable to start job for " . a:cmd
echom 'Unable to start job for ' . a:cmd
return v:none
endif
@ -152,7 +152,7 @@ function! vimspector#internal#job#StartCommandWithLog( cmd, category )
endfunction
function! vimspector#internal#job#CleanUpCommand( category )
function! vimspector#internal#job#CleanUpCommand( category ) abort
if ! exists( 's:commands' )
let s:commands = {}
endif
@ -168,6 +168,6 @@ function! vimspector#internal#job#CleanUpCommand( category )
endfunction
" Boilerplate {{{
let &cpo=s:save_cpo
let &cpoptions=s:save_cpo
unlet s:save_cpo
" }}}

View file

@ -15,11 +15,11 @@
" Boilerplate {{{
let s:save_cpo = &cpo
set cpo&vim
let s:save_cpo = &cpoptions
set cpoptions&vim
" }}}
function! vimspector#internal#state#Reset()
function! vimspector#internal#state#Reset() abort
py3 << EOF
from vimspector import debug_session
_vimspector_session = debug_session.DebugSession()
@ -27,6 +27,6 @@ EOF
endfunction
" Boilerplate {{{
let &cpo=s:save_cpo
let &cpoptions=s:save_cpo
unlet s:save_cpo
" }}}

View file

@ -4,9 +4,33 @@
# https://aka.ms/yaml
jobs:
- job: 'linax'
- job: 'PythonLint'
displayName: "Python Lint"
pool:
vimImage: 'ubuntu-16.04'
vmImage: 'ubuntu-16.04'
container: 'puremourning/vimspector:test'
steps:
- bash: pip3 install -r dev_requirements.txt
displayName: "Install requirements"
- bash: $HOME/.local/bin/flake8 python3/
displayName: "Run flake8"
- job: 'Vimscript'
displayName: "Vimscript Lint"
pool:
vmImage: 'ubuntu-16.04'
container: 'puremourning/vimspector:test'
steps:
- bash: pip3 install -r dev_requirements.txt
displayName: "Install requirements"
- bash: $HOME/.local/bin/vint autoload/ plugin/
displayName: "Run vint"
- job: 'linux'
pool:
vmImage: 'ubuntu-16.04'
container: 'puremourning/vimspector:test'
steps:
- bash: python3 install_gadget.py

2
dev_requirements.txt Normal file
View file

@ -0,0 +1,2 @@
flake8==3.7.7
vim-vint==0.3.19

View file

@ -14,15 +14,15 @@
" limitations under the License.
" Boilerplate {{{
let s:save_cpo = &cpo
set cpo&vim
let s:save_cpo = &cpoptions
set cpoptions&vim
function! s:restore_cpo()
let &cpo=s:save_cpo
let &cpoptions=s:save_cpo
unlet s:save_cpo
endfunction
if exists( "g:loaded_vimpector" )
if exists( 'g:loaded_vimpector' )
call s:restore_cpo()
finish
endif
@ -36,7 +36,7 @@ let g:loaded_vimpector = 1
let s:mappings = get( g:, 'vimspector_enable_mappings', '' )
if s:mappings == 'VISUAL_STUDIO'
if s:mappings ==# 'VISUAL_STUDIO'
nnoremap <F5> :call vimspector#Continue()<CR>
nnoremap <S-F5> :call vimspector#Stop()<CR>
nnoremap <C-S-F5> :call vimspector#Restart()<CR>
@ -46,7 +46,7 @@ if s:mappings == 'VISUAL_STUDIO'
nnoremap <F10> :call vimspector#StepOver()<CR>
nnoremap <F11> :call vimspector#StepInto()<CR>
nnoremap <S-F11> :call vimspector#StepOut()<CR>
elseif s:mappings == 'HUMAN'
elseif s:mappings ==# 'HUMAN'
nnoremap <F5> :call vimspector#Continue()<CR>
nnoremap <F3> :call vimspector#Stop()<CR>
nnoremap <F4> :call vimspector#Restart()<CR>

View file

@ -5,6 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get -y install python3-dev \
python3-pip \
ca-cacert \
libncurses5-dev libncursesw5-dev \
git \
@ -19,7 +20,7 @@ RUN mkdir -p $HOME/vim && \
cd $HOME/vim && \
git clone https://github.com/vim/vim && \
cd vim && \
git checkout v8.1.0958 && \
git checkout v8.1.1302 && \
./configure --with-features=huge \
--enable-python3interp \
--enable-terminal \

5
tests/ci/rebuild Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -e
docker build --no-cache -t puremourning/vimspector:test image/