Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
public-apis
Commits
e859668b
Commit
e859668b
authored
Jul 10, 2017
by
Dave Machado
Browse files
Validate Auth values to match allowed values
parent
0fec9616
Changes
1
Hide whitespace changes
Inline
Side-by-side
build/validate.rb
View file @
e859668b
#!/usr/bin/env ruby
#!/usr/bin/env ruby
auth_keys
=
[
'apiKey'
,
'OAuth'
,
'X-Mashape-Key'
,
'No'
]
args
=
ARGV
args
=
ARGV
filename
=
args
[
0
]
filename
=
args
[
0
]
fail_flag
=
false
fail_count
=
0
File
.
foreach
(
filename
).
with_index
do
|
line
,
line_num
|
File
.
foreach
(
filename
).
with_index
do
|
line
,
line_num
|
line_num
+=
1
line_num
+=
1
# puts "#{line_num}: #{line}"
# puts "#{line_num}: #{line}"
...
@@ -13,8 +16,12 @@ File.foreach(filename).with_index do |line, line_num|
...
@@ -13,8 +16,12 @@ File.foreach(filename).with_index do |line, line_num|
end
end
values
=
line
.
split
(
"|"
)
values
=
line
.
split
(
"|"
)
values
.
each
.
with_index
do
|
v
,
vn
|
# Check Auth Values to conform to valid options only
puts
"
#{
vn
}
:
#{
v
}
"
auth_val
=
values
[
3
].
lstrip
.
chop
.
tr
(
'``'
,
''
)
if
!
auth_keys
.
include?
auth_val
puts
"(
#{
line_num
}
) Invalid Auth (
#{
auth_val
}
):
#{
line
}
"
fail_flag
=
false
fail_count
+=
1
end
end
end
end
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment