fastlane-plugin-code_static_analyzer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -17
- data/lib/assets/junit_parser.rb +38 -15
- data/lib/fastlane/plugin/code_static_analyzer/actions/code_static_analyzer_action.rb +33 -4
- data/lib/fastlane/plugin/code_static_analyzer/actions/cpd_analyzer.rb +13 -5
- data/lib/fastlane/plugin/code_static_analyzer/actions/ruby_analyzer.rb +20 -6
- data/lib/fastlane/plugin/code_static_analyzer/actions/warning_analyzer.rb +36 -26
- data/lib/fastlane/plugin/code_static_analyzer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f27b577db79a18a272cb128f635addb0ac1d4740
|
4
|
+
data.tar.gz: 292c5593392ca861eb7915ce1cbdd5bc52f45e8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be0c3524e9f856179ac50ef7116d22e1a9ca59e3eb6f7b223b789693d324c45e852d86f49d09c9950fa8c61bcdcc14d875adb668d2b10eb3aa9dcb551e306258
|
7
|
+
data.tar.gz: 11a075f75f5d5431ef10682cca0bb0f1ba8227f0f9e71a77af1dde540f5ae83bcc33fd8aaba73534a28bac8955d78d497aa456cb178bf274e199fdd200ee9472
|
data/README.md
CHANGED
@@ -16,7 +16,8 @@ This plugins runs different Static Analyzers for checking your code on warnings,
|
|
16
16
|
Each analyzer in this plugin generate separate report `codeAnalysResult_<name of analyzer>.xml` and
|
17
17
|
save result status in shared values `<NAME>_ANALYZER_STATUS`: 0 - code is clear, any other value - code include warnings/errors.
|
18
18
|
Finally you can check plugin return value (true='code is clear'/false) to decide what to do next. <br />
|
19
|
-
All reports are generated in JUnit format for easier start-up at the CI servers
|
19
|
+
All reports are generated in JUnit format for easier start-up at the CI servers.<br />
|
20
|
+
This plugin can be used in pair with CI static code analysis plugins. Check out the `Using CI plugins` section.
|
20
21
|
|
21
22
|
## Important
|
22
23
|
- You can configure rubocop analyzer by creating configuration file `.rubocop.yml` in your project (more about rubocop configuration http://rubocop.readthedocs.io/en/latest/cops/)
|
@@ -25,7 +26,7 @@ All reports are generated in JUnit format for easier start-up at the CI servers.
|
|
25
26
|
### Specific for copy paste analyzer (CPD)
|
26
27
|
- PMD have to be installed on your machine (http://pmd.sourceforge.net/snapshot/usage/installing.html)
|
27
28
|
- [!]Pay attention on language parameter: if your code language is available in supported list you have to set this parameter.
|
28
|
-
|
29
|
+
|
29
30
|
## Actions
|
30
31
|
|
31
32
|
`code_static_analyzer` - runs all configured analyzers together (Copy paste analyzer always runs).<br />
|
@@ -56,7 +57,8 @@ code_static_analyzer(
|
|
56
57
|
xcode_project_name: 'path/to/TestProject',
|
57
58
|
xcode_workspace_name: 'path/to/testWorkspace',
|
58
59
|
xcode_targets: ['TPClientTarget','TPServerTarget'],
|
59
|
-
ruby_files: 'fastlane/Fastfile'
|
60
|
+
ruby_files: 'fastlane/Fastfile',
|
61
|
+
disable_junit: 'all' # don't create any results in JUnit format
|
60
62
|
)
|
61
63
|
````
|
62
64
|
Parameter | Description
|
@@ -71,6 +73,7 @@ Parameter | Description
|
|
71
73
|
`xcode_workspace_name`| *(optional)* Xcode workspace name in work directory. Set it if you use different project & workspace names
|
72
74
|
`xcode_targets` | *(optional)* List of Xcode targets to inspect. By default used all targets which are available in project
|
73
75
|
`ruby_files` | *(optional)* List of paths to ruby files to be inspected
|
76
|
+
`disable_junit` | *(optional)* List of analysers for which you want to disable results in JUnit format.<br />Supported analyzers: "xcodeWar", "rubocop", "CPD", "all"<br />By default all results will be created in JUnit format.
|
74
77
|
|
75
78
|
### `code_static_analyzer` other examples (full configuration):
|
76
79
|
CPD:
|
@@ -93,7 +96,8 @@ code_static_analyzer(
|
|
93
96
|
cpd_language: 'objectivec',
|
94
97
|
cpd_files_to_inspect: %w('path/to/myFiles/' 'path/to/testFiles/'),
|
95
98
|
cpd_files_to_exclude: %w('Pods' 'ThirdParty'),
|
96
|
-
ruby_files: 'fastlane/Fastfile'
|
99
|
+
ruby_files: 'fastlane/Fastfile',
|
100
|
+
disable_junit: 'CPD' # results of rubocop analyzer - in JUnit format, CPD analyzer - not in JUnit format
|
97
101
|
)
|
98
102
|
````
|
99
103
|
CPD + Xcode project warnings:
|
@@ -110,24 +114,17 @@ code_static_analyzer(
|
|
110
114
|
xcode_targets: ['TPClientTarget','TPServerTarget'],
|
111
115
|
)
|
112
116
|
````
|
117
|
+
## Using CI plugins
|
113
118
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
```
|
119
|
-
rake
|
120
|
-
```
|
121
|
-
|
122
|
-
To automatically fix many of the styling issues, use
|
123
|
-
```
|
124
|
-
rubocop -a
|
125
|
-
```
|
119
|
+
If you want to use CI static code analysis plugins pay attention on type of file which they use.
|
120
|
+
Commonly CI static code analysis plugins don't scan files in JUnit format, so you need to `disable usage of results in JUnit format` (especially for ruby analyzer).
|
121
|
+
After that each analyzer in this plugin will generate separate report(s):
|
122
|
+
CPD analyzer - `cpd.xml`; Ruby analyzer - `ruby.log`; Warning analyzer - `warnings_<target name>.log`
|
126
123
|
|
127
124
|
## Issues and Feedback
|
128
125
|
|
129
126
|
- In some cases CPD can't recognize patterns in file/dir paths like `path/to/files/*.m`
|
130
|
-
(about path you may read in CPD documentation
|
127
|
+
(about path you may read in [CPD documentation](http://pmd.sourceforge.net/snapshot/usage/cpd-usage.html)).<br />
|
131
128
|
For any other issues and feedback about this plugin, please submit it to this repository.
|
132
129
|
|
133
130
|
## Troubleshooting
|
data/lib/assets/junit_parser.rb
CHANGED
@@ -59,7 +59,7 @@ module JunitParser
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.construct_failure_mes(attributes, values)
|
62
|
-
properties =
|
62
|
+
properties = ''
|
63
63
|
attributes.each_with_index do |property, index|
|
64
64
|
value = values[index]
|
65
65
|
properties += format("#{xml_level(4)}%-18s: %s", property, value) unless value.nil?
|
@@ -104,34 +104,57 @@ module JunitParser
|
|
104
104
|
def self.parse_xcode_log(file, project, is_warn)
|
105
105
|
if is_warn
|
106
106
|
error_text = ''
|
107
|
+
temp_testcase = ''
|
107
108
|
File.open(file).each do |line|
|
108
|
-
if line =~ /warning:|error
|
109
|
+
if line =~ /warning:|error:|BCEROR/
|
110
|
+
failure_type = get_failure_type(line)
|
109
111
|
warning_params = line.split(':')
|
110
112
|
if warning_params.count == 5
|
111
|
-
|
112
|
-
['Error ClassType', 'Error
|
113
|
-
[
|
114
|
-
"#{warning_params[1]}:#{warning_params[2]}", warning_params[4].tr("\n", '')]
|
113
|
+
error_text = construct_failure_mes(
|
114
|
+
['Error ClassType', 'Error Message'],
|
115
|
+
[failure_type, warning_params[4].tr("\n", '')]
|
115
116
|
)
|
117
|
+
testcase_name = project+':'+warning_params[0].tr('<', '').tr('>', '')+
|
118
|
+
":#{warning_params[1]}:#{warning_params[2]}"
|
116
119
|
else
|
117
|
-
error_text
|
120
|
+
error_text = construct_failure_mes(
|
118
121
|
['Error ClassType', 'Error Message'],
|
119
|
-
[
|
122
|
+
[failure_type, line.tr("\n", '').gsub('warning:','')]
|
120
123
|
)
|
124
|
+
testcase_name = project
|
125
|
+
testcase_name += ':project configuration' if line =~ /BCEROR/
|
126
|
+
file_info = check_for_file_info(warning_params)
|
127
|
+
testcase_name += ":#{file_info[0]}" unless file_info[0]==nil
|
128
|
+
testcase_name += ":#{file_info[1]}" unless file_info[1]==nil
|
121
129
|
end
|
130
|
+
failures = add_failure('', '', error_text)
|
131
|
+
temp_testcase += add_failed_testcase(testcase_name, failures)
|
122
132
|
end
|
123
|
-
next unless line =~ /BCEROR/
|
124
|
-
error_text += construct_failure_mes(['Error ClassType', 'Error in File', 'Error Message'],
|
125
|
-
[get_failure_type(line), 'project configuration',
|
126
|
-
line.tr("\n", '')])
|
127
133
|
end
|
128
|
-
|
129
|
-
add_failed_testcase(project, failures)
|
134
|
+
temp_testcase
|
130
135
|
else
|
131
136
|
add_success_testcase(project)
|
132
137
|
end
|
133
138
|
end
|
134
|
-
|
139
|
+
|
140
|
+
def self.check_for_file_info(text_list)
|
141
|
+
result =[]
|
142
|
+
text_list.each_with_index do |text, i|
|
143
|
+
file = /([a-zA-Z0-9\.]*)?(\/[a-zA-Z0-9\._-]+)*(\.){1}[a-zA-Z0-9\._-]+/.match(text)
|
144
|
+
file = nil if file.to_s =~ /\.{2,}/
|
145
|
+
unless file==nil
|
146
|
+
next_value=text_list.to_a[i.to_i+1].nil? ? '' : text_list.to_a[i.to_i+1]
|
147
|
+
line = /[0-9]+/.match(next_value)
|
148
|
+
if line ==nil
|
149
|
+
result=[file]
|
150
|
+
else
|
151
|
+
result=[file, line]
|
152
|
+
end
|
153
|
+
break
|
154
|
+
end
|
155
|
+
end
|
156
|
+
result
|
157
|
+
end
|
135
158
|
#####################################################
|
136
159
|
# ============== Rubocop-json Parser ================
|
137
160
|
#####################################################
|
@@ -24,7 +24,15 @@ module Fastlane
|
|
24
24
|
xcode_project = params[:xcode_project_name]
|
25
25
|
xcode_workspace = params[:xcode_workspace_name]
|
26
26
|
xcode_targets = params[:xcode_targets]
|
27
|
-
|
27
|
+
|
28
|
+
# use additional checks for optional parameters, but required in specific analyzer
|
29
|
+
exclude_junit = params[:disable_junit]
|
30
|
+
if exclude_junit
|
31
|
+
exclude_junit.each do |exclude_from|
|
32
|
+
UI.error "disable_junit parameter is partly skipped: the analyzer '#{exclude_from}' is not supported. Supported analyzers: #{SUPPORTED_ANALYZER}, 'all'" unless SUPPORTED_ANALYZER.map(&:downcase).include? exclude_from.downcase or exclude_from == 'all'
|
33
|
+
end
|
34
|
+
exclude_junit = SUPPORTED_ANALYZER if exclude_junit[0] == 'all'
|
35
|
+
end
|
28
36
|
analyzers.each do |analyzer|
|
29
37
|
case analyzer.downcase
|
30
38
|
when 'xcodewar'
|
@@ -43,8 +51,10 @@ module Fastlane
|
|
43
51
|
sh "rm -rf #{clear_all_files}"
|
44
52
|
|
45
53
|
# Run alyzers
|
54
|
+
use_junit = is_include(exclude_junit, "cpd") ? false : true
|
46
55
|
status_cpd = Actions::CpdAnalyzerAction.run(
|
47
56
|
result_dir: params[:result_dir],
|
57
|
+
use_junit_format: use_junit,
|
48
58
|
tokens: params[:cpd_tokens],
|
49
59
|
language: params[:cpd_language],
|
50
60
|
cpd_files_to_inspect: params[:cpd_files_to_inspect],
|
@@ -53,24 +63,28 @@ module Fastlane
|
|
53
63
|
analyzers.each do |analyzer|
|
54
64
|
case analyzer.downcase
|
55
65
|
when 'xcodewar'
|
66
|
+
use_junit = is_include(exclude_junit, "xcodewar") ? false : true
|
56
67
|
if platform != "android"
|
57
68
|
status_static = Actions::WarningAnalyzerAction.run(
|
58
69
|
result_dir: params[:result_dir],
|
59
70
|
xcode_project_name: xcode_project,
|
60
71
|
xcode_workspace_name: xcode_workspace,
|
61
|
-
xcode_targets: xcode_targets
|
72
|
+
xcode_targets: xcode_targets,
|
73
|
+
use_junit_format: use_junit
|
62
74
|
)
|
63
75
|
end
|
64
76
|
when 'rubocop'
|
77
|
+
use_junit = is_include(exclude_junit, "rubocop") ? false : true
|
65
78
|
status_rubocop = Actions::RubyAnalyzerAction.run(
|
66
79
|
result_dir: params[:result_dir],
|
67
|
-
ruby_files: params[:ruby_files]
|
80
|
+
ruby_files: params[:ruby_files],
|
81
|
+
use_junit_format: use_junit
|
68
82
|
)
|
69
83
|
end
|
70
84
|
end
|
71
85
|
# sh "rm -rf #{clear_temp_files}"
|
72
86
|
|
73
|
-
create_analyzers_run_result("#{root_dir}#{params[:result_dir]}/")
|
87
|
+
create_analyzers_run_result("#{root_dir}#{params[:result_dir]}/")
|
74
88
|
|
75
89
|
if Actions::CodeStaticAnalyzerAction.status_to_boolean(status_cpd) &&
|
76
90
|
Actions::CodeStaticAnalyzerAction.status_to_boolean(status_static) &&
|
@@ -127,6 +141,16 @@ module Fastlane
|
|
127
141
|
end
|
128
142
|
end
|
129
143
|
|
144
|
+
def self.is_include(list, value)
|
145
|
+
if list
|
146
|
+
list = list.map(&:downcase)
|
147
|
+
value = value.downcase
|
148
|
+
return (list.include? value) ? true : false
|
149
|
+
else
|
150
|
+
return false
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
130
154
|
def self.is_pmd_installed
|
131
155
|
@checked_pmd = false
|
132
156
|
begin
|
@@ -243,6 +267,11 @@ module Fastlane
|
|
243
267
|
UI.user_error!("The analyzer '#{run_analyzer}' is not supported. Supported analyzers: #{SUPPORTED_ANALYZER}, 'all'") unless SUPPORTED_ANALYZER.map(&:downcase).include? run_analyzer.downcase or run_analyzer == 'all'
|
244
268
|
end
|
245
269
|
end),
|
270
|
+
FastlaneCore::ConfigItem.new(key: :disable_junit,
|
271
|
+
env_name: "FL_CSA_DISABLED_JUNIT_RESULTS",
|
272
|
+
description: "List of analysers for which you want to disable results in JUnit format. Supported analyzers: #{SUPPORTED_ANALYZER}, 'all'",
|
273
|
+
optional: true,
|
274
|
+
type: Array),
|
246
275
|
FastlaneCore::ConfigItem.new(key: :result_dir,
|
247
276
|
env_name: "CSA_RESULT_DIR_NAME",
|
248
277
|
description: "Directory's name for storing analysis results",
|
@@ -11,7 +11,6 @@ module Fastlane
|
|
11
11
|
UI.header 'CPD analyzer' if Actions::CodeStaticAnalyzerAction.run_from_main_action
|
12
12
|
Actions::CodeStaticAnalyzerAction.is_pmd_installed unless Actions::CodeStaticAnalyzerAction.checked_pmd
|
13
13
|
work_dir = Actions::CodeStaticAnalyzerAction.work_dir
|
14
|
-
|
15
14
|
# checking files for analysing
|
16
15
|
files_to_exclude = params[:cpd_files_to_exclude]
|
17
16
|
files_to_inspect = params[:cpd_files_to_inspect]
|
@@ -22,7 +21,7 @@ module Fastlane
|
|
22
21
|
# prepare script and metadata for saving results
|
23
22
|
result_dir_path = "#{work_dir}#{params[:result_dir]}"
|
24
23
|
FileUtils.mkdir_p(result_dir_path) unless File.exist?(result_dir_path)
|
25
|
-
temp_result_file = "#{result_dir_path}/
|
24
|
+
temp_result_file = "#{result_dir_path}/cpd.xml"
|
26
25
|
result_file = "#{result_dir_path}/codeAnalysResults_cpd.xml"
|
27
26
|
tokens = params[:tokens]
|
28
27
|
files = Actions::CodeStaticAnalyzerAction.add_root_path(work_dir, files_to_inspect, true)
|
@@ -52,9 +51,12 @@ module Fastlane
|
|
52
51
|
status = 43
|
53
52
|
else
|
54
53
|
status = 0 if File.read(temp_result_file).empty?
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
if params[:use_junit_format]
|
55
|
+
UI.message 'CPD analyzer generates result in JUnit format'
|
56
|
+
xml_content = JunitParser.parse_xml(temp_result_file)
|
57
|
+
junit_xml = JunitParser.add_testsuite('copypaste', xml_content)
|
58
|
+
JunitParser.create_junit_xml(junit_xml, result_file)
|
59
|
+
end
|
58
60
|
end
|
59
61
|
Actions.lane_context[SharedValues::CPD_ANALYZER_STATUS] = status
|
60
62
|
end
|
@@ -83,6 +85,12 @@ module Fastlane
|
|
83
85
|
optional: true,
|
84
86
|
type: String,
|
85
87
|
default_value: 'artifacts'),
|
88
|
+
FastlaneCore::ConfigItem.new(key: :use_junit_format,
|
89
|
+
env_name: "FL_CPD_ANALYZER_USE_JUNIT_RESULTS",
|
90
|
+
description: "Generate results in JUnit format.",
|
91
|
+
optional: true,
|
92
|
+
type: BOOL,
|
93
|
+
default_value: true),
|
86
94
|
FastlaneCore::ConfigItem.new(key: :tokens,
|
87
95
|
env_name: "FL_CPD_ANALYZER_TOKENS",
|
88
96
|
description: "The min number of words in code that is detected as copy paste",
|
@@ -18,10 +18,15 @@ module Fastlane
|
|
18
18
|
# prepare script and metadata for saving results
|
19
19
|
result_dir_path = "#{work_dir}#{params[:result_dir]}"
|
20
20
|
FileUtils.mkdir_p(result_dir_path) unless File.exist?(result_dir_path)
|
21
|
-
temp_result_file = "#{result_dir_path}/temp_ruby.json"
|
22
21
|
result_file = "#{result_dir_path}/codeAnalysResults_ruby.xml"
|
23
22
|
files = Actions::CodeStaticAnalyzerAction.add_root_path(work_dir, files_to_inspect, true)
|
24
|
-
|
23
|
+
if params[:use_junit_format]
|
24
|
+
temp_result_file = "#{result_dir_path}/ruby.json"
|
25
|
+
run_script = "bundle exec rubocop -f j -a #{files}"
|
26
|
+
else
|
27
|
+
temp_result_file = "#{result_dir_path}/ruby.log"
|
28
|
+
run_script = "bundle exec rubocop -a #{files}"
|
29
|
+
end
|
25
30
|
run_script_path = File.join CodeStaticAnalyzer::ROOT, "assets/run_script.sh"
|
26
31
|
run_script = "#{run_script_path} \"#{run_script}\" '#{temp_result_file}'"
|
27
32
|
# use analyzer
|
@@ -40,9 +45,12 @@ module Fastlane
|
|
40
45
|
status = 43
|
41
46
|
else
|
42
47
|
status = 0 if File.read(temp_result_file).empty?
|
43
|
-
|
44
|
-
|
45
|
-
|
48
|
+
if params[:use_junit_format]
|
49
|
+
UI.message 'Ruby analyzer generates result in JUnit format'
|
50
|
+
xml_content = JunitParser.parse_json(temp_result_file)
|
51
|
+
junit_xml = JunitParser.add_testsuite('rubocop', xml_content)
|
52
|
+
JunitParser.create_junit_xml(junit_xml, result_file)
|
53
|
+
end
|
46
54
|
end
|
47
55
|
Actions.lane_context[SharedValues::RUBY_ANALYZER_STATUS] = status
|
48
56
|
end
|
@@ -76,7 +84,13 @@ module Fastlane
|
|
76
84
|
env_name: "FL_RUBY_ANALYZER_FILES_TO_INSPECT",
|
77
85
|
description: "List of path (relative to work directory) to ruby files to be inspected",
|
78
86
|
optional: true,
|
79
|
-
type: Array)
|
87
|
+
type: Array),
|
88
|
+
FastlaneCore::ConfigItem.new(key: :use_junit_format,
|
89
|
+
env_name: "FL_RUBY_ANALYZER_USE_JUNIT_RESULTS",
|
90
|
+
description: "Generate results in JUnit format.",
|
91
|
+
optional: true,
|
92
|
+
type: BOOL,
|
93
|
+
default_value: true)
|
80
94
|
]
|
81
95
|
end
|
82
96
|
|
@@ -31,7 +31,7 @@ module Fastlane
|
|
31
31
|
|
32
32
|
status_static_arr = []
|
33
33
|
xml_content = ''
|
34
|
-
|
34
|
+
# temp_result_file = "#{result_dir_path}/warnings.log"
|
35
35
|
result_file = "#{result_dir_path}/codeAnalysResults_warning.xml"
|
36
36
|
|
37
37
|
# use analyzer and collect results
|
@@ -39,6 +39,7 @@ module Fastlane
|
|
39
39
|
project_workspace = workspace if is_workspace
|
40
40
|
Actions::CodeStaticAnalyzerAction.start_xml_content unless Actions::CodeStaticAnalyzerAction.run_from_main_action
|
41
41
|
targets.each do |target|
|
42
|
+
temp_result_file = "#{result_dir_path}/warnings_#{target}.log"
|
42
43
|
Formatter.xcode_format(target)
|
43
44
|
run_script = "#{run_script_path} #{project_workspace} #{target} '#{temp_result_file}' #{is_workspace}"
|
44
45
|
FastlaneCore::CommandExecutor.execute(command: run_script.to_s,
|
@@ -52,7 +53,7 @@ module Fastlane
|
|
52
53
|
if Dir.glob(temp_result_file).empty?
|
53
54
|
Actions::CodeStaticAnalyzerAction.add_xml_content("#{result_dir_path}/", 'iOS Warning', temp_result_file, '')
|
54
55
|
Actions::CodeStaticAnalyzerAction.create_analyzers_run_result("#{result_dir_path}/") unless Actions::CodeStaticAnalyzerAction.run_from_main_action
|
55
|
-
status_static_arr.push(
|
56
|
+
status_static_arr.push(2)
|
56
57
|
else
|
57
58
|
file = File.read(temp_result_file)
|
58
59
|
UI.important "wrong profiles. Code isn't checked" if file =~ /BCEROR/
|
@@ -62,14 +63,17 @@ module Fastlane
|
|
62
63
|
else
|
63
64
|
status_static_arr.push(0)
|
64
65
|
end
|
65
|
-
xml_content += JunitParser.parse_xcode_log(temp_result_file, target, is_warnings)
|
66
|
+
xml_content += JunitParser.parse_xcode_log(temp_result_file, target, is_warnings) if params[:use_junit_format]
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
70
|
# prepare results
|
70
|
-
|
71
|
-
|
72
|
-
|
71
|
+
if params[:use_junit_format]
|
72
|
+
UI.message 'Warning analyzer generates results in JUnit format'
|
73
|
+
unless status_static_arr.include? '2'
|
74
|
+
junit_xml = JunitParser.add_testsuite('xcode warnings', xml_content)
|
75
|
+
JunitParser.create_junit_xml(junit_xml, result_file)
|
76
|
+
end
|
73
77
|
end
|
74
78
|
status = if status_static_arr.any? { |x| x > 0 }
|
75
79
|
1
|
@@ -98,29 +102,35 @@ module Fastlane
|
|
98
102
|
# Define all options your action supports.
|
99
103
|
[
|
100
104
|
FastlaneCore::ConfigItem.new(key: :result_dir,
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
105
|
+
env_name: "FL_WARNING_ANALYZER_RESULT_DIR",
|
106
|
+
description: "Directory's name for storing analysis results",
|
107
|
+
optional: true,
|
108
|
+
type: String,
|
109
|
+
default_value: 'artifacts'),
|
110
|
+
FastlaneCore::ConfigItem.new(key: :use_junit_format,
|
111
|
+
env_name: "FL_WARNING_ANALYZER_USE_JUNIT_RESULTS",
|
112
|
+
description: "Generate results in JUnit format.",
|
113
|
+
optional: true,
|
114
|
+
type: BOOL,
|
115
|
+
default_value: true),
|
106
116
|
FastlaneCore::ConfigItem.new(key: :xcode_project_name,
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
117
|
+
env_name: "FL_WARNING_ANALYZER_PROJECT_NAME",
|
118
|
+
description: "Xcode project name in work directory",
|
119
|
+
optional: false,
|
120
|
+
type: String,
|
121
|
+
verify_block: proc do |value|
|
122
|
+
UI.user_error!("No project name for WarningAnalyzerAction given, pass using `xcode_project_name` parameter") unless value and !value.empty?
|
123
|
+
end),
|
114
124
|
FastlaneCore::ConfigItem.new(key: :xcode_workspace_name,
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
125
|
+
env_name: "FL_WARNING_ANALYZER_WORKSPACE_NAME",
|
126
|
+
description: "Xcode workspace name in work directory. Set it if you use different project & workspace names",
|
127
|
+
optional: true,
|
128
|
+
type: String),
|
119
129
|
FastlaneCore::ConfigItem.new(key: :xcode_targets,
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
130
|
+
env_name: "FL_WARNING_ANALYZER_TARGETS",
|
131
|
+
description: "List of Xcode targets to inspect. By default used all project targets",
|
132
|
+
optional: true,
|
133
|
+
type: Array)
|
124
134
|
]
|
125
135
|
end
|
126
136
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-code_static_analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olga Kniazska
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: crack
|