Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
cassiopee
jalhyd
Commits
a7736860
Commit
a7736860
authored
Nov 21, 2019
by
Mathias Chouet
🍝
Browse files
Get rid of eval() in getSeverity()
parent
ac261833
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/util/message.ts
View file @
a7736860
...
...
@@ -422,11 +422,13 @@ export class Message {
public
getSeverity
():
MessageSeverity
{
const
m
:
string
=
MessageCode
[
this
.
_code
];
const
prefix
:
string
=
m
.
split
(
"
_
"
)[
0
];
for
(
const
s
in
MessageSeverity
)
{
// pas nécessaire, mais permet d'avoir un contrôle de validité
if
(
MessageSeverity
[
s
]
===
prefix
)
{
// tslint:disable-next-line:no-eval
return
eval
(
"
MessageSeverity.
"
+
prefix
);
}
switch
(
prefix
)
{
case
"
ERROR
"
:
return
MessageSeverity
.
ERROR
;
case
"
WARNING
"
:
return
MessageSeverity
.
WARNING
;
case
"
INFO
"
:
return
MessageSeverity
.
INFO
;
}
throw
new
Error
(
"
Message.getSeverity() : valeur de code '
"
+
this
.
_code
+
"
' invalide
"
);
}
...
...
Write
Preview
Markdown
is supported
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