bitovi/canjs

View on GitHub

Showing 80 of 460 total issues

Function exports has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(){
    var todoAlgebra = new set.Algebra(
      set.props.boolean("complete"),
      set.props.id("id"),
      set.props.sort("sort")
Severity: Major
Found in benchmark/todomvc-code.js - About 4 hrs to fix

    File js.js has 368 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // ========================================
    // CODE
    // ========================================
    
    can.fixture({
    Severity: Minor
    Found in docs/can-guides/experiment/atm/13-printing/js.js - About 4 hrs to fix

      File js.js has 343 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // ========================================
      // CODE
      // ========================================
      
      can.fixture({
      Severity: Minor
      Found in docs/can-guides/experiment/atm/10-deposit-info/js.js - About 4 hrs to fix

        File js.js has 330 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // ========================================
        // CODE
        // ========================================
        
        can.fixture({
        Severity: Minor
        Found in docs/can-guides/experiment/atm/9-picking-account/js.js - About 3 hrs to fix

          File js.js has 315 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // ========================================
          // CODE
          // ========================================
          
          can.fixture({
          Severity: Minor
          Found in docs/can-guides/experiment/atm/8-choosing-transaction/js.js - About 3 hrs to fix

            File js.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // ========================================
            // CODE
            // ========================================
            
            can.fixture({
            Severity: Minor
            Found in docs/can-guides/experiment/atm/7-reading-pin/js.js - About 2 hrs to fix

              File atm-stream.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // ========================================
              // CODE
              // ========================================
              
              can.fixture({
              Severity: Minor
              Found in docs/can-guides/experiment/atm/atm-stream.js - About 2 hrs to fix

                File 9-disable-payments.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { kefir as Kefir, StacheElement } from "//unpkg.com/can@6/ecosystem.mjs";
                
                class CCPayment extends StacheElement {
                    static view = `
                        <form on:submit="this.pay(scope.event)">

                  File atm.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  "use strict";
                  can.fixture({
                      "/verifyCard": function(request, response) {
                          if (!request.data || !request.data.number || !request.data.pin) {
                              response(400, {});
                  Severity: Minor
                  Found in docs/can-guides/experiment/atm/atm.js - About 2 hrs to fix

                    File 8-create-playlist.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import {
                      addJQueryEvents,
                      Control,
                      domData,
                      domEvents,

                      File 8-pay-button.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { kefir as Kefir, StacheElement } from "//unpkg.com/can@6/ecosystem.mjs";
                      
                      class CCPayment extends StacheElement {
                        static view = `
                          <form on:submit="this.pay(scope.event)">

                        File js.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        // ========================================
                        // CODE
                        // ========================================
                        
                        can.fixture({
                        Severity: Minor
                        Found in docs/can-guides/experiment/atm/6-reading-card/js.js - About 2 hrs to fix

                          Function showOnlyWhenBlurredOnce has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            showOnlyWhenBlurredOnce(errorStream, blurredStream) {
                              const errorEvent = errorStream.map(error => {
                                if (!error) {
                                  return {
                                    type: "valid"
                          Severity: Major
                          Found in docs/can-guides/commitment/recipes/credit-card-advanced/6-cvc.js - About 2 hrs to fix

                            Function showOnlyWhenBlurredOnce has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              showOnlyWhenBlurredOnce(errorStream, blurredStream) {
                                const errorEvent = errorStream.map(error => {
                                  if (!error) {
                                    return {
                                      type: "valid"

                              Function showOnlyWhenBlurredOnce has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  showOnlyWhenBlurredOnce(errorStream, blurredStream) {
                                      const errorEvent = errorStream.map(error => {
                                          if (!error) {
                                              return {
                                                  type: "valid"

                                Function showOnlyWhenBlurredOnce has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  showOnlyWhenBlurredOnce(errorStream, blurredStream) {
                                    const errorEvent = errorStream.map(error => {
                                      if (!error) {
                                        return {
                                          type: "valid"

                                  Function showOnlyWhenBlurredOnce has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    showOnlyWhenBlurredOnce(errorStream, blurredStream) {
                                      const errorEvent = errorStream.map(error => {
                                        if (!error) {
                                          return {
                                            type: "valid"

                                    Function showOnlyWhenBlurredOnce has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      showOnlyWhenBlurredOnce(errorStream, blurredStream) {
                                        const errorEvent = errorStream.map(error => {
                                          if (!error) {
                                            return {
                                              type: "valid"
                                    Severity: Major
                                    Found in docs/can-guides/commitment/recipes/credit-card-advanced/5-expiry.js - About 2 hrs to fix

                                      Function state has a Cognitive Complexity of 15 (exceeds 5 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

                                      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 45 lines of code (exceeds 25 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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language