staltz/cycle

View on GitHub

Showing 112 of 188 total issues

File EventDelegator.ts has 530 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import xs, {Stream, Subscription} from 'xstream';
import {ScopeChecker} from './ScopeChecker';
import {IsolateModule} from './IsolateModule';
import {getSelectors, isEqualNamespace} from './utils';
import {ElementFinder} from './ElementFinder';
Severity: Major
Found in dom/src/EventDelegator.ts - About 1 day to fix

    Function makeCollection has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

    export function makeCollection<S, So = any, Si = any>(
      opts: CollectionOptions<S, So, Si>
    ) {
      return function collectionComponent(sources: any) {
        const name = opts.channel || 'state';
    Severity: Minor
    Found in state/src/Collection.ts - About 7 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 hyperscript-helpers.ts has 434 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // tslint:disable:max-file-line-count
    import {h, VNode, VNodeData} from 'snabbdom';
    
    function isValidString(param: any): boolean {
      return typeof param === 'string' && param.length > 0;
    Severity: Minor
    Found in dom/src/hyperscript-helpers.ts - About 6 hrs to fix

      File graphSerializer.ts has 348 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* tslint:disable:max-file-line-count */
      import xs, {Stream, Listener} from 'xstream';
      import {DevToolEnabledSource} from '@cycle/run';
      import debounce from 'xstream/extra/debounce';
      import * as dagre from 'dagre';
      Severity: Minor
      Found in devtool/src/graphSerializer.ts - About 4 hrs to fix

        Function checkEqual has 108 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function checkEqual(
          completeStore: any,
          assert: any,
          interval: number,
          comparator: any
        Severity: Major
        Found in time/src/assert-equal.ts - About 4 hrs to fix

          Function optionsToSuperagent has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

          export function optionsToSuperagent(rawReqOptions: RequestOptions) {
            const reqOptions = preprocessReqOptions(rawReqOptions);
            if (typeof reqOptions.url !== `string`) {
              throw new Error(
                `Please provide a \`url\` property in the request options.`
          Severity: Minor
          Found in http/src/http-driver.ts - About 4 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 runRealtime has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

          function runRealtime(
            scheduler: any,
            frameCallbacks: any,
            currentTime: () => number,
            setTime: (t: number) => void
          Severity: Minor
          Found in time/src/time-driver.ts - 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 makeClickListener has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          function makeClickListener(push: (p: string) => void) {
            return function clickListener(event: MouseEvent) {
              if (which(event) !== 1) {
                return;
              }
          Severity: Minor
          Found in history/src/captureClicks.ts - 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 makeDOMDriver has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function makeDOMDriver(
            container: string | Element | DocumentFragment,
            options: DOMDriverOptions = {}
          ): Driver<Stream<VNode>, MainDOMSource> {
            checkValidContainer(container);
          Severity: Major
          Found in dom/src/makeDOMDriver.ts - About 2 hrs to fix

            Function onEvent has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private onEvent(
                eventType: string,
                event: Event,
                passive: boolean,
                bubbles = true
            Severity: Major
            Found in dom/src/EventDelegator.ts - About 2 hrs to fix

              Function optionsToSuperagent has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function optionsToSuperagent(rawReqOptions: RequestOptions) {
                const reqOptions = preprocessReqOptions(rawReqOptions);
                if (typeof reqOptions.url !== `string`) {
                  throw new Error(
                    `Please provide a \`url\` property in the request options.`
              Severity: Major
              Found in http/src/http-driver.ts - About 2 hrs to fix

                Function makeCollection has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function makeCollection<S, So = any, Si = any>(
                  opts: CollectionOptions<S, So, Si>
                ) {
                  return function collectionComponent(sources: any) {
                    const name = opts.channel || 'state';
                Severity: Major
                Found in state/src/Collection.ts - About 2 hrs to fix

                  Function addEventListener has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public addEventListener(
                      eventType: string,
                      namespace: Array<Scope>,
                      options: EventsFnOptions,
                      bubbles?: boolean
                  Severity: Major
                  Found in dom/src/EventDelegator.ts - About 2 hrs to fix

                    Function collectionComponent has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      return function collectionComponent(sources: any) {
                        const name = opts.channel || 'state';
                        const itemKey = opts.itemKey;
                        const itemScope = opts.itemScope || defaultItemScope;
                        const state$ = xs.fromObservable((sources[name] as StateSource<S>).stream);
                    Severity: Major
                    Found in state/src/Collection.ts - About 2 hrs to fix

                      Function renderNodeLabel has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function renderNodeLabel(node: StreamGraphNode, zap: Zap | null, style: string): VNode {
                        let label = '';
                        if (zap) {
                          // MUTATION!
                          if (Array.isArray(zap.value)) {
                      Severity: Minor
                      Found in devtool/src/panel/graph/view.ts - 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 createModule has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                        public createModule() {
                          const self = this;
                          return {
                            create(emptyVNode: VNode, vNode: VNode) {
                              const {elm, data = {}} = vNode;
                      Severity: Minor
                      Found in dom/src/IsolateModule.ts - 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 comparator has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const comparator = (a: any) => (b: any) => {
                        if (a.time < b.time) {
                          return -1;
                        }
                      
                      
                      Severity: Minor
                      Found in time/src/scheduler.ts - 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 app.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import xs from 'xstream'
                      import debounce from 'xstream/extra/debounce'
                      import dropUntil from 'xstream/extra/dropUntil'
                      import {ul, li, span, input, div, section, label} from '@cycle/dom'
                      import Immutable from 'immutable'
                      Severity: Minor
                      Found in examples/advanced/autocomplete-search/src/app.js - About 2 hrs to fix

                        File view.ts has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import {VNode, svg} from '@cycle/dom';
                        import {StreamGraphNode, StreamGraphEdge, Zap} from '../../graphSerializer';
                        import styles from './styles';
                        
                        export const DIAGRAM_PADDING_H = 30;
                        Severity: Minor
                        Found in devtool/src/panel/graph/view.ts - About 2 hrs to fix

                          Function DOMDriver has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function DOMDriver(vnode$: Stream<VNode>, name = 'DOM'): MainDOMSource {
                              domDriverInputGuard(vnode$);
                              const sanitation$ = xs.create<null>();
                          
                              const firstRoot$ = domReady$.map(() => {
                          Severity: Major
                          Found in dom/src/makeDOMDriver.ts - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language