danger-logging_lint 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +148 -0
- data/.travis.yml +11 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +170 -0
- data/Guardfile +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +25 -0
- data/danger-logging_lint.gemspec +50 -0
- data/lib/danger_logging_lint.rb +3 -0
- data/lib/danger_plugin.rb +3 -0
- data/lib/logging_lint/gem_version.rb +5 -0
- data/lib/logging_lint/plugin.rb +297 -0
- data/spec/fixtures/IgnoredModifiedFile.txt +112 -0
- data/spec/fixtures/ModifiedFile.kt +112 -0
- data/spec/fixtures/NewFile.kt +78 -0
- data/spec/logging_lint_spec.rb +132 -0
- data/spec/spec_helper.rb +67 -0
- metadata +209 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b4f62fd36901e935296e80d8e6e884604818be116be3731668fd46d9e2f29cf1
|
4
|
+
data.tar.gz: '0518bc5b6aabe4236039303b27e211025458c5870b135789f6311f03918fba5c'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 47ad03a313f30f32a397ff9d0faffa584b758179f8a701b53ed47e78b05657cfcec4d102965f8d045df00c14ada9b34d2750551085970d8d18e312830b197cfa
|
7
|
+
data.tar.gz: 42cd8e9e2872c7f126bb0c6918741b9df60cf171685beb41ee2309c9f3d185b9e444dc31d024281594511cb108e5d199f667785ce709bf88741204d2efda7ac2
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# Defaults can be found here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
2
|
+
|
3
|
+
# If you don't like these settings, just delete this file :)
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.6
|
7
|
+
|
8
|
+
Style/StringLiterals:
|
9
|
+
EnforcedStyle: double_quotes
|
10
|
+
Enabled: true
|
11
|
+
|
12
|
+
# kind_of? is a good way to check a type
|
13
|
+
Style/ClassCheck:
|
14
|
+
EnforcedStyle: kind_of?
|
15
|
+
|
16
|
+
# specs sometimes have useless assignments, which is fine
|
17
|
+
Lint/UselessAssignment:
|
18
|
+
Exclude:
|
19
|
+
- '**/spec/**/*'
|
20
|
+
|
21
|
+
# We could potentially enable the 2 below:
|
22
|
+
Layout/FirstHashElementIndentation:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Layout/HashAlignment:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
# HoundCI doesn't like this rule
|
29
|
+
Layout/DotPosition:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
# We allow !! as it's an easy way to convert ot boolean
|
33
|
+
Style/DoubleNegation:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# Cop supports --auto-correct.
|
37
|
+
Lint/UnusedBlockArgument:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
# We want to allow class Fastlane::Class
|
41
|
+
Style/ClassAndModuleChildren:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Metrics/AbcSize:
|
45
|
+
Max: 60
|
46
|
+
|
47
|
+
# The %w might be confusing for new users
|
48
|
+
Style/WordArray:
|
49
|
+
MinSize: 19
|
50
|
+
|
51
|
+
# raise and fail are both okay
|
52
|
+
Style/SignalException:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
# Better too much 'return' than one missing
|
56
|
+
Style/RedundantReturn:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
# Having if in the same line might not always be good
|
60
|
+
Style/IfUnlessModifier:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
# and and or is okay
|
64
|
+
Style/AndOr:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
# Configuration parameters: CountComments.
|
68
|
+
Metrics/ClassLength:
|
69
|
+
Max: 350
|
70
|
+
|
71
|
+
Metrics/CyclomaticComplexity:
|
72
|
+
Max: 17
|
73
|
+
|
74
|
+
# Configuration parameters: AllowURI, URISchemes.
|
75
|
+
Layout/LineLength:
|
76
|
+
Max: 370
|
77
|
+
|
78
|
+
# Configuration parameters: CountKeywordArgs.
|
79
|
+
Metrics/ParameterLists:
|
80
|
+
Max: 10
|
81
|
+
|
82
|
+
Metrics/PerceivedComplexity:
|
83
|
+
Max: 18
|
84
|
+
|
85
|
+
# Sometimes it's easier to read without guards
|
86
|
+
Style/GuardClause:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
# something = if something_else
|
90
|
+
# that's confusing
|
91
|
+
Style/ConditionalAssignment:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
# Better to have too much self than missing a self
|
95
|
+
Style/RedundantSelf:
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
Metrics/MethodLength:
|
99
|
+
Max: 60
|
100
|
+
|
101
|
+
# We're not there yet
|
102
|
+
Style/Documentation:
|
103
|
+
Enabled: false
|
104
|
+
|
105
|
+
# Adds complexity
|
106
|
+
Style/IfInsideElse:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
# danger specific
|
110
|
+
|
111
|
+
Style/BlockComments:
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
Layout/MultilineMethodCallIndentation:
|
115
|
+
EnforcedStyle: indented
|
116
|
+
|
117
|
+
# FIXME: 25
|
118
|
+
Metrics/BlockLength:
|
119
|
+
Max: 345
|
120
|
+
Exclude:
|
121
|
+
- "**/*_spec.rb"
|
122
|
+
|
123
|
+
Style/MixinGrouping:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
Naming/FileName:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
Layout/HeredocIndentation:
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
Style/SpecialGlobalVars:
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
Style/PercentLiteralDelimiters:
|
136
|
+
PreferredDelimiters:
|
137
|
+
"%": ()
|
138
|
+
"%i": ()
|
139
|
+
"%q": ()
|
140
|
+
"%Q": ()
|
141
|
+
"%r": "{}"
|
142
|
+
"%s": ()
|
143
|
+
"%w": ()
|
144
|
+
"%W": ()
|
145
|
+
"%x": ()
|
146
|
+
|
147
|
+
Security/YAMLLoad:
|
148
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
danger-logging_lint (0.0.1)
|
5
|
+
danger-plugin-api (~> 1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.8.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
12
|
+
ast (2.4.2)
|
13
|
+
claide (1.1.0)
|
14
|
+
claide-plugins (0.9.2)
|
15
|
+
cork
|
16
|
+
nap
|
17
|
+
open4 (~> 1.3)
|
18
|
+
coderay (1.1.3)
|
19
|
+
colored2 (3.1.2)
|
20
|
+
cork (0.3.0)
|
21
|
+
colored2 (~> 3.1)
|
22
|
+
danger (8.5.0)
|
23
|
+
claide (~> 1.0)
|
24
|
+
claide-plugins (>= 0.9.2)
|
25
|
+
colored2 (~> 3.1)
|
26
|
+
cork (~> 0.1)
|
27
|
+
faraday (>= 0.9.0, < 2.0)
|
28
|
+
faraday-http-cache (~> 2.0)
|
29
|
+
git (~> 1.7)
|
30
|
+
kramdown (~> 2.3)
|
31
|
+
kramdown-parser-gfm (~> 1.0)
|
32
|
+
no_proxy_fix
|
33
|
+
octokit (~> 4.7)
|
34
|
+
terminal-table (>= 1, < 4)
|
35
|
+
danger-plugin-api (1.0.0)
|
36
|
+
danger (> 2.0)
|
37
|
+
diff-lcs (1.5.0)
|
38
|
+
faraday (1.10.0)
|
39
|
+
faraday-em_http (~> 1.0)
|
40
|
+
faraday-em_synchrony (~> 1.0)
|
41
|
+
faraday-excon (~> 1.1)
|
42
|
+
faraday-httpclient (~> 1.0)
|
43
|
+
faraday-multipart (~> 1.0)
|
44
|
+
faraday-net_http (~> 1.0)
|
45
|
+
faraday-net_http_persistent (~> 1.0)
|
46
|
+
faraday-patron (~> 1.0)
|
47
|
+
faraday-rack (~> 1.0)
|
48
|
+
faraday-retry (~> 1.0)
|
49
|
+
ruby2_keywords (>= 0.0.4)
|
50
|
+
faraday-em_http (1.0.0)
|
51
|
+
faraday-em_synchrony (1.0.0)
|
52
|
+
faraday-excon (1.1.0)
|
53
|
+
faraday-http-cache (2.2.0)
|
54
|
+
faraday (>= 0.8)
|
55
|
+
faraday-httpclient (1.0.1)
|
56
|
+
faraday-multipart (1.0.3)
|
57
|
+
multipart-post (>= 1.2, < 3)
|
58
|
+
faraday-net_http (1.0.1)
|
59
|
+
faraday-net_http_persistent (1.2.0)
|
60
|
+
faraday-patron (1.0.0)
|
61
|
+
faraday-rack (1.0.0)
|
62
|
+
faraday-retry (1.0.3)
|
63
|
+
ffi (1.15.5)
|
64
|
+
formatador (1.1.0)
|
65
|
+
git (1.10.2)
|
66
|
+
rchardet (~> 1.8)
|
67
|
+
guard (2.18.0)
|
68
|
+
formatador (>= 0.2.4)
|
69
|
+
listen (>= 2.7, < 4.0)
|
70
|
+
lumberjack (>= 1.0.12, < 2.0)
|
71
|
+
nenv (~> 0.1)
|
72
|
+
notiffany (~> 0.0)
|
73
|
+
pry (>= 0.13.0)
|
74
|
+
shellany (~> 0.0)
|
75
|
+
thor (>= 0.18.1)
|
76
|
+
guard-compat (1.2.1)
|
77
|
+
guard-rspec (4.7.3)
|
78
|
+
guard (~> 2.1)
|
79
|
+
guard-compat (~> 1.1)
|
80
|
+
rspec (>= 2.99.0, < 4.0)
|
81
|
+
kramdown (2.3.2)
|
82
|
+
rexml
|
83
|
+
kramdown-parser-gfm (1.1.0)
|
84
|
+
kramdown (~> 2.0)
|
85
|
+
listen (3.0.7)
|
86
|
+
rb-fsevent (>= 0.9.3)
|
87
|
+
rb-inotify (>= 0.9.7)
|
88
|
+
lumberjack (1.2.8)
|
89
|
+
method_source (1.0.0)
|
90
|
+
multipart-post (2.1.1)
|
91
|
+
nap (1.1.0)
|
92
|
+
nenv (0.3.0)
|
93
|
+
no_proxy_fix (0.1.2)
|
94
|
+
notiffany (0.1.3)
|
95
|
+
nenv (~> 0.1)
|
96
|
+
shellany (~> 0.0)
|
97
|
+
octokit (4.22.0)
|
98
|
+
faraday (>= 0.9)
|
99
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
100
|
+
open4 (1.3.4)
|
101
|
+
parallel (1.22.1)
|
102
|
+
parser (3.1.1.0)
|
103
|
+
ast (~> 2.4.1)
|
104
|
+
pry (0.14.1)
|
105
|
+
coderay (~> 1.1)
|
106
|
+
method_source (~> 1.0)
|
107
|
+
public_suffix (4.0.6)
|
108
|
+
rainbow (3.1.1)
|
109
|
+
rake (10.5.0)
|
110
|
+
rb-fsevent (0.11.1)
|
111
|
+
rb-inotify (0.10.1)
|
112
|
+
ffi (~> 1.0)
|
113
|
+
rchardet (1.8.0)
|
114
|
+
regexp_parser (2.3.0)
|
115
|
+
rexml (3.2.5)
|
116
|
+
rspec (3.11.0)
|
117
|
+
rspec-core (~> 3.11.0)
|
118
|
+
rspec-expectations (~> 3.11.0)
|
119
|
+
rspec-mocks (~> 3.11.0)
|
120
|
+
rspec-core (3.11.0)
|
121
|
+
rspec-support (~> 3.11.0)
|
122
|
+
rspec-expectations (3.11.0)
|
123
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
124
|
+
rspec-support (~> 3.11.0)
|
125
|
+
rspec-mocks (3.11.1)
|
126
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
127
|
+
rspec-support (~> 3.11.0)
|
128
|
+
rspec-support (3.11.0)
|
129
|
+
rubocop (1.27.0)
|
130
|
+
parallel (~> 1.10)
|
131
|
+
parser (>= 3.1.0.0)
|
132
|
+
rainbow (>= 2.2.2, < 4.0)
|
133
|
+
regexp_parser (>= 1.8, < 3.0)
|
134
|
+
rexml
|
135
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
136
|
+
ruby-progressbar (~> 1.7)
|
137
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
138
|
+
rubocop-ast (1.17.0)
|
139
|
+
parser (>= 3.1.1.0)
|
140
|
+
ruby-progressbar (1.11.0)
|
141
|
+
ruby2_keywords (0.0.5)
|
142
|
+
sawyer (0.8.2)
|
143
|
+
addressable (>= 2.3.5)
|
144
|
+
faraday (> 0.8, < 2.0)
|
145
|
+
shellany (0.0.1)
|
146
|
+
terminal-table (3.0.2)
|
147
|
+
unicode-display_width (>= 1.1.1, < 3)
|
148
|
+
thor (1.2.1)
|
149
|
+
unicode-display_width (2.1.0)
|
150
|
+
webrick (1.7.0)
|
151
|
+
yard (0.9.27)
|
152
|
+
webrick (~> 1.7.0)
|
153
|
+
|
154
|
+
PLATFORMS
|
155
|
+
ruby
|
156
|
+
|
157
|
+
DEPENDENCIES
|
158
|
+
bundler (~> 2.0)
|
159
|
+
danger-logging_lint!
|
160
|
+
guard (~> 2.14)
|
161
|
+
guard-rspec (~> 4.7)
|
162
|
+
listen (= 3.0.7)
|
163
|
+
pry
|
164
|
+
rake (~> 10.0)
|
165
|
+
rspec (~> 3.4)
|
166
|
+
rubocop
|
167
|
+
yard
|
168
|
+
|
169
|
+
BUNDLED WITH
|
170
|
+
2.1.4
|
data/Guardfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A guardfile for making Danger Plugins
|
4
|
+
# For more info see https://github.com/guard/guard#readme
|
5
|
+
|
6
|
+
# To run, use `bundle exec guard`.
|
7
|
+
|
8
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
9
|
+
require "guard/rspec/dsl"
|
10
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
11
|
+
|
12
|
+
# RSpec files
|
13
|
+
rspec = dsl.rspec
|
14
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
15
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
16
|
+
watch(rspec.spec_files)
|
17
|
+
|
18
|
+
# Ruby files
|
19
|
+
ruby = dsl.ruby
|
20
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
21
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2022 David Sucharda <david.sucharda@eman.cz>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
## logging_lint
|
2
|
+
|
3
|
+
This danger plugin can be used to check log lines in modified (added) files. It heavily relies on regex configuration which can be modified to search all kinds of parts of code in the files. Default configuration is set to support [Kotlin eMan Logger Library](https://github.com/eManPrague/logger-ktx). Ex: logInfo { "Info message $var" }.
|
4
|
+
|
5
|
+
It works in two steps. First it searches for all log lines (multilines) in files. And then it applies line variable regex combined with line remove regex. Check `check_files` function for more information.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
$ gem install danger-logging_lint
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
> Log linter with its basic configuration (searches for logInfo { "Message with $var" } and it's combinations)
|
14
|
+
> ```
|
15
|
+
> logging_lint.log_lint
|
16
|
+
> ```
|
17
|
+
|
18
|
+
> Log linter with multiple log functions
|
19
|
+
> ```
|
20
|
+
> # Linting multiple log functions
|
21
|
+
> logging_lint.log_functions = ["logInfo", "logWarn", "logError"]
|
22
|
+
> logging_lint.log_lint
|
23
|
+
> ```
|
24
|
+
|
25
|
+
|
26
|
+
> Log linter with completely custom functionality
|
27
|
+
> ```
|
28
|
+
> # Linting only kotlin files (extensions without dot or star)
|
29
|
+
> logging_lint.file_extensions = ["kt"]
|
30
|
+
> # Linting multiple log functions
|
31
|
+
> logging_lint.log_functions = ["logInfo", "logWarn", "logError"]
|
32
|
+
> # Custom warning text and description
|
33
|
+
> logging_lint.warning_text = "You should really check this!"
|
34
|
+
> logging_lint.warning_description = "May be a security issue. Check this link: ...."
|
35
|
+
> # Custom log regex (searches for "foo $ bar")
|
36
|
+
> logging_lint.log_regex = '(\".*\$.*\")'
|
37
|
+
> # Custom log variable regex (searches for "$" and "${message}" in the log)
|
38
|
+
> logging_lint.line_variable_regex = ['\$', '${message}']
|
39
|
+
> # Custom log remove regex (removes nothing from the log lines)
|
40
|
+
> logging_lint.line_remove_regex = []
|
41
|
+
> # Marks start of the log when variable was found in it
|
42
|
+
> logging_lint.line_index_position = "start"
|
43
|
+
> logging_lint.log_lint
|
44
|
+
> ```
|
45
|
+
|
46
|
+
### Attributes
|
47
|
+
|
48
|
+
`file_extensions` - File extensions are used to limit the number of files checked based on their extension. For example for Kotlin language we want to check only .kt files and no other.
|
49
|
+
`log_functions` - Log functions are functions which define logging. They usually identify logging function that is being used. For example logInfo, logWarn or logError. Each of these values is checked in a file combined with log_regex.
|
50
|
+
`warning_text` - Warning text is used to modify the text displayed in the Danger report. It is a message with which the Danger warning for specific log is created.
|
51
|
+
`warning_description` - Warning description can be used to extend warning text. It can be used to provide more context for the log warning such as more description, link with security rules and other.
|
52
|
+
`log_regex` - This regex is used to search for all log lines in a file. It does not check if there are variables in it. It just searches for all logs. These results are used later to filter in them.
|
53
|
+
`line_variable_regex` - This regex is used to check log lines for variables. Since it is not always possible to find all variables using one single regex it is represented as an array. This array cannot be null or empty for the script to function.
|
54
|
+
`line_remove_regex` - This regex is used to clear the log line before variable regex is applied. It allows us to clear values that would interfere with variable searching. This array cannot be null but it can be empty for this script to function.
|
55
|
+
`line_index_position` - Unfortunately due to line modification in function `contains_variable` it is not possible to accurately pinpoint variable in the log. That is why there are three options for the offset to identity the line. Options are: "start", "middle", "end".
|
56
|
+
|
57
|
+
### Methods
|
58
|
+
|
59
|
+
`log_lint` - Triggers file linting on specific target files. But first it does few checks if it actually needs to run.
|
60
|
+
1) Checks if `log_functions` have size at least 1. If they are not then this script send Danger fail and cancels.
|
61
|
+
2) Checks if `line_variable_regex` have size at least 1. If they are not then this script send Danger fail and
|
62
|
+
cancels.
|
63
|
+
3) Filters target files based on `file_extensions` and if there are no files to check it will send Danger message
|
64
|
+
and cancels.
|
65
|
+
|
66
|
+
If all of these checks pass then it will trigger linter on target files (filtered) using `check_files`.
|
67
|
+
|
68
|
+
## Development
|
69
|
+
|
70
|
+
1. Clone this repo
|
71
|
+
2. Run `bundle install` to setup dependencies.
|
72
|
+
3. Run `bundle exec rake spec` to run the tests.
|
73
|
+
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
74
|
+
5. Make your changes.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
require "rubocop/rake_task"
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:specs)
|
8
|
+
|
9
|
+
task default: :specs
|
10
|
+
|
11
|
+
task :spec do
|
12
|
+
Rake::Task["specs"].invoke
|
13
|
+
Rake::Task["rubocop"].invoke
|
14
|
+
Rake::Task["spec_docs"].invoke
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run RuboCop on the lib/specs directory"
|
18
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
19
|
+
task.patterns = ["lib/**/*.rb", "spec/**/*.rb"]
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Ensure that the plugin passes `danger plugins lint`"
|
23
|
+
task :spec_docs do
|
24
|
+
sh "bundle exec danger plugins lint"
|
25
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "logging_lint/gem_version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "danger-logging_lint"
|
9
|
+
spec.version = LoggingLint::VERSION
|
10
|
+
spec.authors = ["David Sucharda"]
|
11
|
+
spec.email = ["david.sucharda@eman.cz"]
|
12
|
+
spec.description = "Checks logging commands in code."
|
13
|
+
spec.summary = "Logging might be a security issue that is why this plugin checks files for new/changed logs with variables that might be a security issue and warns them using Danger."
|
14
|
+
spec.homepage = "https://github.com/eManPrague/danger-logging_lint"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency "danger-plugin-api", "~> 1.0"
|
23
|
+
|
24
|
+
# General ruby development
|
25
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
|
28
|
+
# Testing support
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
30
|
+
|
31
|
+
# Linting code and docs
|
32
|
+
spec.add_development_dependency "rubocop"
|
33
|
+
spec.add_development_dependency "yard"
|
34
|
+
|
35
|
+
# Makes testing easy via `bundle exec guard`
|
36
|
+
spec.add_development_dependency "guard", "~> 2.14"
|
37
|
+
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
38
|
+
|
39
|
+
# If you want to work on older builds of ruby
|
40
|
+
spec.add_development_dependency "listen", "3.0.7"
|
41
|
+
|
42
|
+
# This gives you the chance to run a REPL inside your tests
|
43
|
+
# via:
|
44
|
+
#
|
45
|
+
# require 'pry'
|
46
|
+
# binding.pry
|
47
|
+
#
|
48
|
+
# This will stop test execution and let you inspect the results
|
49
|
+
spec.add_development_dependency "pry"
|
50
|
+
end
|