Function compile
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function compile() {
if (cwd !== "") {
// エディタのテキストを読み出し,JSONに
// これをpythonに投げて,コンパイルリザルト,ログを受け取る
// コンパイルに成功すれば,PDFファイルをindex.htmlに追加する
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File main.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
var editor;
var cwd = "";
$(window).load(init());
Function compile
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function compile() {
if (cwd !== "") {
// エディタのテキストを読み出し,JSONに
// これをpythonに投げて,コンパイルリザルト,ログを受け取る
// コンパイルに成功すれば,PDFファイルをindex.htmlに追加する
Function readFilelist
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function readFilelist(directoryItem) {
var json = JSON.stringify({
"_csrf_token": $("#_csrf_token").val()
});
Function init
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function init() {
editor = ace.edit("editor");
readDirectory($("#username").text());
$("#createDirectory").click(function () {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function readDirectory
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function readDirectory() {
var json = JSON.stringify({
"_csrf_token": $("#_csrf_token").val()
});
Function readFilelist
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function readFilelist(directoryItem) {
var json = JSON.stringify({
"_csrf_token": $("#_csrf_token").val()
});
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function success
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function (data) {
$("#filelist").empty();
var result = JSON.parse(data.ResultSet).result;
if (result !== "Failure") {
$("#cwd").text(cwd);
Function init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init() {
editor = ace.edit("editor");
readDirectory($("#username").text());
$("#createDirectory").click(function () {
Function success
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function (data) {
$("#directorylist").empty();
$("#directorylist").append(
"<li><a data-toggle='modal' href='#createDirectoryModal'>Create directory</a></li>"
);
Function setDirectory
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setDirectory(directoryItem) {
var json = JSON.stringify({
"name": directoryItem,
"_csrf_token": $("#_csrf_token").val()
});
Function setDirectory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function setDirectory(directoryItem) {
var json = JSON.stringify({
"name": directoryItem,
"_csrf_token": $("#_csrf_token").val()
});
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function removeDirectory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function removeDirectory(directoryItem) {
if (!confirm("Remove directory: "+escapeHTML(directoryItem)+"\nAre you sure?")) {
return false;
} else {
var json = JSON.stringify({
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Unexpected alert. Open
alert("Failed to remove directory");
- Read upRead up
- Exclude checks
Disallow Use of Alert (no-alert)
JavaScript's alert
, confirm
, and prompt
functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation. Furthermore, alert
is often used while debugging code, which should be removed before deployment to production.
alert("here!");
Rule Details
This rule is aimed at catching debugging code that should be removed and popup UI elements that should be replaced with less obtrusive, custom UIs. As such, it will warn when it encounters alert
, prompt
, and confirm
function calls which are not shadowed.
Examples of incorrect code for this rule:
/*eslint no-alert: "error"*/
alert("here!");
confirm("Are you sure?");
prompt("What's your name?", "John Doe");
Examples of correct code for this rule:
/*eslint no-alert: "error"*/
customAlert("Something happened!");
customConfirm("Are you sure?");
customPrompt("Who are you?");
function foo() {
var alert = myCustomLib.customAlert;
alert();
}
Related Rules
- [no-console](no-console.md)
- [no-debugger](no-debugger.md) Source: http://eslint.org/docs/rules/
Unexpected confirm. Open
if (!confirm("Remove directory: "+escapeHTML(directoryItem)+"\nAre you sure?")) {
- Read upRead up
- Exclude checks
Disallow Use of Alert (no-alert)
JavaScript's alert
, confirm
, and prompt
functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation. Furthermore, alert
is often used while debugging code, which should be removed before deployment to production.
alert("here!");
Rule Details
This rule is aimed at catching debugging code that should be removed and popup UI elements that should be replaced with less obtrusive, custom UIs. As such, it will warn when it encounters alert
, prompt
, and confirm
function calls which are not shadowed.
Examples of incorrect code for this rule:
/*eslint no-alert: "error"*/
alert("here!");
confirm("Are you sure?");
prompt("What's your name?", "John Doe");
Examples of correct code for this rule:
/*eslint no-alert: "error"*/
customAlert("Something happened!");
customConfirm("Are you sure?");
customPrompt("Who are you?");
function foo() {
var alert = myCustomLib.customAlert;
alert();
}
Related Rules
- [no-console](no-console.md)
- [no-debugger](no-debugger.md) Source: http://eslint.org/docs/rules/
Unexpected alert. Open
alert("Successfully removed directory");
- Read upRead up
- Exclude checks
Disallow Use of Alert (no-alert)
JavaScript's alert
, confirm
, and prompt
functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation. Furthermore, alert
is often used while debugging code, which should be removed before deployment to production.
alert("here!");
Rule Details
This rule is aimed at catching debugging code that should be removed and popup UI elements that should be replaced with less obtrusive, custom UIs. As such, it will warn when it encounters alert
, prompt
, and confirm
function calls which are not shadowed.
Examples of incorrect code for this rule:
/*eslint no-alert: "error"*/
alert("here!");
confirm("Are you sure?");
prompt("What's your name?", "John Doe");
Examples of correct code for this rule:
/*eslint no-alert: "error"*/
customAlert("Something happened!");
customConfirm("Are you sure?");
customPrompt("Who are you?");
function foo() {
var alert = myCustomLib.customAlert;
alert();
}
Related Rules
- [no-console](no-console.md)
- [no-debugger](no-debugger.md) Source: http://eslint.org/docs/rules/