console
in code that runs on browser JS-0002 6965 dataType: "xml",
6966 error: function (e) {
6967 alert("An error occurred while processing XML file"),
6968 console.log("XML reading Failed: ", e); 6969 },
6970 success: function (response) {
6971 $(response)
7082 dataType: "xml",
7083 error: function (e) {
7084 alert("An error occurred while processing XML file"),
7085 console.log("XML reading Failed: ", e); 7086 },
7087 success: function (response) {
7088 $(response)
7462 dataType: "xml",
7463 error: function (e) {
7464 alert("An error occurred while processing XML file"),
7465 console.log("XML reading Failed: ", e); 7466 },
7467 success: function (response) {
7468 $(response)
6965 dataType: "xml",
6966 error: function (e) {
6967 alert("An error occurred while processing XML file"),
6968 console.log("XML reading Failed: ", e); 6969 },
6970 success: function (response) {
6971 $(response)
6963 dataType: "xml",
6964 error: function (e) {
6965 alert("An error occurred while processing XML file"),
6966 console.log("XML reading Failed: ", e); 6967 },
6968 success: function (response) {
6969 $(response)
It is considered a best practice to avoid the use of any console
methods in JavaScript code that will run on the browser.
NOTE: If your repository contains a server side project, you can add "nodejs"
to the environment
property of analyzer meta in .deepsource.toml
.
This will prevent this issue from getting raised.
Documentation for the analyzer meta can be found here.
Alternatively, you can silence this issue for your repository as shown here.
If a specific console
call is meant to stay for other reasons, you can add a skipcq comment to that line.
This will inform other developers about the reason behind the log's presence, and prevent DeepSource from flagging it.
Usually, console
methods are only used for debugging, and can leak internal info to the client.
Removing the console
call will fix this issue.
if (!secure(data)) {
console.log("data is not secure", data) // `data` is visible to the client
}
console.table(tableObj)
if (!secure(data)) {
// alter the DOM to inform the user that `data` is insecure.
}
console.table(tableObj) // skipcq: JS-0002 Easter egg. Users are meant to see this.