saddler 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +25 -4
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/example/invalid.rb +3 -0
- data/example/rubocop-result.xml +6 -0
- data/example/simple.txt +13 -0
- data/lib/saddler/cli.rb +4 -7
- data/lib/saddler/version.rb +1 -1
- data/saddler.gemspec +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e3cbd21f10fa179c70115b166487b2801affe9f
|
4
|
+
data.tar.gz: 7d52f4d658b072a55228af8bf7e6f7ad1b7c8734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3238a6968d4d42c80db96bde6f27646ae5a13355cdbae6826d53e71a2c60403f257a3ea48d64136a03ea1b802f6aa275c5b0a3ab7bdd0dd04640a0d69078bad6
|
7
|
+
data.tar.gz: 7a049c9cc75960625608e315699cf7cb8b638035e4ae24dea1f4c853dba1c0b6e9805c057264989ffc21833e880eee8a36eca78953b7c06143004c7fd46d1cdb
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,31 @@
|
|
3
3
|
[![Gem Version](http://img.shields.io/gem/v/saddler.svg?style=flat)](http://badge.fury.io/rb/saddler)
|
4
4
|
[![Build Status](http://img.shields.io/travis/packsaddle/ruby-saddler/master.svg?style=flat)](https://travis-ci.org/packsaddle/ruby-saddler)
|
5
5
|
|
6
|
+
**checkstyle2anywhere**, you can exec any lint, security checker and tools.
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
```
|
11
|
+
git diff -z --name-only ..origin/master \
|
12
|
+
| xargs -0 rubocop-select \
|
13
|
+
| xargs rubocop \
|
14
|
+
--require rubocop/formatter/checkstyle_formatter \
|
15
|
+
--format RuboCop::Formatter::CheckstyleFormatter \
|
16
|
+
| checkstyle_filter-git diff ..origin/master \
|
17
|
+
| saddler report \
|
18
|
+
--require saddler/reporter/github \
|
19
|
+
--reporter Saddler::Reporter::Github::PullRequestReviewComment
|
20
|
+
```
|
21
|
+
|
22
|
+
It works!
|
23
|
+
|
24
|
+
You can run this from any CI Service (e.g. circle-ci, travis-ci, jenkins, etc).
|
25
|
+
|
26
|
+
## Reporters
|
27
|
+
|
28
|
+
* [saddler-reporter-text](https://github.com/packsaddle/ruby-saddler-reporter-text)
|
29
|
+
* [saddler-reporter-github](https://github.com/packsaddle/ruby-saddler-reporter-github)
|
30
|
+
|
6
31
|
## Installation
|
7
32
|
|
8
33
|
Add this line to your application's Gemfile:
|
@@ -19,10 +44,6 @@ Or install it yourself as:
|
|
19
44
|
|
20
45
|
$ gem install saddler
|
21
46
|
|
22
|
-
## Usage
|
23
|
-
|
24
|
-
TODO: Write usage instructions here
|
25
|
-
|
26
47
|
## Development
|
27
48
|
|
28
49
|
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.
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/example/invalid.rb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
<?xml version='1.0'?>
|
2
|
+
<checkstyle>
|
3
|
+
<file name='/Users/sane/work/ruby-study/saddler/example/invalid.rb'>
|
4
|
+
<error line='2' column='100' severity='info' message='Line is too long. [117/100]' source='com.puppycrawl.tools.checkstyle.Metrics/LineLength'/>
|
5
|
+
</file>
|
6
|
+
</checkstyle>
|
data/example/simple.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
git diff -z --name-only ee0e288...2956a73 \
|
2
|
+
| xargs -0 rubocop-select \
|
3
|
+
| xargs rubocop \
|
4
|
+
--require rubocop/formatter/checkstyle_formatter \
|
5
|
+
--format RuboCop::Formatter::CheckstyleFormatter \
|
6
|
+
> example/rubocop-result.xml
|
7
|
+
|
8
|
+
GITHUB_ACCESS_TOKEN=token \
|
9
|
+
bundle exec exe/saddler report \
|
10
|
+
--file example/rubocop-result.xml \
|
11
|
+
--require saddler/reporter/github \
|
12
|
+
--reporter Saddler::Reporter::Github::CommitReviewComment \
|
13
|
+
--options sha1:ce3b17679fee03a6a3c262a3ad2f881d5fb65ff7
|
data/lib/saddler/cli.rb
CHANGED
@@ -16,13 +16,13 @@ module Saddler
|
|
16
16
|
desc 'report', 'Exec Report'
|
17
17
|
option :data
|
18
18
|
option :file
|
19
|
-
option :
|
19
|
+
option :options, type: :hash, default: {}
|
20
20
|
option :require
|
21
21
|
option :reporter
|
22
22
|
def report
|
23
23
|
data = \
|
24
24
|
if options[:data]
|
25
|
-
|
25
|
+
options[:data]
|
26
26
|
elsif options[:file]
|
27
27
|
File.read(options[:file])
|
28
28
|
elsif !$stdin.tty?
|
@@ -32,16 +32,13 @@ module Saddler
|
|
32
32
|
|
33
33
|
abort('no input') if !data || data.empty?
|
34
34
|
|
35
|
-
pass_options = {}
|
36
|
-
pass_options[:repo] = options[:repo] if options[:repo]
|
37
|
-
|
38
35
|
require options[:require] if options[:require]
|
39
|
-
if
|
36
|
+
if options[:reporter]
|
40
37
|
reporter = ::Saddler::Reporter.add_reporter(options[:reporter], $stdout)
|
41
38
|
end
|
42
39
|
|
43
40
|
abort('no reporter') unless reporter
|
44
|
-
reporter.report(data,
|
41
|
+
reporter.report(data, options[:options])
|
45
42
|
end
|
46
43
|
end
|
47
44
|
end
|
data/lib/saddler/version.rb
CHANGED
data/saddler.gemspec
CHANGED
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanemat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: test-unit
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -98,6 +98,9 @@ files:
|
|
98
98
|
- Rakefile
|
99
99
|
- bin/console
|
100
100
|
- bin/setup
|
101
|
+
- example/invalid.rb
|
102
|
+
- example/rubocop-result.xml
|
103
|
+
- example/simple.txt
|
101
104
|
- exe/saddler
|
102
105
|
- lib/saddler.rb
|
103
106
|
- lib/saddler/cli.rb
|