patch 9.1.1363: style: inconsistent indentation in various files
Problem: style: inconsistent indentation in various files
Solution: fix style, updated codestyle test
(Naruhiko Nishino)
closes: #17254
Signed-off-by: Naruhiko Nishino <naru123456789@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_codestyle.vim b/src/testdir/test_codestyle.vim
index 51c1209..1d2717c 100644
--- a/src/testdir/test_codestyle.vim
+++ b/src/testdir/test_codestyle.vim
@@ -163,5 +163,27 @@
bwipe!
enddef
+def Test_indent_of_source_files()
+ for fname in glob('../*.[ch]', 0, 1) + ['../xxd/xxd.c']
+ execute 'tabnew ' .. fname
+ for lnum in range(1, line('$'))
+ var name: string = synIDattr(synID(lnum, 1, 0), 'name')
+ if -1 == index(['cComment', 'cCommentStart'], name)
+ var line: string = getline(lnum)
+ var indent: string = matchstr(line, '^\s*')
+ var tailing: string = matchstr(line, '\s*$')
+ if !empty(indent)
+ if indent !~# '^\t* \{0,7\}$'
+ ReportError('testdir/' .. fname, lnum, 'invalid indent')
+ endif
+ endif
+ if !empty(tailing)
+ ReportError('testdir/' .. fname, lnum, 'tailing spaces')
+ endif
+ endif
+ endfor
+ close
+ endfor
+enddef
" vim: shiftwidth=2 sts=2 expandtab nofoldenable