From 8ccd684945b3bfd5f2c2d51e159e7eb8b7c5f099 Mon Sep 17 00:00:00 2001 From: Aylei Date: Mon, 5 Aug 2019 11:53:08 +0800 Subject: [PATCH] *: add marklint check for changed files in PR (#1406) * *: Add marklint check for docs Signed-off-by: Aylei * Trigger check Signed-off-by: Aylei * add the rule number for each lint rule --- circle.yml => .circleci/config.yml | 44 ++++++++++++-- .markdownlint.yaml | 97 ++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 4 deletions(-) rename circle.yml => .circleci/config.yml (62%) create mode 100644 .markdownlint.yaml diff --git a/circle.yml b/.circleci/config.yml similarity index 62% rename from circle.yml rename to .circleci/config.yml index 022e622f3f525..b41378654ba56 100644 --- a/circle.yml +++ b/.circleci/config.yml @@ -1,14 +1,36 @@ version: 2 jobs: + lint: + docker: + - image: circleci/ruby:2.4.1-node + working_directory: ~/pingcap/docs + steps: + - checkout + + - run: + name: "Install markdownlint" + command: | + sudo npm install -g markdownlint-cli + markdownlint --version + + - run: + name: "Lint README" + command: markdownlint README.md + + - run: + name: "Lint edited files" + command: | + git remote add upstream https://github.com/pingcap/docs.git + git fetch upstream + markdownlint $(git diff-tree --name-only --no-commit-id -r upstream/master..HEAD -- '*.md' ':(exclude).github/*' ':(exclude)v1.0/*' ':(exclude)v2.0/*' ':(exclude)v2.1-legacy/*') + + build: docker: - image: andelf/doc-build:0.1.9 working_directory: ~/pingcap/docs - branches: - only: - - master - - website-preview + steps: - checkout @@ -46,3 +68,17 @@ jobs: - store_artifacts: path: /tmp/artifacts + +workflows: + version: 2 + lint: + jobs: + - lint + build: + jobs: + - build: + filters: + branches: + only: + - master + - website-preview diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000000000..954f0c334c32d --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,97 @@ +comment: 'Rules for PingCAP docs' + +# disable all by default +default: false + +# MD001 +heading-increment: true + +# MD003 +heading-style: + style: atx + +# MD009 +no-trailing-spaces: true + +# MD010 +no-hard-tabs: true + +# MD007 +ul-indent: + indent: 4 + +# MD012 +no-multiple-blanks: true + +# commands-show-output: true + +# MD018 +no-missing-space-atx: true + +# MD019 +no-multiple-space-atx: true + +# MD022 +blanks-around-headings: true + +# MD023 +heading-start-left: true + +# MD024 +no-duplicate-heading: + siblings_only: true + +# MD025 +single-title: + front_matter_title: '' + +# MD026 +no-trailing-punctuation: + punctuation: '.,;:!。,;:!' + +# MD027 +no-multiple-space-blockquote: true + +# MD029 +ol-prefix: + style: ordered + +# MD030 +list-marker-space: true + +# MD031 +blanks-around-fences: true + +# MD032 +blanks-around-lists: true + +# MD034 +no-bare-urls: true + +# MD037 +no-space-in-emphasis: true + +# MD038 +no-space-in-code: true + +# MD039 +no-space-in-links: true + +# MD042 +no-empty-links: true + +# proper-names: +# names: ['TiDB', 'TiKV', 'PingCAP'] +# code_blocks: false + +# MD045 +no-alt-text: true + +# MD046 +code-block-style: + style: fenced + +# single-trailing-newline: true + +# MD041 +first-line-heading: true