Sylvain59650/htmlelement-extension

View on GitHub

Showing 5 of 11 total issues

Function setInputs has a Cognitive Complexity of 49 (exceeds 10 allowed). Consider refactoring.
Open

HTMLFormElement.prototype.setInputs = function(obj, triggerChange = true) {
  var evt = new Event("change");
  for (var key in obj) {
    let val = obj[key];
    var inputs = this.qsa("[name='" + key + "']");
Severity: Minor
Found in src/HTMLFormElement.js - About 6 hrs to fix

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 getJSON has a Cognitive Complexity of 26 (exceeds 10 allowed). Consider refactoring.
Open

document.getJSON = function(url, onSuccess, onError, options) {
  var request = new XMLHttpRequest();
  if (isDef(options)) {
    if (options.forceReload) {
      var rnd = Math.random();
Severity: Minor
Found in src/document.js - About 2 hrs to fix

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 val has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

HTMLSelectElement.prototype.val = function () {
    if (arguments.length == 0) {
        if (!!this.value) {
            return this.value;
        }
Severity: Minor
Found in src/HTMLSelectElement.js - About 1 hr to fix

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 SendJson has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

document.SendJson = function (url, method, data, onSuccess, onError) {
    var request = new XMLHttpRequest();
    if (method.toLowerCase() === "get") {
        console.error("could not send in get method");
    }
Severity: Minor
Found in src/document.js - About 25 mins to fix

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 setClass has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

HTMLElement.prototype.setClass = function(classNames) {
  if (classNames === "") {
    this.setAttribute("class", "");
    return this;
  }
Severity: Minor
Found in src/HTMLElement.js - About 25 mins to fix

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

Severity
Category
Status
Source
Language