rx/presenters

View on GitHub
views/mdc/assets/js/components/events.js

Summary

Maintainability
C
1 day
Test Coverage

Function call has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    call() {
        const event = this.event;
        const target = getEventTarget(event);
        let eventParams = {};

Severity: Major
Found in views/mdc/assets/js/components/events.js - About 3 hrs to fix

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

    export function initEvents(e) {
        console.debug('\tEvents');
    
        for (const eventElem of getEventElements(e)) {
            var eventsData = JSON.parse(eventElem.dataset.events);
    Severity: Minor
    Found in views/mdc/assets/js/components/events.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 action_class has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static action_class(action, event, root) {
            const action_type = action[0];
            const url = action[1];
            const options = action[2];
            const params = action[3];
    Severity: Minor
    Found in views/mdc/assets/js/components/events.js - About 1 hr to fix

      Function initEvents has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function initEvents(e) {
          console.debug('\tEvents');
      
          for (const eventElem of getEventElements(e)) {
              var eventsData = JSON.parse(eventElem.dataset.events);
      Severity: Minor
      Found in views/mdc/assets/js/components/events.js - About 1 hr to fix

        Function fireAfterLoad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function fireAfterLoad(e) {
            for (const eventElem of getEventElements(e)) {
                var eventsData = JSON.parse(eventElem.dataset.events);
                for (var j = 0; j < eventsData.length; j++) {
                    var eventData = eventsData[j];
        Severity: Minor
        Found in views/mdc/assets/js/components/events.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 removeEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export function removeEvents(elem) {
            console.debug('\tuninitEvents');
        
            for (const eventElem of getEventElements(elem)) {
                let eventsData = JSON.parse(eventElem.dataset.events);
        Severity: Minor
        Found in views/mdc/assets/js/components/events.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

        There are no issues that match your filters.

        Category
        Status