G43riko/GLibrary

View on GitHub

Showing 21 of 23 total issues

Function generateArrayUtils has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

function generateArrayUtils(target = {}) {
    const isTargetPrototype = target === Array.prototype;
    const staticTarget = isTargetPrototype ? Array : target;

    staticTarget.subArray = function(array, from = 0, to = array.length) {
Severity: Minor
Found in src/ArrayUtils.js - About 5 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 setConstants has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

exports.setConstants = (function () {
    let pattern = new RegExp("^<%= .* %>$");
    let loadOptions = (data, key = "") => {
        const options = {};
        const templates = {};
Severity: Minor
Found in src/MiscUtils.js - About 5 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 generateObjectUtils has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

function generateObjectUtils(target = {}) {
    const isTargetPrototype = target === Object.prototype;
    const staticTarget = isTargetPrototype ? Object : target;

    staticTarget.without = function(obj, items) {
Severity: Minor
Found in src/ObjectUtils.js - About 3 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 generateArrayUtils has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function generateArrayUtils(target = {}) {
    const isTargetPrototype = target === Array.prototype;
    const staticTarget = isTargetPrototype ? Array : target;

    staticTarget.subArray = function(array, from = 0, to = array.length) {
Severity: Major
Found in src/ArrayUtils.js - About 3 hrs to fix

    Function generateStringUtils has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function generateStringUtils(target = {}) {
        const isTargetPrototype = target === String.prototype;
        const staticTarget = isTargetPrototype ? String : target;
    
        staticTarget.between = function(text, key1, key2) {
    Severity: Major
    Found in src/StringUtils.js - About 3 hrs to fix

      Function generateStringUtils has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      function generateStringUtils(target = {}) {
          const isTargetPrototype = target === String.prototype;
          const staticTarget = isTargetPrototype ? String : target;
      
          staticTarget.between = function(text, key1, key2) {
      Severity: Minor
      Found in src/StringUtils.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 setConstants has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.setConstants = (function () {
          let pattern = new RegExp("^<%= .* %>$");
          let loadOptions = (data, key = "") => {
              const options = {};
              const templates = {};
      Severity: Minor
      Found in src/MiscUtils.js - About 1 hr to fix

        Function roughSizeOfObject has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        exports.roughSizeOfObject = function (object) {
            const objectList = [];
            const stack = [object];
            let bytes = 0;
        
        
        Severity: Minor
        Found in src/MiscUtils.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 generateObjectUtils has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function generateObjectUtils(target = {}) {
            const isTargetPrototype = target === Object.prototype;
            const staticTarget = isTargetPrototype ? Object : target;
        
            staticTarget.without = function(obj, items) {
        Severity: Minor
        Found in src/ObjectUtils.js - About 1 hr to fix

          Function where has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public static where(array: any[], condition: any[]): any[] {
                  const result: any[] = [];
                  for (let i = 0 ; i < array.length ; i++) {
                      let add = true;
                      for (const key in condition) {
          Severity: Minor
          Found in src/ts/ArrayUtils.ts - 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 loadOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              let loadOptions = (data, key = "") => {
                  const options = {};
                  const templates = {};
                  let actualKey;
          
          
          Severity: Minor
          Found in src/MiscUtils.js - About 1 hr to fix

            Function roughSizeOfObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public static roughSizeOfObject(object: any): number {
                    const objectList = [];
                    const stack = [object];
                    let bytes = 0;
            
            
            Severity: Minor
            Found in src/ts/MiscUtils.ts - 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 GElement has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.GElement = function(element) {
            
                return {
                    getId: function() {
                        return element.id;
            Severity: Minor
            Found in src/GElement.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                      if (navigator.geolocation) {
                          navigator.geolocation.getCurrentPosition(a => success({
                              accularity: a.coords && a.coords.accuracy  || "unknown",
                              latitude  : a.coords && a.coords.latitude  || "unknown",
                              longitude : a.coords && a.coords.longitude || "unknown"
              Severity: Major
              Found in src/analitics/BrowserAnalyzer.js - About 1 hr to fix

                Function getLocation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                exports.getLocation = function() {
                    return new Promise((success, reject) => {
                        if (navigator.geolocation) {
                            navigator.geolocation.getCurrentPosition(a => success({
                                accularity: a.coords && a.coords.accuracy  || "unknown",
                Severity: Minor
                Found in src/analitics/BrowserAnalyzer.js - About 55 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 constructor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    constructor(arg1, arg2, arg3){//ARGUMENT JE CANVAS ELEMENT
                        if(arg1 instanceof HTMLCanvasElement){
                            this._canvas = arg1;
                            if(arg2 && arg3){
                                this.setCanvasSize(arg2, arg3);
                Severity: Minor
                Found in src/dom/CanvasManager.js - About 55 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 isIn has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    static isIn (obj, data) {
                        if (Array.isArray(data)) {
                            if (data.indexOf(obj) >= 0) {
                                return true;
                            }
                Severity: Minor
                Found in src/ArrayUtils.js - About 55 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 objectToQueryParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static objectToQueryParams(obj: StringMap): string {
                        // TODO: add url prefix
                        let result = "";
                        for (const objKey in obj) {
                            if (obj.hasOwnProperty(objKey)) {
                Severity: Minor
                Found in src/ts/MiscUtils.ts - 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 objectToQueryParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                exports.objectToQueryParams = function (obj) {
                    let result = "";
                    for (const objKey in obj) {
                        if (obj.hasOwnProperty(objKey)) {
                            result += (result.length > 0 ? "&" : "?") + objKey + "=" + obj[objKey];
                Severity: Minor
                Found in src/MiscUtils.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 isPlain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static isPlain(object: any): boolean {
                        for (const index in object) {
                            if (object.hasOwnProperty(index)) {
                                if (typeof object[index] === "undefined") {
                                    return false;
                Severity: Minor
                Found in src/ts/ObjectUtils.ts - 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