saddler 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +1 -0
- data/LICENSE.txt +0 -0
- data/README.md +113 -6
- data/Rakefile +0 -0
- data/bin/run-rubocop.sh +42 -0
- data/example/invalid.rb +1 -1
- data/example/rubocop-result.xml +0 -0
- data/example/run-gradle-android.sh +81 -0
- data/example/run-jscs.sh +52 -0
- data/example/run-rubocop.sh +45 -0
- data/example/run-simultaneously.sh +50 -0
- data/example/simple.txt +0 -0
- data/example/travis-spellcheck.sh +32 -0
- data/lib/saddler.rb +0 -0
- data/lib/saddler/cli.rb +2 -2
- data/lib/saddler/error.rb +0 -0
- data/lib/saddler/reporter.rb +0 -0
- data/lib/saddler/validator.rb +0 -0
- data/lib/saddler/version.rb +1 -1
- data/saddler.gemspec +11 -11
- metadata +17 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90de16f70529d228d4107d32dd86a8d46d53bcc9
|
4
|
+
data.tar.gz: 423fdbb3569ffefa1ed47e2c9fa4a3480b371734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a065a8eb93f59f86b0b3bce0d853f745e6d337e6c5c811a2826485b16c9c6843692ef7dec1d639b7cf88f785bab3258355730fc2b954861427741f2a6b89128a
|
7
|
+
data.tar.gz: 8146dca6086cf71854dd6634936d04325db677147cd39a2c4fee70874bb2821e3cd6e5f678a8802b5ab0b4dce7d8cd5265de804bd33605ba7ebb88c81b241a41
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -3,16 +3,21 @@
|
|
3
3
|
[](http://badge.fury.io/rb/saddler)
|
4
4
|
[](https://travis-ci.org/packsaddle/ruby-saddler)
|
5
5
|
|
6
|
-
|
6
|
+
To effectively use your lint messages!
|
7
|
+
|
8
|
+
**checkstyle2anywhere**, you can integrate any lint, security checker and tools with anywhere (e.g. GitHub Pull Request Review Comment.)
|
9
|
+
|
7
10
|
|
8
11
|
### Pull Request Review Comment
|
9
12
|
|
10
13
|

|
11
14
|
|
15
|
+
|
12
16
|
### Pull Request Comment
|
13
17
|
|
14
18
|

|
15
19
|
|
20
|
+
|
16
21
|
## Usage
|
17
22
|
|
18
23
|
```
|
@@ -31,18 +36,118 @@ It works!
|
|
31
36
|
|
32
37
|
You can run this from any CI Service (e.g. circle-ci, travis-ci, jenkins, etc).
|
33
38
|
|
39
|
+
|
34
40
|
## Reporters
|
35
41
|
|
36
42
|
* [saddler-reporter-text](https://github.com/packsaddle/ruby-saddler-reporter-text)
|
37
43
|
* [saddler-reporter-github](https://github.com/packsaddle/ruby-saddler-reporter-github)
|
38
44
|
|
39
|
-
|
45
|
+
|
46
|
+
## Requirement
|
47
|
+
|
48
|
+
Set `GITHUB_ACCESS_TOKEN=__your_access_token__` to your environment variable.
|
49
|
+
|
50
|
+
|
51
|
+
### TravisCI
|
52
|
+
|
53
|
+
[Travis CI: Encryption keys](http://docs.travis-ci.com/user/encryption-keys/)
|
54
|
+
|
55
|
+
```bash
|
56
|
+
$ gem install travis
|
57
|
+
$ travis encrypt -r <owner_name>/<repos_name> "GITHUB_ACCESS_TOKEN=<github_token>"
|
58
|
+
```
|
59
|
+
|
60
|
+
|
61
|
+
### CircleCI
|
62
|
+
|
63
|
+
[Environment variables - CircleCI](https://circleci.com/docs/environment-variables)
|
64
|
+
|
65
|
+
|
66
|
+
## Demo
|
40
67
|
You can send pull request to repos below. Try this!
|
41
68
|
|
42
|
-
*
|
43
|
-
* [
|
44
|
-
* [
|
45
|
-
* [
|
69
|
+
* TravisCI
|
70
|
+
* [Pull Request Review Comment (RuboCop)](https://github.com/packsaddle/example-travis_ci-pull_request_review)
|
71
|
+
* [Pull Request Comment (RuboCop)](https://github.com/packsaddle/example-travis_ci-pull_request)
|
72
|
+
* [Pull Request Review Comment (JSCS)](https://github.com/packsaddle/example-travis_ci-pull_request_review-jscs)
|
73
|
+
* CircleCI
|
74
|
+
* [Pull Request Review Comment (RuboCop)](https://github.com/packsaddle/example-circle_ci-pull_request_review)
|
75
|
+
* [Pull Request Comment (RuboCop)](https://github.com/packsaddle/example-circle_ci-pull_request)
|
76
|
+
* [Pull Request Review Comment (JSCS)](https://github.com/packsaddle/example-circle_ci-pull_request_review-jscs)
|
77
|
+
|
78
|
+
|
79
|
+
## Examples
|
80
|
+
|
81
|
+
* textlint
|
82
|
+
* [jser/jser.github.io/test/travis-spellcheck.sh](./example/travis-spellcheck.sh) ([link](https://github.com/jser/jser.github.io/blob/6df31731656e0ebf04f84b92e5ae3d98096214b7/test/travis-spellcheck.sh))
|
83
|
+
* RuboCop
|
84
|
+
* [packsaddle/ruby-saddler/bin/run-rubocop.sh](./example/run-rubocop.sh) ([link](https://github.com/packsaddle/ruby-saddler/blob/f0abab9d0c43a0a062c1f062000680a49ddb27a2/bin/run-rubocop.sh))
|
85
|
+
* JSCS
|
86
|
+
* [run-jscs.sh](./example/run-jscs.sh)
|
87
|
+
* Use multiple reporters simultaneously
|
88
|
+
* [Saddler::Reporter::Text and Saddler::Reporter::Github::PullRequestReviewComment](./example/run-simultaneously.sh)
|
89
|
+
* Gradle android - Checkstyle, FindBugs, PMD, CPD, Android Lint
|
90
|
+
* [noboru-i/android-saddler-sample/scripts/saddler.sh](./example/run-gradle-android.sh) ([link](https://github.com/noboru-i/android-saddler-sample/blob/626fc93c6693144bd069db563836a856f401864a/scripts/saddler.sh))
|
91
|
+
|
92
|
+
|
93
|
+
## Articles
|
94
|
+
|
95
|
+
### ja
|
96
|
+
|
97
|
+
* [jser/jser.github.ioの記事をpull request時にLintする仕組み | Web Scratch](http://efcl.info/2015/03/04/linting-article/)
|
98
|
+
* [変更したファイルにrubocopやjscsを実行して pull requestに自動でコメントする – Saddler - checkstyle to anywhere](http://packsaddle.org/articles/saddler-overview/)
|
99
|
+
* [CircleCI - Androidのコードを自動で解析し、GitHubのpull requestにコメントする - Qiita](http://qiita.com/noboru_i/items/2f30296db1c8a6dfbd9b)
|
100
|
+
* [pull requestした差分にrubocopの結果を自動でコメントしてCircleCIをfailedにするよ - Qiita](http://qiita.com/nifuramu/items/e7490e86b7b67d99ac87)
|
101
|
+
|
102
|
+
### vi
|
103
|
+
* [Saddler – công cụ giúp CI chạy rubocop và comment lỗi trực tiếp vào pull request. – Appconus Blog](http://blog.appconus.com/2015/11/19/saddler-cong-cu-giup-ci-chay-rubocop-va-comment-loi-truc-tiep-vao-pull-request/)
|
104
|
+
|
105
|
+
## VS.
|
106
|
+
|
107
|
+
### [Hound (web service)](https://houndci.com/)
|
108
|
+
|
109
|
+
Easy to configure, only allow GitHub oAuth.
|
110
|
+
Very quick response,
|
111
|
+
because Hound uses not entire code base but pull request hook's payload.
|
112
|
+
But Hound focuses on RuboCop and JavaScript linters wrapped by Rubygems.
|
113
|
+
JavaScript libraries wrapped by Rubygems have code smells.
|
114
|
+
|
115
|
+
|
116
|
+
### [Hound (oss)](https://github.com/thoughtbot/hound)
|
117
|
+
|
118
|
+
You can host *own* Hound.
|
119
|
+
If you like caring hosted rails application.
|
120
|
+
|
121
|
+
|
122
|
+
### [Pronto](https://github.com/mmozuras/pronto)
|
123
|
+
|
124
|
+
Pronto is good application, and pronto influences saddler.
|
125
|
+
Pronto's command seems simple, but this is "tightly-coupled" command.
|
126
|
+
Pronto requires pronto-SOME-WRAPPER, and you should maintain wrapper scripts.
|
127
|
+
Almost all of linters have their own command line interface.
|
128
|
+
Why don't you use that direct?
|
129
|
+
|
130
|
+
|
131
|
+
## FAQ
|
132
|
+
|
133
|
+
Q: Is there the way to share in the command line?
|
134
|
+
|
135
|
+
A: I think that sharing the command line is not a simple solution.
|
136
|
+
|
137
|
+
We can call `saddler report` multiple times.
|
138
|
+
If we want to run Saddler only once, we can create "merged checkstyle file" before calling `saddler report`.
|
139
|
+
|
140
|
+
```
|
141
|
+
merge-checkstyle (command-a ...) (command-b ...) \
|
142
|
+
| saddler report ...
|
143
|
+
```
|
144
|
+
|
145
|
+
This requires `merge-checkstyle` command, I'm not sure that this command exists. I search "checkstyle" in rubygems, but I don't find such gem.
|
146
|
+
|
147
|
+
|
148
|
+
Q: Does Saddler support using both the text and Github reporters simultaneously?
|
149
|
+
|
150
|
+
A: Use `tee`. See [Saddler::Reporter::Text and Saddler::Reporter::Github::PullRequestReviewComment](./example/run-simultaneously.sh).
|
46
151
|
|
47
152
|
## Installation
|
48
153
|
|
@@ -60,12 +165,14 @@ Or install it yourself as:
|
|
60
165
|
|
61
166
|
$ gem install saddler
|
62
167
|
|
168
|
+
|
63
169
|
## Development
|
64
170
|
|
65
171
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec saddler` to use the code located in this directory, ignoring other installed copies of this gem.
|
66
172
|
|
67
173
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
68
174
|
|
175
|
+
|
69
176
|
## Contributing
|
70
177
|
|
71
178
|
1. Fork it ( https://github.com/packsaddle/ruby-saddler/fork )
|
data/Rakefile
CHANGED
File without changes
|
data/bin/run-rubocop.sh
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -v
|
3
|
+
if [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
|
4
|
+
# Travis-CI
|
5
|
+
#
|
6
|
+
# git clone --depth=50 \
|
7
|
+
# git://github.com/packsaddle/example-ruby-travis-ci.git \
|
8
|
+
# packsaddle/example-ruby-travis-ci
|
9
|
+
# cd packsaddle/example-ruby-travis-ci
|
10
|
+
# git fetch origin +refs/pull/1/merge:
|
11
|
+
# git checkout -qf FETCH_HEAD
|
12
|
+
|
13
|
+
echo gem install
|
14
|
+
gem install --no-document rubocop-select rubocop rubocop-checkstyle_formatter \
|
15
|
+
checkstyle_filter-git saddler saddler-reporter-github \
|
16
|
+
github_status_notifier
|
17
|
+
|
18
|
+
github-status-notifier notify --state pending --context saddler/rubocop
|
19
|
+
|
20
|
+
TARGET_FILES=$(git diff -z --name-only origin/master \
|
21
|
+
| xargs -0 rubocop-select)
|
22
|
+
|
23
|
+
if [ "${TARGET_FILES}" == "" ]; then
|
24
|
+
echo "no rubocop target found"
|
25
|
+
github-status-notifier notify --state success --context saddler/rubocop
|
26
|
+
exit 0
|
27
|
+
fi
|
28
|
+
|
29
|
+
git diff -z --name-only origin/master \
|
30
|
+
| xargs -0 rubocop-select \
|
31
|
+
| xargs rubocop \
|
32
|
+
--require rubocop/formatter/checkstyle_formatter \
|
33
|
+
--format RuboCop::Formatter::CheckstyleFormatter \
|
34
|
+
| checkstyle_filter-git diff origin/master \
|
35
|
+
| saddler report \
|
36
|
+
--require saddler/reporter/github \
|
37
|
+
--reporter Saddler::Reporter::Github::PullRequestReviewComment
|
38
|
+
|
39
|
+
github-status-notifier notify --exit-status $? --context saddler/rubocop
|
40
|
+
fi
|
41
|
+
|
42
|
+
exit 0
|
data/example/invalid.rb
CHANGED
data/example/rubocop-result.xml
CHANGED
File without changes
|
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Copyright (c) 2015 noboru-i
|
4
|
+
# https://github.com/noboru-i/android-saddler-sample/blob/master/scripts/saddler.sh
|
5
|
+
|
6
|
+
echo "********************"
|
7
|
+
echo "* install gems *"
|
8
|
+
echo "********************"
|
9
|
+
gem install --no-document checkstyle_filter-git saddler saddler-reporter-github findbugs_translate_checkstyle_format android_lint_translate_checkstyle_format pmd_translate_checkstyle_format
|
10
|
+
|
11
|
+
if [ $? -ne 0 ]; then
|
12
|
+
echo 'Failed to install gems.'
|
13
|
+
exit 1
|
14
|
+
fi
|
15
|
+
|
16
|
+
echo "********************"
|
17
|
+
echo "* exec gradle *"
|
18
|
+
echo "********************"
|
19
|
+
./gradlew app:check
|
20
|
+
|
21
|
+
if [ $? -ne 0 ]; then
|
22
|
+
echo 'Failed gradle check task.'
|
23
|
+
exit 1
|
24
|
+
fi
|
25
|
+
|
26
|
+
echo "********************"
|
27
|
+
echo "* save outputs *"
|
28
|
+
echo "********************"
|
29
|
+
|
30
|
+
LINT_RESULT_DIR="$CIRCLE_ARTIFACTS/lint"
|
31
|
+
|
32
|
+
mkdir "$LINT_RESULT_DIR"
|
33
|
+
cp -v "app/build/reports/checkstyle/checkstyle.xml" "$LINT_RESULT_DIR/"
|
34
|
+
cp -v "app/build/reports/findbugs/findbugs.xml" "$LINT_RESULT_DIR/"
|
35
|
+
cp -v "app/build/outputs/lint-results.xml" "$LINT_RESULT_DIR/"
|
36
|
+
|
37
|
+
if [ -z "${CI_PULL_REQUEST}" ]; then
|
38
|
+
# when not pull request
|
39
|
+
REPORTER=Saddler::Reporter::Github::CommitReviewComment
|
40
|
+
else
|
41
|
+
REPORTER=Saddler::Reporter::Github::PullRequestReviewComment
|
42
|
+
fi
|
43
|
+
|
44
|
+
echo "********************"
|
45
|
+
echo "* checkstyle *"
|
46
|
+
echo "********************"
|
47
|
+
cat app/build/reports/checkstyle/checkstyle.xml \
|
48
|
+
| checkstyle_filter-git diff origin/master \
|
49
|
+
| saddler report --require saddler/reporter/github --reporter $REPORTER
|
50
|
+
|
51
|
+
echo "********************"
|
52
|
+
echo "* findbugs *"
|
53
|
+
echo "********************"
|
54
|
+
cat app/build/reports/findbugs/findbugs.xml \
|
55
|
+
| findbugs_translate_checkstyle_format translate \
|
56
|
+
| checkstyle_filter-git diff origin/master \
|
57
|
+
| saddler report --require saddler/reporter/github --reporter $REPORTER
|
58
|
+
|
59
|
+
echo "********************"
|
60
|
+
echo "* PMD *"
|
61
|
+
echo "********************"
|
62
|
+
cat app/build/reports/pmd/pmd.xml \
|
63
|
+
| pmd_translate_checkstyle_format translate \
|
64
|
+
| checkstyle_filter-git diff origin/master \
|
65
|
+
| saddler report --require saddler/reporter/github --reporter $REPORTER
|
66
|
+
|
67
|
+
echo "********************"
|
68
|
+
echo "* PMD-CPD *"
|
69
|
+
echo "********************"
|
70
|
+
cat app/build/reports/pmd/cpd.xml \
|
71
|
+
| pmd_translate_checkstyle_format translate --cpd-translate \
|
72
|
+
| checkstyle_filter-git diff origin/master \
|
73
|
+
| saddler report --require saddler/reporter/github --reporter $REPORTER
|
74
|
+
|
75
|
+
echo "********************"
|
76
|
+
echo "* android lint *"
|
77
|
+
echo "********************"
|
78
|
+
cat app/build/outputs/lint-results.xml \
|
79
|
+
| android_lint_translate_checkstyle_format translate \
|
80
|
+
| checkstyle_filter-git diff origin/master \
|
81
|
+
| saddler report --require saddler/reporter/github --reporter $REPORTER
|
data/example/run-jscs.sh
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -v
|
3
|
+
# Copyright (c) 2015 sanemat
|
4
|
+
# License MIT
|
5
|
+
# https://github.com/packsaddle/example-travis_ci-pull_request_review-jscs/blob/master/bin/run-jscs.sh
|
6
|
+
if [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
|
7
|
+
# Travis-CI
|
8
|
+
#
|
9
|
+
# git clone --depth=50 \
|
10
|
+
# git://github.com/packsaddle/example-ruby-travis-ci.git \
|
11
|
+
# packsaddle/example-ruby-travis-ci
|
12
|
+
# cd packsaddle/example-ruby-travis-ci
|
13
|
+
# git fetch origin +refs/pull/1/merge:
|
14
|
+
# git checkout -qf FETCH_HEAD
|
15
|
+
|
16
|
+
NOTIFIER_CONTEXT="saddler/jscs"
|
17
|
+
echo gem install
|
18
|
+
gem install --no-document checkstyle_filter-git saddler saddler-reporter-github \
|
19
|
+
github_status_notifier
|
20
|
+
|
21
|
+
github-status-notifier notify --state pending --context "${NOTIFIER_CONTEXT}"
|
22
|
+
|
23
|
+
# Check diff
|
24
|
+
echo "gif diff"
|
25
|
+
git diff --name-only origin/master \
|
26
|
+
| grep '.*\.js$' || RETURN_CODE=$?
|
27
|
+
|
28
|
+
case "$RETURN_CODE" in
|
29
|
+
"" ) echo "diff found" ;;
|
30
|
+
"1" )
|
31
|
+
echo "diff not found"
|
32
|
+
github-status-notifier notify --state success --context "${NOTIFIER_CONTEXT}"
|
33
|
+
exit 0 ;;
|
34
|
+
* )
|
35
|
+
echo "Error"
|
36
|
+
github-status-notifier notify --state error --context "${NOTIFIER_CONTEXT}"
|
37
|
+
exit $RETURN_CODE ;;
|
38
|
+
esac
|
39
|
+
|
40
|
+
git diff --name-only origin/master \
|
41
|
+
| grep '.*\.js$' \
|
42
|
+
| xargs $(npm bin)/jscs \
|
43
|
+
--reporter checkstyle \
|
44
|
+
| checkstyle_filter-git diff origin/master \
|
45
|
+
| saddler report \
|
46
|
+
--require saddler/reporter/github \
|
47
|
+
--reporter Saddler::Reporter::Github::PullRequestReviewComment
|
48
|
+
|
49
|
+
github-status-notifier notify --exit-status $? --context "${NOTIFIER_CONTEXT}"
|
50
|
+
fi
|
51
|
+
|
52
|
+
exit 0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -v
|
3
|
+
# Copyright (c) 2015 sanemat
|
4
|
+
# License MIT
|
5
|
+
# https://github.com/packsaddle/ruby-saddler/blob/master/bin/run-rubocop.sh
|
6
|
+
if [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
|
7
|
+
# Travis-CI
|
8
|
+
#
|
9
|
+
# git clone --depth=50 \
|
10
|
+
# git://github.com/packsaddle/example-ruby-travis-ci.git \
|
11
|
+
# packsaddle/example-ruby-travis-ci
|
12
|
+
# cd packsaddle/example-ruby-travis-ci
|
13
|
+
# git fetch origin +refs/pull/1/merge:
|
14
|
+
# git checkout -qf FETCH_HEAD
|
15
|
+
|
16
|
+
echo gem install
|
17
|
+
gem install --no-document rubocop-select rubocop rubocop-checkstyle_formatter \
|
18
|
+
checkstyle_filter-git saddler saddler-reporter-github \
|
19
|
+
github_status_notifier
|
20
|
+
|
21
|
+
github-status-notifier notify --state pending --context saddler/rubocop
|
22
|
+
|
23
|
+
TARGET_FILES=$(git diff -z --name-only origin/master \
|
24
|
+
| xargs -0 rubocop-select)
|
25
|
+
|
26
|
+
if [ "${TARGET_FILES}" == "" ]; then
|
27
|
+
echo "no rubocop target found"
|
28
|
+
github-status-notifier notify --state success --context saddler/rubocop
|
29
|
+
exit 0
|
30
|
+
fi
|
31
|
+
|
32
|
+
git diff -z --name-only origin/master \
|
33
|
+
| xargs -0 rubocop-select \
|
34
|
+
| xargs rubocop \
|
35
|
+
--require rubocop/formatter/checkstyle_formatter \
|
36
|
+
--format RuboCop::Formatter::CheckstyleFormatter \
|
37
|
+
| checkstyle_filter-git diff origin/master \
|
38
|
+
| saddler report \
|
39
|
+
--require saddler/reporter/github \
|
40
|
+
--reporter Saddler::Reporter::Github::PullRequestReviewComment
|
41
|
+
|
42
|
+
github-status-notifier notify --exit-status $? --context saddler/rubocop
|
43
|
+
fi
|
44
|
+
|
45
|
+
exit 0
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -v
|
3
|
+
# Copyright (c) 2015 sanemat
|
4
|
+
# License MIT
|
5
|
+
# https://github.com/packsaddle/ruby-saddler/blob/master/bin/run-simultaneously.sh
|
6
|
+
if [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
|
7
|
+
# Travis-CI
|
8
|
+
#
|
9
|
+
# git clone --depth=50 \
|
10
|
+
# git://github.com/packsaddle/example-ruby-travis-ci.git \
|
11
|
+
# packsaddle/example-ruby-travis-ci
|
12
|
+
# cd packsaddle/example-ruby-travis-ci
|
13
|
+
# git fetch origin +refs/pull/1/merge:
|
14
|
+
# git checkout -qf FETCH_HEAD
|
15
|
+
|
16
|
+
echo gem install
|
17
|
+
gem install --no-document rubocop-select rubocop rubocop-checkstyle_formatter \
|
18
|
+
checkstyle_filter-git saddler saddler-reporter-github \
|
19
|
+
github_status_notifier
|
20
|
+
|
21
|
+
github-status-notifier notify --state pending --context saddler/rubocop
|
22
|
+
|
23
|
+
TARGET_FILES=$(git diff -z --name-only origin/master \
|
24
|
+
| xargs -0 rubocop-select)
|
25
|
+
|
26
|
+
if [ "${TARGET_FILES}" == "" ]; then
|
27
|
+
echo "no rubocop target found"
|
28
|
+
github-status-notifier notify --state success --context saddler/rubocop
|
29
|
+
exit 0
|
30
|
+
fi
|
31
|
+
|
32
|
+
git diff -z --name-only origin/master \
|
33
|
+
| xargs -0 rubocop-select \
|
34
|
+
| xargs rubocop \
|
35
|
+
--require rubocop/formatter/checkstyle_formatter \
|
36
|
+
--format RuboCop::Formatter::CheckstyleFormatter \
|
37
|
+
| checkstyle_filter-git diff origin/master \
|
38
|
+
| tee >( \
|
39
|
+
saddler report \
|
40
|
+
--require saddler/reporter/text \
|
41
|
+
--reporter Saddler::Reporter::Text \
|
42
|
+
) \
|
43
|
+
| saddler report \
|
44
|
+
--require saddler/reporter/github \
|
45
|
+
--reporter Saddler::Reporter::Github::PullRequestReviewComment
|
46
|
+
|
47
|
+
github-status-notifier notify --exit-status $? --context saddler/rubocop
|
48
|
+
fi
|
49
|
+
|
50
|
+
exit 0
|
data/example/simple.txt
CHANGED
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e
|
3
|
+
# Copyright (c) 2015 azu
|
4
|
+
# License MIT
|
5
|
+
# https://github.com/jser/jser.github.io/blob/master/test/travis-spellcheck.sh
|
6
|
+
if [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
|
7
|
+
gem install --no-document checkstyle_filter-git saddler saddler-reporter-github
|
8
|
+
|
9
|
+
echo "gif diff"
|
10
|
+
git diff --name-only origin/master \
|
11
|
+
| grep -a '\.md$' || RETURN_CODE=$?
|
12
|
+
|
13
|
+
case "$RETURN_CODE" in
|
14
|
+
"" ) echo "found" ;;
|
15
|
+
"1" )
|
16
|
+
echo "not found"
|
17
|
+
exit 0 ;;
|
18
|
+
* )
|
19
|
+
echo "Error"
|
20
|
+
exit $RETURN_CODE ;;
|
21
|
+
esac
|
22
|
+
|
23
|
+
# 変更行のみを対象にする
|
24
|
+
git diff --name-only origin/master \
|
25
|
+
| grep -a '\.md$' \
|
26
|
+
| xargs $(npm bin)/textlint --rulesdir test/rules -f checkstyle \
|
27
|
+
| checkstyle_filter-git diff origin/master \
|
28
|
+
| saddler report \
|
29
|
+
--require saddler/reporter/github \
|
30
|
+
--reporter Saddler::Reporter::Github::PullRequestReviewComment
|
31
|
+
fi
|
32
|
+
exit 0
|
data/lib/saddler.rb
CHANGED
File without changes
|
data/lib/saddler/cli.rb
CHANGED
@@ -63,14 +63,14 @@ module Saddler
|
|
63
63
|
|
64
64
|
logger.info('input data')
|
65
65
|
logger.info(data)
|
66
|
-
|
66
|
+
raise NoInputError if !data || data.empty?
|
67
67
|
|
68
68
|
data
|
69
69
|
end
|
70
70
|
|
71
71
|
def add_reporter(options)
|
72
72
|
reporter = Reporter.add_reporter(options[:reporter], $stdout) if options[:reporter]
|
73
|
-
|
73
|
+
raise NoReporterError unless reporter
|
74
74
|
logger.info('use reporter')
|
75
75
|
logger.info(reporter)
|
76
76
|
reporter
|
data/lib/saddler/error.rb
CHANGED
File without changes
|
data/lib/saddler/reporter.rb
CHANGED
File without changes
|
data/lib/saddler/validator.rb
CHANGED
File without changes
|
data/lib/saddler/version.rb
CHANGED
data/saddler.gemspec
CHANGED
@@ -16,15 +16,15 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.files = \
|
18
18
|
`git ls-files -z`
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
.split("\x0")
|
20
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
.reject do |f|
|
22
|
+
[
|
23
|
+
'.travis.yml',
|
24
|
+
'circle.yml',
|
25
|
+
'.tachikoma.yml'
|
26
|
+
].include?(f)
|
27
|
+
end
|
28
28
|
spec.bindir = 'exe'
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_runtime_dependency 'thor'
|
33
33
|
spec.add_runtime_dependency 'saddler-reporter-text'
|
34
34
|
|
35
|
-
spec.add_development_dependency 'bundler'
|
36
|
-
spec.add_development_dependency 'rake'
|
35
|
+
spec.add_development_dependency 'bundler'
|
36
|
+
spec.add_development_dependency 'rake'
|
37
37
|
spec.add_development_dependency 'test-unit'
|
38
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saddler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanemat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: test-unit
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,10 +97,16 @@ files:
|
|
97
97
|
- README.md
|
98
98
|
- Rakefile
|
99
99
|
- bin/console
|
100
|
+
- bin/run-rubocop.sh
|
100
101
|
- bin/setup
|
101
102
|
- example/invalid.rb
|
102
103
|
- example/rubocop-result.xml
|
104
|
+
- example/run-gradle-android.sh
|
105
|
+
- example/run-jscs.sh
|
106
|
+
- example/run-rubocop.sh
|
107
|
+
- example/run-simultaneously.sh
|
103
108
|
- example/simple.txt
|
109
|
+
- example/travis-spellcheck.sh
|
104
110
|
- exe/saddler
|
105
111
|
- lib/saddler.rb
|
106
112
|
- lib/saddler/cli.rb
|
@@ -129,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
135
|
version: '0'
|
130
136
|
requirements: []
|
131
137
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.5.1
|
133
139
|
signing_key:
|
134
140
|
specification_version: 4
|
135
141
|
summary: Saddler.
|