code_quality 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -5
- data/README.md +13 -0
- data/Rakefile +2 -1
- data/code_quality.gemspec +2 -2
- data/config/rubocop-rails.yml +1 -1
- data/lib/code_quality/version.rb +1 -1
- data/lib/tasks/code_quality.rake +5 -2
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d1ec0ab45b985bd45ba69a55c33bd7a78a3e6013fe04843e0781cb20382d73d
|
4
|
+
data.tar.gz: 95ded3682f07449b74a7370d215f8a043d7019750c20d02906a786036722f187
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bf273d51ec7d30f778838e4fb8d48c4d68c3c061f71af1386406ffc048406de2b727845f6c480070b6fd49cdfc4240ce4cee26d5111c568d3a32c6e926a8997
|
7
|
+
data.tar.gz: c208a678483b37650cd093bed50d68b8076fd212df45005161c59e2cc041443f999d9a4c9a8bac72ba825d9100c78dc60658241b8d6ebebb080128087f40c24f
|
data/.travis.yml
CHANGED
@@ -21,11 +21,12 @@ stages:
|
|
21
21
|
- code_audit
|
22
22
|
- deploy
|
23
23
|
|
24
|
-
sudo: false
|
25
24
|
language: ruby
|
26
25
|
rvm:
|
27
|
-
- 2.4.
|
28
|
-
|
26
|
+
# - 2.4.4
|
27
|
+
- 2.5.1
|
28
|
+
- 2.6.0
|
29
|
+
before_install: gem install bundler
|
29
30
|
|
30
31
|
# config GitHub OAuth Token
|
31
32
|
env:
|
@@ -54,9 +55,9 @@ deploy:
|
|
54
55
|
|
55
56
|
# publish generated files to GitHub pages
|
56
57
|
- provider: script
|
57
|
-
skip_cleanup: true
|
58
|
+
# skip_cleanup: true
|
58
59
|
script: bin/travis-update-gh-pages.sh
|
59
60
|
on:
|
60
61
|
branch: master
|
61
62
|
tags: true
|
62
|
-
condition: $TRAVIS_PULL_REQUEST = "false"
|
63
|
+
# condition: $TRAVIS_PULL_REQUEST = "false"
|
data/README.md
CHANGED
@@ -90,6 +90,13 @@ output example:
|
|
90
90
|
|
91
91
|
![](doc/imgs/code_quality_security_audit_failed_example.png)
|
92
92
|
|
93
|
+
#### options for security_audit:
|
94
|
+
|
95
|
+
```
|
96
|
+
# e.g.: code_quality security_audit bundler_audit_options="--ignore CVE-2015-9284"
|
97
|
+
# options:
|
98
|
+
# bundler_audit_options: pass extract options, e.g.: bundler_audit_options="--ignore CVE-2015-9284 --verbose"
|
99
|
+
```
|
93
100
|
|
94
101
|
#### work with CI
|
95
102
|
|
@@ -119,11 +126,17 @@ Then Gitlab sends notification with the failure info, for example:
|
|
119
126
|
```
|
120
127
|
# bundler audit - checks for vulnerable versions of gems in Gemfile.lock
|
121
128
|
code_quality security_audit:bundler_audit
|
129
|
+
|
130
|
+
# with bundler_audit cli options
|
131
|
+
code_quality security_audit:bundler_audit bundler_audit_options="--ignore CVE-2020-5267 CVE-2020-10663"
|
122
132
|
```
|
123
133
|
|
124
134
|
```
|
125
135
|
# brakeman audit - checks Ruby on Rails applications for security vulnerabilities
|
126
136
|
code_quality security_audit:brakeman
|
137
|
+
|
138
|
+
# with brakeman cli options
|
139
|
+
code_quality security_audit:brakeman brakeman_options="--skip-files app/views/"
|
127
140
|
```
|
128
141
|
|
129
142
|
```
|
data/Rakefile
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
3
|
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
4
|
+
RSpec::Core::RakeTask.new(:spec) # introduce `rake spec` to Run RSpec code examples
|
5
5
|
|
6
6
|
task :default => :spec
|
7
|
+
task :test => :spec # alias `rake test`
|
7
8
|
Rake::Task.send :load, 'tasks/code_quality.rake'
|
data/code_quality.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_dependency "rubocop-github", "~> 0.12.0"
|
29
29
|
spec.add_dependency "code_metric_fu", "~> 4.14.4"
|
30
30
|
|
31
|
-
spec.add_development_dependency "bundler", "
|
32
|
-
spec.add_development_dependency "rake", "
|
31
|
+
spec.add_development_dependency "bundler", ">= 2.0.2"
|
32
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
33
33
|
spec.add_development_dependency "rspec", "~> 3.0"
|
34
34
|
end
|
data/config/rubocop-rails.yml
CHANGED
data/lib/code_quality/version.rb
CHANGED
data/lib/tasks/code_quality.rake
CHANGED
@@ -35,10 +35,13 @@ namespace :code_quality do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
desc "bundler audit"
|
38
|
+
# Update the ruby-advisory-db and check Gemfile.lock
|
39
|
+
# options:
|
40
|
+
# bundler_audit_options: pass extract CLI options, e.g.: bundler_audit_options="--ignore CVE-2020-5267 CVE-2020-10663"
|
38
41
|
task :bundler_audit => :prepare do |task|
|
42
|
+
options = options_from_env(:bundler_audit_options)
|
39
43
|
run_audit task, "bundler audit - checks for vulnerable versions of gems in Gemfile.lock" do
|
40
|
-
|
41
|
-
report = `bundle audit check --update`
|
44
|
+
report = `bundle audit check --update #{options[:bundler_audit_options]}`
|
42
45
|
@report_path = "#{report_dir}/bundler-audit-report.txt"
|
43
46
|
File.open(@report_path, 'w') {|f| f.write report }
|
44
47
|
puts report
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_quality
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RainChen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler-audit
|
@@ -98,30 +98,30 @@ dependencies:
|
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 2.0.2
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 2.0.2
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 12.3.3
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 12.3.3
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|