warder 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +95 -2
- data/lib/warder/cli/arguments.rb +1 -0
- data/lib/warder/cli.rb +1 -1
- data/lib/warder/code_complexity_runner.rb +1 -1
- data/lib/warder/rails_security_runner.rb +2 -2
- data/lib/warder/version.rb +1 -1
- data/spec/fixtures/valid_rails_app/Gemfile +1 -1
- data/spec/fixtures/valid_rails_app/Gemfile_lock +42 -48
- data/warder.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ce6a5ae6fa2e132a1aa894be28bd683e83a5ea6
|
4
|
+
data.tar.gz: 8f56efcb997bd2ee849d7e978149cd0e1b133d3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78569d1fd5f6a23734c84775ef4508000cfec3db3ba65051281a46a7fa1a7cec3a64f83593fa18c729c06927b83eb82e4f1e572d055918440f9e0e885237efe7
|
7
|
+
data.tar.gz: 939efeec5ea2014a340eee05a10c9525744d98da150595ead00111fcc653ccc3e6431a3eb7a5ad8d470865388d426469246f82c97b2f1242c391a1e6513eb63f
|
data/README.md
CHANGED
@@ -4,7 +4,56 @@
|
|
4
4
|
[![Code Climate](https://codeclimate.com/github/yltsrc/warder.png)](https://codeclimate.com/github/yltsrc/warder)
|
5
5
|
[![Dependency Status](https://gemnasium.com/yltsrc/warder.png)](https://gemnasium.com/yltsrc/warder)
|
6
6
|
|
7
|
-
|
7
|
+
## Getting started
|
8
|
+
|
9
|
+
Main goal of this project was to provide you tool, which will help make code
|
10
|
+
better. I used these tools for a while and can provide some tips.
|
11
|
+
|
12
|
+
Just to start with warder, it would be great to do something simple.
|
13
|
+
And I will recommend to start with checking your bundle for security issues
|
14
|
+
|
15
|
+
$ warder --bundle-audit
|
16
|
+
|
17
|
+
Sooner or later you will start with code cleanup. There are two main ways to
|
18
|
+
deal with it, depending what you plan to achieve. If you are interested in clean
|
19
|
+
code, according to style guides, you may want to use
|
20
|
+
|
21
|
+
$ warder --style-guide
|
22
|
+
|
23
|
+
But if you want to see you code OOP-friendly, then you need different approach
|
24
|
+
|
25
|
+
$ warder --code-smells
|
26
|
+
|
27
|
+
Next steps for stylish code are:
|
28
|
+
|
29
|
+
$ warder --code-duplication
|
30
|
+
$ warder --magick-numbers
|
31
|
+
|
32
|
+
And for OOP-style code next steps will be:
|
33
|
+
|
34
|
+
$ warder --code-complexity
|
35
|
+
|
36
|
+
Then you can apply everything is left. But I strongly recommend to add
|
37
|
+
validations one by one, right after all issues are fixed from previous one.
|
38
|
+
Now it is not possible to compare results on feature branches without scripting,
|
39
|
+
so you must be careful, if you want to use all suitable validators and results
|
40
|
+
are not as good as it can be.
|
41
|
+
|
42
|
+
There are few rails specific validators, but the rules are the same. Security is
|
43
|
+
the first priority:
|
44
|
+
|
45
|
+
$ warder --rails-security
|
46
|
+
|
47
|
+
You may also want to see some advice, regarding rails best practices:
|
48
|
+
|
49
|
+
$ warder --rails-advice
|
50
|
+
|
51
|
+
but be careful with it, some reported advices may conflict with another
|
52
|
+
validators.
|
53
|
+
|
54
|
+
You may also see, how your rails app meets Sandi Metz rules:
|
55
|
+
|
56
|
+
$ warder --sandi-rules
|
8
57
|
|
9
58
|
## Installation
|
10
59
|
|
@@ -22,7 +71,51 @@ Or install it yourself as:
|
|
22
71
|
|
23
72
|
## Usage
|
24
73
|
|
25
|
-
|
74
|
+
First of all, RTFM!
|
75
|
+
|
76
|
+
$ warder --help
|
77
|
+
|
78
|
+
to see all supported scanners.
|
79
|
+
If you are too lazy, you will be confused with results.
|
80
|
+
|
81
|
+
$ warder
|
82
|
+
|
83
|
+
to see that everything is good (actually no one validator used) and you don't
|
84
|
+
need to fix any issues :)
|
85
|
+
|
86
|
+
You also can use shortcuts:
|
87
|
+
|
88
|
+
$ warder --all
|
89
|
+
|
90
|
+
to run all validations, even ones you don't really need.
|
91
|
+
|
92
|
+
To run only rails related validations:
|
93
|
+
|
94
|
+
$ warder --rails
|
95
|
+
|
96
|
+
or to validate your ruby project:
|
97
|
+
|
98
|
+
$ warder --all --no-rails
|
99
|
+
|
100
|
+
if you so tired looking at your code issues, you can use silent mode
|
101
|
+
|
102
|
+
$ warder --quiet
|
103
|
+
|
104
|
+
and you just will get result by exit code.
|
105
|
+
|
106
|
+
But if you, or your CI is really interested in statistics, there is statistics
|
107
|
+
mode for you:
|
108
|
+
|
109
|
+
$ warder --quiet --stats
|
110
|
+
|
111
|
+
if you working on multiple projects, you can pass path to another project
|
112
|
+
as an argument:
|
113
|
+
|
114
|
+
$ warder --quiet /path/to/another/project
|
115
|
+
|
116
|
+
The best thing I can do with warder is validate project itself, so anyone can
|
117
|
+
see, that it is not so hard to write good ruby code. Just check build status on
|
118
|
+
[Travis CI](https://travis-ci.org/yltsrc/warder).
|
26
119
|
|
27
120
|
## Contributing
|
28
121
|
|
data/lib/warder/cli/arguments.rb
CHANGED
data/lib/warder/cli.rb
CHANGED
@@ -17,11 +17,11 @@ module Warder
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def printable?(line)
|
20
|
-
super && PRINTABLE_REGEXP.match(line)
|
20
|
+
super && self.class::PRINTABLE_REGEXP.match(line)
|
21
21
|
end
|
22
22
|
|
23
23
|
def number_of_issues(line)
|
24
|
-
FAILURE_REGEXP.match(line) ? 1 : 0
|
24
|
+
self.class::FAILURE_REGEXP.match(line) ? 1 : 0
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/warder/version.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (4.2.
|
5
|
-
actionpack (= 4.2.
|
6
|
-
actionview (= 4.2.
|
7
|
-
activejob (= 4.2.
|
4
|
+
actionmailer (4.2.2)
|
5
|
+
actionpack (= 4.2.2)
|
6
|
+
actionview (= 4.2.2)
|
7
|
+
activejob (= 4.2.2)
|
8
8
|
mail (~> 2.5, >= 2.5.4)
|
9
9
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
10
|
-
actionpack (4.2.
|
11
|
-
actionview (= 4.2.
|
12
|
-
activesupport (= 4.2.
|
13
|
-
rack (~> 1.6
|
10
|
+
actionpack (4.2.2)
|
11
|
+
actionview (= 4.2.2)
|
12
|
+
activesupport (= 4.2.2)
|
13
|
+
rack (~> 1.6)
|
14
14
|
rack-test (~> 0.6.2)
|
15
15
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
16
|
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
17
|
-
actionview (4.2.
|
18
|
-
activesupport (= 4.2.
|
17
|
+
actionview (4.2.2)
|
18
|
+
activesupport (= 4.2.2)
|
19
19
|
builder (~> 3.1)
|
20
20
|
erubis (~> 2.7.0)
|
21
21
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
22
|
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
23
|
-
activejob (4.2.
|
24
|
-
activesupport (= 4.2.
|
23
|
+
activejob (4.2.2)
|
24
|
+
activesupport (= 4.2.2)
|
25
25
|
globalid (>= 0.3.0)
|
26
|
-
activemodel (4.2.
|
27
|
-
activesupport (= 4.2.
|
26
|
+
activemodel (4.2.2)
|
27
|
+
activesupport (= 4.2.2)
|
28
28
|
builder (~> 3.1)
|
29
|
-
activerecord (4.2.
|
30
|
-
activemodel (= 4.2.
|
31
|
-
activesupport (= 4.2.
|
29
|
+
activerecord (4.2.2)
|
30
|
+
activemodel (= 4.2.2)
|
31
|
+
activesupport (= 4.2.2)
|
32
32
|
arel (~> 6.0)
|
33
|
-
activesupport (4.2.
|
33
|
+
activesupport (4.2.2)
|
34
34
|
i18n (~> 0.7)
|
35
35
|
json (~> 1.7, >= 1.7.7)
|
36
36
|
minitest (~> 5.1)
|
@@ -39,62 +39,56 @@ GEM
|
|
39
39
|
arel (6.0.0)
|
40
40
|
builder (3.2.2)
|
41
41
|
erubis (2.7.0)
|
42
|
-
globalid (0.3.
|
42
|
+
globalid (0.3.5)
|
43
43
|
activesupport (>= 4.1.0)
|
44
|
-
hike (1.2.3)
|
45
44
|
i18n (0.7.0)
|
46
|
-
json (1.8.
|
47
|
-
loofah (2.0.
|
45
|
+
json (1.8.3)
|
46
|
+
loofah (2.0.2)
|
48
47
|
nokogiri (>= 1.5.9)
|
49
48
|
mail (2.6.3)
|
50
49
|
mime-types (>= 1.16, < 3)
|
51
|
-
mime-types (2.
|
50
|
+
mime-types (2.6.1)
|
52
51
|
mini_portile (0.6.2)
|
53
|
-
minitest (5.
|
54
|
-
multi_json (1.10.1)
|
52
|
+
minitest (5.7.0)
|
55
53
|
nokogiri (1.6.6.2)
|
56
54
|
mini_portile (~> 0.6.0)
|
57
|
-
rack (1.6.
|
55
|
+
rack (1.6.4)
|
58
56
|
rack-test (0.6.3)
|
59
57
|
rack (>= 1.0)
|
60
|
-
rails (4.2.
|
61
|
-
actionmailer (= 4.2.
|
62
|
-
actionpack (= 4.2.
|
63
|
-
actionview (= 4.2.
|
64
|
-
activejob (= 4.2.
|
65
|
-
activemodel (= 4.2.
|
66
|
-
activerecord (= 4.2.
|
67
|
-
activesupport (= 4.2.
|
58
|
+
rails (4.2.2)
|
59
|
+
actionmailer (= 4.2.2)
|
60
|
+
actionpack (= 4.2.2)
|
61
|
+
actionview (= 4.2.2)
|
62
|
+
activejob (= 4.2.2)
|
63
|
+
activemodel (= 4.2.2)
|
64
|
+
activerecord (= 4.2.2)
|
65
|
+
activesupport (= 4.2.2)
|
68
66
|
bundler (>= 1.3.0, < 2.0)
|
69
|
-
railties (= 4.2.
|
67
|
+
railties (= 4.2.2)
|
70
68
|
sprockets-rails
|
71
69
|
rails-deprecated_sanitizer (1.0.3)
|
72
70
|
activesupport (>= 4.2.0.alpha)
|
73
|
-
rails-dom-testing (1.0.
|
71
|
+
rails-dom-testing (1.0.6)
|
74
72
|
activesupport (>= 4.2.0.beta, < 5.0)
|
75
73
|
nokogiri (~> 1.6.0)
|
76
74
|
rails-deprecated_sanitizer (>= 1.0.1)
|
77
|
-
rails-html-sanitizer (1.0.
|
75
|
+
rails-html-sanitizer (1.0.2)
|
78
76
|
loofah (~> 2.0)
|
79
|
-
railties (4.2.
|
80
|
-
actionpack (= 4.2.
|
81
|
-
activesupport (= 4.2.
|
77
|
+
railties (4.2.2)
|
78
|
+
actionpack (= 4.2.2)
|
79
|
+
activesupport (= 4.2.2)
|
82
80
|
rake (>= 0.8.7)
|
83
81
|
thor (>= 0.18.1, < 2.0)
|
84
82
|
rake (10.4.2)
|
85
|
-
sprockets (2.
|
86
|
-
hike (~> 1.2)
|
87
|
-
multi_json (~> 1.0)
|
83
|
+
sprockets (3.2.0)
|
88
84
|
rack (~> 1.0)
|
89
|
-
|
90
|
-
sprockets-rails (2.2.4)
|
85
|
+
sprockets-rails (2.3.1)
|
91
86
|
actionpack (>= 3.0)
|
92
87
|
activesupport (>= 3.0)
|
93
88
|
sprockets (>= 2.8, < 4.0)
|
94
89
|
sqlite3 (1.3.10)
|
95
90
|
thor (0.19.1)
|
96
|
-
thread_safe (0.3.
|
97
|
-
tilt (1.4.1)
|
91
|
+
thread_safe (0.3.5)
|
98
92
|
tzinfo (1.2.2)
|
99
93
|
thread_safe (~> 0.1)
|
100
94
|
|
@@ -102,5 +96,5 @@ PLATFORMS
|
|
102
96
|
ruby
|
103
97
|
|
104
98
|
DEPENDENCIES
|
105
|
-
rails (~> 4.2.
|
99
|
+
rails (~> 4.2.1)
|
106
100
|
sqlite3
|
data/warder.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'rubocop', '~> 0.31'
|
22
|
-
spec.add_dependency 'reek', '~>
|
22
|
+
spec.add_dependency 'reek', '~> 2.2'
|
23
23
|
spec.add_dependency 'flay', '~> 2.6.1'
|
24
24
|
spec.add_dependency 'flog', '~> 4.3'
|
25
25
|
spec.add_dependency 'mago', '~> 0.1'
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
32
32
|
spec.add_development_dependency 'rake', '~> 10.0'
|
33
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.3'
|
34
34
|
spec.add_development_dependency 'cucumber', '~> 2.0'
|
35
35
|
spec.add_development_dependency 'aruba', '~> 0.6'
|
36
36
|
spec.add_development_dependency 'simplecov', '~> 0.10'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yura Tolstik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: flay
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '3.
|
173
|
+
version: '3.3'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '3.
|
180
|
+
version: '3.3'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: cucumber
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|