Showing 21 of 35 total issues
Function ConsoleLogViewer
has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring. Open
Open
var ConsoleLogViewer = (function() {
ConsoleLogViewer.ALIGNMENT = "top"; // top | bottom
ConsoleLogViewer.IS_MINIMIZED = false; // true | false
ConsoleLogViewer.LOG_ENABLED = true;
ConsoleLogViewer.IS_CLOSED = false;
- 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 ConsoleLogViewer
has 260 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var ConsoleLogViewer = (function() {
ConsoleLogViewer.ALIGNMENT = "top"; // top | bottom
ConsoleLogViewer.IS_MINIMIZED = false; // true | false
ConsoleLogViewer.LOG_ENABLED = true;
ConsoleLogViewer.IS_CLOSED = false;
File console-log-viewer.js
has 545 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Displays logs and Javascript errors in an overlay on top of your site. Useful for mobile webdevelopment.
*
* <https://github.com/markknol/console-log-viewer>
* @author Mark Knol <http://blog.stroep.nl>
Function fullTest
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const fullTest = async (screenName) => {
let response;
try {
response = await fetch(`.api/${screenName}`);
} catch (err) {
Function fullTest
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
const fullTest = async (screenName) => {
let response;
try {
response = await fetch(`.api/${screenName}`);
} catch (err) {
- 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 addDivs
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ConsoleLogViewer.prototype.addDivs = function(self)
{
var self = self;
var alignment = window.location.href.indexOf("console_at_bottom=true") > -1 || window.location.href.indexOf("console_at_bottom=1") > -1 ? "bottom-aligned" : "top-aligned";
var scripts = window.document.getElementsByTagName('script');
Function request
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
request: function(post) {
var me = this;
me.responseData = null;
var r = this.req = js_Browser.createXMLHttpRequest();
var onreadystatechange = function(_) {
Function __string_rec
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
js_Boot.__string_rec = function(o,s) {
if(o == null) return "null";
if(s.length >= 5) return "<...>";
var t = typeof(o);
if(t == "function" && (o.__name__ || o.__ename__)) t = "object";
Function constructor
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(test) {
// create and add task elements
this.tasks = constructTaskData().sort((a, b) => (a.idx - b.idx)).map(task => new Task(task));
this.tasksById = this.tasks.reduce(
(acc, task) => ({ [task.id]: task, ...acc }),
Function overwrite
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ConsoleLogViewer.prototype.overwrite = function()
{
var self = this;
// store original functions
var original =
Function createTaskElement
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static createTaskElement(task) {
const listItem = Task.template.firstElementChild.cloneNode(true);
const header = listItem.querySelector('[data-task-component="header"]');
const message = listItem.querySelector('[data-task-component="message"]');
const description = listItem.querySelector('[data-task-component="description"]');
Function show
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
DebugSource.show = function(url,message) {
var $window = window.open("","_blank");
var http = new haxe_Http(url.split("#").shift());
http.onData = function(data) {
var startLineNumber = Std.parseInt(url.split("#").pop().split("-").shift()) - 1;
Function update
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
update(status, msg) {
// icon
const { icon } = this.components;
switch (status) {
case 'running':
Function onData
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
http.onData = function(data) {
var startLineNumber = Std.parseInt(url.split("#").pop().split("-").shift()) - 1;
var endLineNumber = Std.parseInt(url.split("#").pop().split("-").pop()) - 1;
var css = $window.document.createElement("style");
var stylesheet = "body{font:14px consolas,'courier new',monospaced;background:#FFF;}\npre{max-width:1000px;width:100%;white-space:pre-line;}\n.highlighted-line{background:yellow;display:inline-block;}\n.tab{padding-right:20px;}\n.keyword{color:blue;}\n.operator{color:lightgray;}\n.linenumber{display:inline-block;width:45px;margin-right:5px;background:darkgray;color:white;}\n.debug-error{display:block;background:red;color:white;}";
Function onreadystatechange
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var onreadystatechange = function(_) {
if(r.readyState != 4) return;
var s;
try {
s = r.status;
Avoid deeply nested control flow statements. Open
Open
if(i != 2) str += "," + js_Boot.__string_rec(o[i],s); else str += js_Boot.__string_rec(o[i],s);
Avoid too many return
statements within this function. Open
Open
if(s2 != "[object Object]") return s2;
Avoid too many return
statements within this function. Open
Open
return str1;
Avoid too many return
statements within this function. Open
Open
return "???";
Avoid too many return
statements within this function. Open
Open
return str2;