Skip to content

Commit 534dd00

Browse files
committed
Merge pull request #597 from tkruse/add-cpplint
add ability to split md into code snippets, check with cpplint
2 parents 3b93c16 + 41cf08c commit 534dd00

File tree

4 files changed

+6651
-1
lines changed

4 files changed

+6651
-1
lines changed

scripts/Makefile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ all: \
1717
check-markdown \
1818
check-references \
1919
check-notabs \
20+
cpplint-all \
2021
check-badchars
2122

22-
2323
$(BUILD_DIR):
2424
mkdir -p $(BUILD_DIR)
2525

@@ -77,6 +77,29 @@ check-badchars: $(SOURCEPATH) $(BUILD_DIR) Makefile
7777
cat ../CppCoreGuidelines.md | nl -ba | grep -P '’|‘|”|“|¸|–|…|¦' > $(BUILD_DIR)/CppCoreGuidelines.md.badchars || true
7878
if [ -s $(BUILD_DIR)/CppCoreGuidelines.md.badchars ]; then echo 'Warning: Undesired chars (–’‘“”¸…¦) found:'; cat $(BUILD_DIR)/CppCoreGuidelines.md.badchars; false; fi;
7979

80+
81+
82+
#### Cpplint
83+
84+
.PHONY: cpplint-all
85+
cpplint-all: $(BUILD_DIR)/codeblocks $(BUILD_DIR)/Makefile python/Makefile.in
86+
cd $(BUILD_DIR)/codeblocks; $(MAKE) cpplint-all -k
87+
88+
#### generic makefile for sourceblocks (need to be evaluated after c++ file generation)
89+
90+
$(BUILD_DIR)/Makefile: python/Makefile.in
91+
cp python/Makefile.in $(BUILD_DIR)/codeblocks/Makefile
92+
93+
#### split md file into plain text and code
94+
95+
$(BUILD_DIR)/codeblocks: splitfile
96+
97+
$(BUILD_DIR)/plain.txt: splitfile
98+
99+
.PHONY: splitfile
100+
splitfile: $(SOURCEPATH) ./python/md-split.py
101+
python ./python/md-split.py $(SOURCEPATH) $(BUILD_DIR)/plain.txt $(BUILD_DIR)/codeblocks
102+
80103
#### install npm modules
81104
# install/update npm dependencies defined in file package.json
82105
# requires npm (nodejs package manager)

scripts/python/Makefile.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.PHONY: default
2+
default: all
3+
4+
.PHONY: all
5+
all: \
6+
cpplint-all
7+
8+
CXX_SRCS := $(wildcard *.cpp)
9+
10+
#### cpplint, check extracted sources using cpplint tool
11+
CXX_LINT := ${CXX_SRCS:.cpp=.lint}
12+
13+
.PHONY: cpplint-all
14+
cpplint-all: $(CXX_LINT)
15+
16+
%.lint: %.cpp
17+
@python ../../python/cpplint.py --verbose=0 --linelength=100 --filter=-legal/copyright,-build/include_order,-build/c++11,-build/namespaces,-readability/inheritance,-readability/function,-readability/casting,-readability/namespace,-readability/alt_tokens,-readability/braces,-readability/fn_size,-whitespace/comments,-whitespace/braces,-whitespace/empty_loop_body,-whitespace/indent,-whitespace/newline,-runtime/explicit,-runtime/arrays,-runtime/int,-runtime/references,-runtime/string,-runtime/operator $< || (cat $< | nl -ba | grep -v 'md-split' && false)
18+

0 commit comments

Comments
 (0)