Skip to content

Commit e2a1131

Browse files
committed
Merge pull request #191 from tkruse/travis
travis configuration
2 parents 68af55c + d53c17b commit e2a1131

File tree

5 files changed

+143
-0
lines changed

5 files changed

+143
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
scripts/build
2+
scripts/nodesjs/build
3+
node_modules
4+
_site

.travis.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This is the configuration for Travis CI, a free github-integrated service that runs this script for each pull request (if configured)
2+
3+
# Be nice to travis, allow docker builds, must not use sudo below
4+
sudo: false
5+
6+
# provides gcc, clang, make, scons, cmake
7+
language: c++
8+
9+
# alternatives: gcc, clang, or both (as yaml list)
10+
compiler: clang
11+
12+
install:
13+
-
14+
15+
script:
16+
- cd scripts; make -k
17+
- cd ..
18+
19+
## find lines with tabs
20+
# - rm -f CppCoreGuidelines.md.tabs
21+
# - cat CppCoreGuidelines.md | nl -ba | sed -s 's/\(^[^\t]*\)\t/\1--/g' | grep $'\t' | sed -s 's/\t/\*\*\*\*/g' > CppCoreGuidelines.md.tabs
22+
# - if [[ -s CppCoreGuidelines.md.tabs ]]; then echo 'Tabs found'; cat CppCoreGuidelines.md.tabs; false; fi;
23+
24+
## check references unique
25+
- rm -f CppCoreGuidelines.md.uniq
26+
- grep -oP '(?<=<a name=")[^\"]+' CppCoreGuidelines.md | uniq -d > CppCoreGuidelines.md.uniq
27+
- if [[ -s CppCoreGuidelines.md.uniq ]]; then echo 'Found duplicate anchors:'; cat CppCoreGuidelines.md.uniq; false; fi;
28+
29+
30+
notifications:
31+
email: false

scripts/Makefile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This Makefile is supposed to run on the Travis CI server and also locally
2+
# it assumes the nodejs package managaer npm is installed
3+
4+
# make magic not needed
5+
MAKEFLAGS += --no-builtin-rules
6+
.SUFFIXES:
7+
8+
BUILD_DIR=build
9+
SOURCEFILE = CppCoreGuidelines.md
10+
SOURCEPATH = ../$(SOURCEFILE)
11+
12+
.PHONY: default
13+
default: all
14+
15+
.PHONY: all
16+
all: \
17+
check-markdown \
18+
check-references
19+
20+
21+
$(BUILD_DIR):
22+
mkdir -p $(BUILD_DIR)
23+
24+
#### clean: remove all files generated by the productive rules
25+
.PHONY: clean
26+
clean:
27+
rm -rf $(BUILD_DIR)
28+
29+
#### distclean: remove all helper executables that may be downloaded by the Makefile
30+
.PHONY: distclean
31+
distclean:
32+
rm -rf ./nodejs/node_modules
33+
34+
35+
#### check markdown
36+
37+
## run remark markdown checker based on configuration in .remarkrc
38+
.PHONY: check-markdown
39+
check-markdown: nodejs/node_modules/remark nodejs/remark/.remarkrc $(SOURCEPATH) $(BUILD_DIR) Makefile
40+
## run remark, paste output to temporary file
41+
cd nodejs; ./node_modules/.bin/remark ../$(SOURCEPATH) --no-color -q --config-path ./remark/.remarkrc 1> ../$(BUILD_DIR)/$(SOURCEFILE).fixed --frail
42+
43+
## show a diff with changes remark suggests
44+
.PHONY: show-diff
45+
show-diff: nodejs/node_modules/remark nodejs/remark/.remarkrc $(SOURCEPATH) $(BUILD_DIR) Makefile
46+
cd nodejs; ./node_modules/.bin/remark ../$(SOURCEPATH) --no-color -q --config-path ./remark/.remarkrc 1> ../$(BUILD_DIR)/$(SOURCEFILE).fixed
47+
## compare temporary file to original, error and fail with message if differences exist
48+
diff $(SOURCEPATH) $(BUILD_DIR)/$(SOURCEFILE).fixed -u3 || \
49+
(echo "Error: remark found bad markdown syntax, see output above" && false)
50+
51+
52+
.PHONY: check-references
53+
check-references: $(SOURCEPATH) $(BUILD_DIR) Makefile
54+
## check references unique
55+
rm $(BUILD_DIR)/$(SOURCEFILE).uniq
56+
grep -oP '(?<=<a name=")[^\"]+' $(SOURCEPATH) | uniq -d > $(BUILD_DIR)/$(SOURCEFILE).uniq
57+
## check if output has data
58+
if [ -s "build/CppCoreGuidelines.md.uniq" ]; then echo 'Found duplicate anchors:'; cat $(BUILD_DIR)/$(SOURCEFILE).uniq; false; fi
59+
60+
61+
#### install npm modules
62+
# install/update npm dependencies defined in file package.json
63+
# requires npm (nodejs package manager)
64+
nodejs/node_modules/%: nodejs/package.json
65+
@cd nodejs; npm install

scripts/nodejs/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "CppCoreGuidelinesCheck",
3+
"version": "0.0.0",
4+
"description": "CppCoreGuidelines Check",
5+
"private": true,
6+
"dependencies": {
7+
"remark": "^4.2.0",
8+
"remark-lint": "^3.2.0",
9+
"remark-lint-sentence-newline": "^2.0.0",
10+
"remark-validate-links": "^3.0.0"
11+
}
12+
}

scripts/nodejs/remark/.remarkrc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"plugins": {
3+
"remark-lint": {
4+
"unordered-list-marker-style": "consistent",
5+
"list-item-bullet-indent": false,
6+
"list-item-indent": false,
7+
"list-item-spacing": false,
8+
"no-html": false,
9+
"maximum-line-length": false,
10+
"no-file-name-mixed-case": false,
11+
"heading-increment": false,
12+
"no-multiple-toplevel-headings": false,
13+
"no-consecutive-blank-lines": false,
14+
"maximum-line-length": 9000,
15+
"maximum-heading-length": 300,
16+
"no-heading-punctuation": false,
17+
"no-duplicate-headings": false,
18+
"emphasis-marker": "*",
19+
"no-tabs": false,
20+
"blockquote-indentation": false,
21+
"strong-marker": "*"
22+
}
23+
},
24+
"settings": {
25+
"bullet": "*",
26+
"listItemIndent": "1",
27+
"strong": "*",
28+
"emphasis": "*"
29+
}
30+
31+
}

0 commit comments

Comments
 (0)