creative-connections/Bodylight.js-Components

View on GitHub
src_aurelia-bodylight-plugin/src/elements/fb-config.js

Summary

Maintainability
D
1 day
Test Coverage

Function processAnswers has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    processAnswers(data) {
        //const dbRef = ref(this.database, 'answers/');
        //dbRef.once('value', snapshot => {
        //const data = snapshot.val();
        let aggregatedResults = {}
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/fb-config.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 bind has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    async bind() {
        let firebaseConfig;
        console.log('FBconfig.bind()');
        if (!window.userid) {
            let storeduuid = localStorage.getItem('deviceUUID');
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/fb-config.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

File fb-config.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * firebase configuration
 * subscribe to fb-get-message channel to get broadcasted messages from firebase
 * send message to fb-send-message channel to sned the message to firebase
 */
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/fb-config.js - About 2 hrs to fix

    Function bind has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async bind() {
            let firebaseConfig;
            console.log('FBconfig.bind()');
            if (!window.userid) {
                let storeduuid = localStorage.getItem('deviceUUID');
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/fb-config.js - About 1 hr to fix

      Function processAnswers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          processAnswers(data) {
              //const dbRef = ref(this.database, 'answers/');
              //dbRef.once('value', snapshot => {
              //const data = snapshot.val();
              let aggregatedResults = {}
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/elements/fb-config.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                for (let answer of answersStruct.answers) {
                                    const aid = answer.charAt(0);
                                    if (aggregatedResults[qid].a[aid])
                                        aggregatedResults[qid].a[aid]++;
                                    else
        Severity: Major
        Found in src_aurelia-bodylight-plugin/src/elements/fb-config.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for (let answer of answersStruct.answers) {
                                      const aid = answer.charAt(0);
                                      aggregatedResults[qid].a[aid] = 1;
                                  }
          Severity: Major
          Found in src_aurelia-bodylight-plugin/src/elements/fb-config.js - About 45 mins to fix

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

                unbind() {
                    this.subscription.dispose();
                    this.subsendanswer.dispose();
                    this.subprocessanswer.dispose();
                    if (this.listen) {
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/fb-config.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 listenFor3Messages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                listenFor3Messages() {
                    this.showbutton3 = true;
                    const messagesRef = ref(this.database, this.listen3); //answers
                    // Define the listener as an arrow function and store it
                    this.messagesListener = snapshot => {
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/fb-config.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