Class: Fastlane::Actions::EnsureNoDebugCodeAction
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES
Class Method Summary
collapse
action_name, author, lane_context, method_missing, other_action, return_value, sample_return_value, sh, step_text
Class Method Details
.authors ⇒ Object
87
88
89
|
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 87
def self.authors
["KrauseFx"]
end
|
.available_options ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 56
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :text,
env_name: "FL_ENSURE_NO_DEBUG_CODE_TEXT",
description: "The text that must not be in the code base"),
FastlaneCore::ConfigItem.new(key: :path,
env_name: "FL_ENSURE_NO_DEBUG_CODE_PATH",
description: "The directory containing all the source files",
default_value: ".",
verify_block: proc do |value|
UI.user_error!("Couldn't find the folder at '#{File.absolute_path(value)}'") unless File.directory?(value)
end),
FastlaneCore::ConfigItem.new(key: :extension,
env_name: "FL_ENSURE_NO_DEBUG_CODE_EXTENSION",
description: "The extension that should be searched for",
optional: true,
verify_block: proc do |value|
value.delete!('.') if value.include? "."
end),
FastlaneCore::ConfigItem.new(key: :extensions,
env_name: "FL_ENSURE_NO_DEBUG_CODE_EXTENSIONS",
description: "An array of file extensions that should be searched for",
optional: true,
is_string: false)
]
end
|
.category ⇒ Object
107
108
109
|
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 107
def self.category
:misc
end
|
.description ⇒ Object
44
45
46
|
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 44
def self.description
"Ensures the given text is nowhere in the code base"
end
|
.details ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 48
def self.details
[
"You don't want any debug code to slip into production. This can be used",
"to check if there is any debug code still in your code base or if you have",
"things like // TO DO or similar"
].join("\n")
end
|
.example_code ⇒ Object
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 91
def self.example_code
[
'ensure_no_debug_code(text: "// TODO")',
'ensure_no_debug_code(text: "Log.v",
extension: "java")',
'ensure_no_debug_code(text: "NSLog",
path: "./lib",
extension: "m")',
'ensure_no_debug_code(text: "(^#define DEBUG|NSLog)",
path: "./lib",
extension: "m")',
'ensure_no_debug_code(text: "<<<<<<",
extensions: ["m", "swift", "java"])'
]
end
|
.is_supported?(platform) ⇒ Boolean
111
112
113
|
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 111
def self.is_supported?(platform)
true
end
|
.output ⇒ Object
83
84
85
|
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 83
def self.output
[]
end
|
.run(params) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 4
def self.run(params)
command = "grep -RE '#{params[:text]}' '#{File.absolute_path(params[:path])}'"
extensions = []
extensions << params[:extension] unless params[:extension].nil?
if params[:extensions]
params[:extensions].each do |extension|
extension.delete!('.') if extension.include? "."
extensions << extension
end
end
if extensions.count > 1
command << " --include=\\*.{#{extensions.join(',')}}"
elsif extensions.count > 0
command << " --include=\\*.#{extensions.join(',')}"
end
return command if Helper.is_test?
UI.important(command)
results = `#{command}`
found = []
results.split("\n").each do |current_raw|
found << current_raw.strip
end
UI.user_error!("Found debug code '#{params[:text]}': \n\n#{found.join("\n")}") if found.count > 0
UI.message("No debug code found in code base 🐛")
end
|