bitovi/canjs

View on GitHub

Showing 80 of 460 total issues

Function connected has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  connected() {
    const diameter = 255;
    const radius = diameter / 2 - 5;
    const center = diameter / 2;

Severity: Minor
Found in docs/can-guides/commitment/recipes/canvas-clock/6-min-hour-hands.js - About 1 hr to fix

    Function setup has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        setup: function() {
            var template = stache(
                "{{# for(box of boxes) }}" +
                "<div class='box-view'>" +
                "<div class='box' id='box-{{ box.number }}'  style='{{ box.style }}'>" +
    Severity: Minor
    Found in benchmark/spinning-circle.js - About 1 hr to fix

      Function connected has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          connected() {
              // derive the width
              this.width = width(this) - this.firstElementChild.offsetWidth;
              this.listenTo(window, "resize", () => {
                  this.width = width(this) - this.firstElementChild.offsetWidth;
      Severity: Minor
      Found in demos/technology-overview/percent-slider.js - About 1 hr to fix

        Function state has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            get state(){
                if (this.printingReceipt) {
                    return "printingReceipt";
                }
                if (this.currentTransaction) {
        Severity: Minor
        Found in docs/can-guides/experiment/atm/13-printing/js.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 state has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            get state(){
                if (this.printingReceipt) {
                    return "printingReceipt";
                }
                if (this.currentTransaction) {
        Severity: Minor
        Found in docs/can-guides/experiment/atm/atm-stream.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 createPlaylist has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          createPlaylist() {
            const playlistName = prompt("What would you like to name your playlist?");
            if (!playlistName) {
              return;
            }

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

              get state(){
          
                  if (this.currentTransaction) {
                      if (this.currentTransaction.state === "executed") {
                          return "successfulTransaction";
          Severity: Minor
          Found in docs/can-guides/experiment/atm/10-deposit-info/js.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 getPackageJsonByRelease has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          async function getPackageJsonByRelease(previousRelease, currentRelease) {
              const recentReleaseShas = [];
              let latestReleaseSha;
              let previousReleaseSha;
          
          
          Severity: Minor
          Found in generate-release-notes.js - About 1 hr to fix

            Function connected has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              connected() {
                const diameter = 255;
                const radius = diameter / 2 - 5;
                const center = diameter / 2;
            
            
            Severity: Minor
            Found in docs/can-guides/commitment/recipes/canvas-clock/4-second-hand.js - About 1 hr to fix

              Function fetchData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  () => {
                      return {
                          getListData(params) {
                              return _makeFetchRequest(
                                  _getRequestURLAndMethod(this.url, 'getListData', params),

                Function _getRequestURLAndMethod has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function _getRequestURLAndMethod(connUrl, requestName, params) {
                    let url = null;
                    let method = null;
                
                    if (connUrl[requestName]) {

                  Function getAllReleaseNotes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function getAllReleaseNotes(updatedDependencies) {
                      const matchingTags = [];
                      let releaseNotes = {};
                      for (let key in updatedDependencies) {
                          try {
                  Severity: Minor
                  Found in generate-release-notes.js - About 1 hr to fix

                    Function fireEventForDropPosition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      fireEventForDropPosition(ev, drop, drag, eventName) {
                        const dragData = domData.get(drag.element[0], "dragData");
                        const sortables = $(this.element).children();
                    
                        for (var i = 0; i < sortables.length; i++) {

                      Function fireEventForDropPosition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          fireEventForDropPosition: function(ev, drop, drag, eventName) {
                              const dragData = domData.get(drag.element[0], "dragData");
                      
                              const sortables = $(this.element).children();
                      
                      
                      Severity: Minor
                      Found in docs/can-guides/commitment/recipes/playlist-editor/7-revert.js - About 1 hr to fix

                        Function fireEventForDropPosition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            fireEventForDropPosition: function(ev, drop, drag, eventName) {
                                const dragData = domData.get(drag.element[0], "dragData");
                        
                                const sortables = $(this.element).children();
                        
                        
                        Severity: Minor
                        Found in docs/can-guides/commitment/recipes/playlist-editor/6-order.js - About 1 hr to fix

                          Function connected has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            connected() {
                              googleAPI.then(() => {
                                this.map = new google.maps.Map(this.mapElement, {
                                  zoom: 10,
                                  center: {
                          Severity: Minor
                          Found in docs/can-guides/commitment/recipes/cta-bus-map/6-clean-markers.js - About 1 hr to fix

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

                                get state(){
                            
                                    if (this.currentTransaction) {
                                        if (this.currentTransaction.account) {
                                            if (this.currentTransaction instanceof Deposit) {
                            Severity: Minor
                            Found in docs/can-guides/experiment/atm/9-picking-account/js.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 getElementsInRange has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getElementsInRange(range, wrapNodeName) {
                              const elements = [];
                            
                              function addSiblingElement(element) {
                                // We are going to wrap all text nodes with a span.
                            Severity: Minor
                            Found in docs/can-guides/commitment/recipes/text-editor/7-funky-range.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 state has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                get state() {
                                    // if printingReceipt
                                    // if a currentTransaction
                                    //    and the transaction is executed -> successfulTransaction
                                    //    if an account
                            Severity: Minor
                            Found in docs/can-guides/experiment/atm/atm.js - About 1 hr to fix

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

                              const makeEntities = function(parentId, depth) {
                                if (depth > 5) {
                                  return [];
                                }
                                // The number of entities to create.

                              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