Skip to content

Commit 884df1f

Browse files
authored
Review Test (#118)
* Failure Testing Commit * chmod +x * fix path * add tranvis env * add nits * remove circle ci * change to ruby * use ruby instead of node * fix version * fix version * addd npm install * fix eslint * fix ruby version * add diff * add git fetch * add comments * use ruby * use node * fix lint
1 parent 4de2739 commit 884df1f

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ node_js: "stable"
44
after_success:
55
- npm run travis:coverage
66
after_failure:
7-
- sh .travis/review-textlint.sh
7+
- ./.travis/review-textlint.sh
88
cache:
99
directories:
1010
- node_modules

.travis/review-textlint.sh

100644100755
Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,46 @@
11
#!/bin/bash
2-
if [ "$CI_PULL_REQUEST" == false ] || [ -z "$CI_PULL_REQUEST" ]; then
2+
3+
# Test if pull request
4+
if [ "$TRAVIS_PULL_REQUEST" = "false" ] || [ -z "$TRAVIS_PULL_REQUEST" ]; then
35
echo 'not pull request.'
46
exit 0
57
fi
68

9+
# Fetch other branch
10+
# To avoid ambiguous argument
11+
# http://stackoverflow.com/questions/37303969/git-fatal-ambiguous-argument-head-unknown-revision-or-path-not-in-the-workin
12+
if [ "$TRAVIS" == "true" ]; then
13+
#resolving `detached HEAD` by attaching HEAD to the `TRAVIS_FROM_BRANCH` branch
14+
TRAVIS_FROM_BRANCH="travis_from_branch"
15+
git branch $TRAVIS_FROM_BRANCH
16+
git checkout $TRAVIS_FROM_BRANCH
17+
18+
#fetching `TRAVIS_BRANCH` branch
19+
git fetch origin $TRAVIS_BRANCH
20+
git checkout -qf FETCH_HEAD
21+
git branch $TRAVIS_BRANCH
22+
git checkout $TRAVIS_BRANCH
23+
24+
#switch to `TRAVIS_FROM_BRANCH`
25+
git checkout $TRAVIS_FROM_BRANCH
26+
fi
27+
28+
# Install saddler
29+
# https://github.com/packsaddle/ruby-saddler
30+
# Need secret env: `GITHUB_ACCESS_TOKEN=xxx`
731
gem install --no-document checkstyle_filter-git saddler saddler-reporter-github
832

933
# Diff Target Branch
1034
# diff HEAD...target
1135
# http://stackoverflow.com/questions/3161204/find-the-parent-branch-of-a-git-branch
1236
# http://qiita.com/upinetree/items/0b74b08b64442f0a89b9
13-
diffBranchName=$(git show-branch | grep '*' | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -1 | awk -F'[]~^[]' '{print $2}')
14-
# 変更行のみを対象にする
37+
declare diffBranchName=$(git show-branch | grep '*' | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -1 | awk -F'[]~^[]' '{print $2}')
38+
39+
# filter files and lint
40+
echo "${diffBranchName}...HEAD"
41+
echo "textlint -> review_comments"
1542
git diff --name-only --diff-filter=ACMR ${diffBranchName} \
16-
| grep -a '*.md$' \
43+
| grep -a '.*.md$' \
1744
| xargs $(npm bin)/textlint -f checkstyle \
1845
| checkstyle_filter-git diff ${diffBranchName} \
1946
| saddler report \

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"start": "gitbook serve",
2323
"build": "gitbook build",
2424
"eslint": "eslint src/**/*.js",
25-
"eslint:md": "eslint -c .md.eslintrc --ext .md ja/**/*.md",
25+
"eslint:md": "summary-to-path | xargs eslint -c .md.eslintrc --ext .md",
2626
"textlint": "summary-to-path | xargs textlint --experimental -f pretty-error",
2727
"test:example": "find ./src -name '*-example.js' | xargs babel-node",
2828
"test:js": "mocha",

test/prh.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ rules:
33
# ルールの書き方については https://github.com/vvakame/prh を参照する
44
# https://github.com/vvakame/prh/blob/master/misc/prh.yml
55
# プロジェクト固有の単語
6+
- expected: jQuery
67
- expected: ESLint
78

89
- expected: Connect

0 commit comments

Comments
 (0)