Linting: Integrate into CMake, enable by default.

This commit is contained in:
Florian Walch 2014-12-13 02:20:34 +01:00 committed by Justin M. Keyes
parent aa08632caf
commit e21f6e754d
5 changed files with 164 additions and 61 deletions

View File

@ -1,3 +1,3 @@
#!/bin/sh
./clint.py $(cat clint-files.txt)
make lint

View File

@ -98,4 +98,10 @@ distclean: clean
install: | nvim
+$(BUILD_CMD) -C build install
.PHONY: test functionaltest unittest clean distclean nvim libnvim cmake deps install
lint:
cmake -DLINT_PRG=./clint.py \
-DLINT_DIR=src \
-DLINT_IGNORE_FILE=clint-ignored-files.txt \
-P cmake/RunLint.cmake
.PHONY: test functionaltest unittest lint clean distclean nvim libnvim cmake deps install

View File

@ -1,59 +0,0 @@
src/nvim/api/buffer.c
src/nvim/api/buffer.h
src/nvim/api/private/defs.h
src/nvim/api/private/handle.c
src/nvim/api/private/handle.h
src/nvim/api/private/helpers.c
src/nvim/api/private/helpers.h
src/nvim/api/tabpage.c
src/nvim/api/tabpage.h
src/nvim/api/vim.c
src/nvim/api/vim.h
src/nvim/api/window.c
src/nvim/api/window.h
src/nvim/cursor.c
src/nvim/cursor.h
src/nvim/hashtab.c
src/nvim/hashtab.h
src/nvim/indent.c
src/nvim/indent.h
src/nvim/log.c
src/nvim/log.h
src/nvim/map.c
src/nvim/map.h
src/nvim/map_defs.h
src/nvim/memfile.c
src/nvim/memfile.h
src/nvim/memfile_defs.h
src/nvim/mouse.c
src/nvim/mouse.h
src/nvim/msgpack_rpc/channel.c
src/nvim/msgpack_rpc/channel.h
src/nvim/msgpack_rpc/helpers.c
src/nvim/msgpack_rpc/helpers.h
src/nvim/msgpack_rpc/server.c
src/nvim/msgpack_rpc/server.h
src/nvim/os/env.c
src/nvim/os/event.c
src/nvim/os/event.h
src/nvim/os/event_defs.h
src/nvim/os/input.c
src/nvim/os/input.h
src/nvim/os/job.c
src/nvim/os/job.h
src/nvim/os/job_defs.h
src/nvim/os/mem.c
src/nvim/os/os.h
src/nvim/os/rstream.c
src/nvim/os/rstream.h
src/nvim/os/rstream_defs.h
src/nvim/os/shell.c
src/nvim/os/shell.h
src/nvim/os/signal.c
src/nvim/os/signal.h
src/nvim/os/time.c
src/nvim/os/time.h
src/nvim/profile.c
src/nvim/profile.h
src/nvim/tempfile.c
src/nvim/tempfile.h

135
clint-ignored-files.txt Normal file
View File

@ -0,0 +1,135 @@
src/nvim/arabic.c
src/nvim/arabic.h
src/nvim/ascii.h
src/nvim/assert.h
src/nvim/buffer.c
src/nvim/buffer.h
src/nvim/buffer_defs.h
src/nvim/charset.c
src/nvim/charset.h
src/nvim/cursor_shape.c
src/nvim/cursor_shape.h
src/nvim/diff.c
src/nvim/diff.h
src/nvim/digraph.c
src/nvim/digraph.h
src/nvim/edit.c
src/nvim/edit.h
src/nvim/eval.c
src/nvim/eval.h
src/nvim/eval_defs.h
src/nvim/ex_cmds.c
src/nvim/ex_cmds.h
src/nvim/ex_cmds.lua
src/nvim/ex_cmds2.c
src/nvim/ex_cmds2.h
src/nvim/ex_cmds_defs.h
src/nvim/ex_docmd.c
src/nvim/ex_docmd.h
src/nvim/ex_eval.c
src/nvim/ex_eval.h
src/nvim/ex_getln.c
src/nvim/ex_getln.h
src/nvim/farsi.c
src/nvim/farsi.h
src/nvim/file_search.c
src/nvim/file_search.h
src/nvim/fileio.c
src/nvim/fileio.h
src/nvim/fold.c
src/nvim/fold.h
src/nvim/func_attr.h
src/nvim/garray.c
src/nvim/garray.h
src/nvim/getchar.c
src/nvim/getchar.h
src/nvim/globals.h
src/nvim/hardcopy.c
src/nvim/hardcopy.h
src/nvim/iconv.h
src/nvim/if_cscope.c
src/nvim/if_cscope.h
src/nvim/if_cscope_defs.h
src/nvim/indent_c.c
src/nvim/indent_c.h
src/nvim/keymap.c
src/nvim/keymap.h
src/nvim/lib/khash.h
src/nvim/lib/klist.h
src/nvim/lib/kvec.h
src/nvim/macros.h
src/nvim/main.c
src/nvim/main.h
src/nvim/mark.c
src/nvim/mark.h
src/nvim/mark_defs.h
src/nvim/mbyte.c
src/nvim/mbyte.h
src/nvim/memline.c
src/nvim/memline.h
src/nvim/memline_defs.h
src/nvim/memory.c
src/nvim/memory.h
src/nvim/menu.c
src/nvim/menu.h
src/nvim/message.c
src/nvim/message.h
src/nvim/misc1.c
src/nvim/misc1.h
src/nvim/misc2.c
src/nvim/misc2.h
src/nvim/move.c
src/nvim/move.h
src/nvim/normal.c
src/nvim/normal.h
src/nvim/ops.c
src/nvim/ops.h
src/nvim/option.c
src/nvim/option.h
src/nvim/option_defs.h
src/nvim/os_unix.c
src/nvim/os_unix.h
src/nvim/os_unix_defs.h
src/nvim/path.c
src/nvim/path.h
src/nvim/po/sjiscorr.c
src/nvim/popupmnu.c
src/nvim/popupmnu.h
src/nvim/pos.h
src/nvim/quickfix.c
src/nvim/quickfix.h
src/nvim/regexp.c
src/nvim/regexp.h
src/nvim/regexp_defs.h
src/nvim/regexp_nfa.c
src/nvim/screen.c
src/nvim/screen.h
src/nvim/search.c
src/nvim/search.h
src/nvim/sha256.c
src/nvim/sha256.h
src/nvim/sign_defs.h
src/nvim/spell.c
src/nvim/spell.h
src/nvim/strings.c
src/nvim/strings.h
src/nvim/syntax.c
src/nvim/syntax.h
src/nvim/syntax_defs.h
src/nvim/tag.c
src/nvim/tag.h
src/nvim/term.c
src/nvim/term.h
src/nvim/term_defs.h
src/nvim/types.h
src/nvim/ui.c
src/nvim/ui.h
src/nvim/undo.c
src/nvim/undo.h
src/nvim/undo_defs.h
src/nvim/version.c
src/nvim/version.h
src/nvim/version_defs.h
src/nvim/vim.h
src/nvim/window.c
src/nvim/window.h

21
cmake/RunLint.cmake Normal file
View File

@ -0,0 +1,21 @@
get_filename_component(LINT_DIR ${LINT_DIR} ABSOLUTE)
get_filename_component(LINT_PREFIX ${LINT_DIR} PATH)
file(GLOB_RECURSE LINT_FILES ${LINT_DIR}/*.c ${LINT_DIR}/*.h)
if(LINT_IGNORE_FILE)
file(READ ${LINT_IGNORE_FILE} LINT_IGNORED_FILES)
string(REPLACE "\n" ";" LINT_IGNORED_FILES ${LINT_IGNORED_FILES})
message(STATUS "Ignoring the following files for linting:")
foreach(ignore_file ${LINT_IGNORED_FILES})
message(STATUS "${ignore_file}")
list(REMOVE_ITEM LINT_FILES "${LINT_PREFIX}/${ignore_file}")
endforeach()
endif()
execute_process(
COMMAND ${LINT_PRG} ${LINT_FILES}
RESULT_VARIABLE res)
if(NOT res EQUAL 0)
message(FATAL_ERROR "Linting failed: ${res}.")
endif()