cyclejs/cycle-core

View on GitHub

Showing 112 of 188 total issues

Function makeScheduler has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function makeScheduler<T>(): Schedule<T> {
  let schedule: Array<any> = [];

  function getSchedule() {
    return schedule;
Severity: Major
Found in time/src/scheduler.ts - About 2 hrs to fix

    Function instances$ has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          (acc: InternalInstances<Si>, nextState: Array<any> | any) => {
            const dict = acc.dict;
            if (Array.isArray(nextState)) {
              const nextInstArray = Array(nextState.length) as Array<
                Si & {_key: string}
    Severity: Minor
    Found in state/src/Collection.ts - About 2 hrs to fix

      Function createModule has 49 lines of code (exceeds 25 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 1 hr to fix

        Function runRealtime has 48 lines of code (exceeds 25 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 1 hr to fix

          Function addEventListener has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            public addEventListener(
              eventType: string,
              namespace: Array<Scope>,
              options: EventsFnOptions,
              bubbles?: boolean
          Severity: Minor
          Found in dom/src/EventDelegator.ts - 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 renderSourceOrSinkNode has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function renderSourceOrSinkNode(node: StreamGraphNode, zaps: Array<Zap>) {
            const index = zaps.map(zap => zap.id).indexOf(node.id);
            const zap = index === -1 ? null : zaps[index];
            const P = 5; // text padding
            const hook = {
          Severity: Minor
          Found in devtool/src/panel/graph/view.ts - About 1 hr to fix

            Function scrollagent has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              $.fn.scrollagent = function(options, callback) {
                // Account for $.scrollspy(function)
                if (typeof callback === 'undefined') {
                  callback = options;
                  options = {};
            Severity: Minor
            Found in docs/theme/script.js - About 1 hr to fix

              Function main has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function main(sources: any) {
                const {DOM, Time} = sources;
              
                const speed$ = DOM.select('.speed')
                  .events('input')
              Severity: Minor
              Found in time/example/index.ts - About 1 hr to fix

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

                  private bubble(
                    eventType: string,
                    elm: Element,
                    rootElement: Element | undefined,
                    event: CycleDOMEvent,
                Severity: Minor
                Found in dom/src/EventDelegator.ts - About 1 hr to fix

                  Function instanceLens has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function instanceLens(
                    itemKey: ItemKeyFn<any>,
                    key: string
                  ): Lens<Array<any>, any> {
                    return {
                  Severity: Minor
                  Found in state/src/Collection.ts - 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 timeDriver has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function timeDriver(sink: any): any {
                    let time = 0;
                    const frameCallbacks: Array<any> = [];
                    const scheduler = makeScheduler();
                  
                  
                  Severity: Minor
                  Found in time/src/time-driver.ts - About 1 hr to fix

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

                    function intent(domSource, timeSource) {
                      const UP_KEYCODE = 38
                      const DOWN_KEYCODE = 40
                      const ENTER_KEYCODE = 13
                      const TAB_KEYCODE = 9
                    Severity: Minor
                    Found in examples/advanced/autocomplete-search/src/app.js - About 1 hr to fix

                      Function renderNodeLabel has 42 lines of code (exceeds 25 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 1 hr to fix

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

                        function reducers(actions) {
                          const moveHighlightReducer$ = actions.moveHighlight$
                            .map(delta => function moveHighlightReducer(state) {
                              const suggestions = state.get('suggestions')
                              const wrapAround = x => (x + suggestions.length) % suggestions.length
                        Severity: Minor
                        Found in examples/advanced/autocomplete-search/src/app.js - About 1 hr to fix

                          Function makeThrottleAnimation has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function makeThrottleAnimation(
                            timeSource: any,
                            schedule: any,
                            currentTime: () => number
                          ) {
                          Severity: Minor
                          Found in time/src/throttle-animation.ts - About 1 hr to fix

                            Function makeDiagram has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function makeDiagram(
                              schedule: any,
                              currentTime: () => number,
                              interval: number,
                              setMaxTime: any
                            Severity: Minor
                            Found in time/src/diagram.ts - About 1 hr to fix

                              Function renderCommonNode has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function renderCommonNode(node: StreamGraphNode, zaps: Array<Zap>): VNode {
                                const index = zaps.map(zap => zap.id).indexOf(node.id);
                                const zap = index === -1 ? null : zaps[index];
                              
                                return svg.g([
                              Severity: Minor
                              Found in devtool/src/panel/graph/view.ts - About 1 hr to fix

                                Function setupNonBubblingListener has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  private setupNonBubblingListener(
                                    input: NonBubblingMeta
                                  ): void {
                                    const [_, eventType, elementFinder, destination] = input;
                                    if (!this.origin) {
                                Severity: Minor
                                Found in dom/src/EventDelegator.ts - About 1 hr to fix

                                  Function diagram has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    return function diagram(diagramString: string, values = {}): Stream<any> {
                                      const characters = diagramString.split('');
                                      const stream = xs.create();
                                      function valueFor(character: string) {
                                        if (character in values) {
                                  Severity: Minor
                                  Found in time/src/diagram.ts - About 1 hr to fix

                                    Function throttleAnimation has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      return function throttleAnimation<T>(inputStream: Stream<T>): Stream<T> {
                                        const source = timeSource();
                                        const stream = xs.fromObservable(inputStream);
                                        let animationListener: any = null;
                                    
                                    
                                    Severity: Minor
                                    Found in time/src/throttle-animation.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language