cyclejs/cycle-core

View on GitHub

Showing 112 of 188 total issues

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

export function replicateMany<Si extends any>(
  sinks: Si,
  sinkProxies: SinkProxies<Si>
): DisposeFunction {
  const scheduleMicrotask = quicktask();
Severity: Minor
Found in run/src/internals.ts - About 1 hr to fix

    Function _n has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public _n(inst: InternalInstances<Si>): void {
        this.inst = inst;
        const arrSinks = inst.arr;
        const ils = this.ils;
        const out = this.out;
    Severity: Minor
    Found in state/src/pickCombine.ts - About 1 hr to fix

      Function makePeriodic has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function makePeriodic(createOperator: () => OperatorArgs<any>) {
        const {schedule, currentTime} = createOperator();
      
        return function periodic(period: number): Stream<number> {
          let stopped = false;
      Severity: Minor
      Found in time/src/periodic.ts - About 1 hr to fix

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

          Function runUpdateChangelogs has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function runUpdateChangelogs() {
            packagesWithChangelog
              .filter(function (package) {
                if (typeof argPackage === 'string' && argPackage.length > 0) {
                  return argPackage === package;
          Severity: Minor
          Found in .scripts/update-changelogs.js - About 1 hr to fix

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

            function main(sources: Sources): Sinks {
              const firstName$ = sources.DOM
                .select('.first')
                .events('input')
                .map(ev => (ev.target as HTMLInputElement).value)
            Severity: Minor
            Found in examples/intermediate/hello-lastname/src/index.ts - About 1 hr to fix

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

              export function preventDefaultConditional(
                event: any,
                preventDefault: PreventDefaultOpt
              ): void {
                if (preventDefault) {
              Severity: Minor
              Found in dom/src/fromEvent.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 createTagFunction has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              function createTagFunction(tagName: string): Function {
                return function hyperscript(a: any, b?: any, c?: any): VNode {
                  const hasA = typeof a !== 'undefined';
                  const hasB = typeof b !== 'undefined';
                  const hasC = typeof c !== 'undefined';
              Severity: Minor
              Found in dom/src/hyperscript-helpers.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 createResponse$ has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function createResponse$(reqInput: RequestInput): Stream<Response> {
                let request: any;
                return xs.create<Response>({
                  start: function startResponseStream(listener) {
                    try {
              Severity: Minor
              Found in http/src/http-driver.ts - About 1 hr to fix

                Function clickListener has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  return function clickListener(event: MouseEvent) {
                    if (which(event) !== 1) {
                      return;
                    }
                
                
                Severity: Minor
                Found in history/src/captureClicks.ts - About 1 hr to fix

                  Function model has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function model(action$, itemFn) {
                    function createRandomItemProps() {
                      let hexColor = Math.floor(Math.random() * 16777215).toString(16);
                      while (hexColor.length < 6) {
                        hexColor = '0' + hexColor;
                  Severity: Minor
                  Found in examples/advanced/many/src/List.js - About 1 hr to fix

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

                      return function periodic(period: number): Stream<number> {
                        let stopped = false;
                        let lastEmitTime = 0;
                    
                        function scheduleNextEvent(
                    Severity: Minor
                    Found in time/src/periodic.ts - About 1 hr to fix

                      Function makeChartDriver has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function makeChartDriver(selector, settings) {
                        let instance = null // lazy initialize chart on first stream event
                        const el = document.querySelector(selector)
                        if (!el) {
                          throw new Error(`No element '${selector}' found`)
                      Severity: Minor
                      Found in examples/advanced/custom-driver/src/chart-driver.js - About 1 hr to fix

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

                        function main(sources) {
                          const changeWeight$ = sources.DOM.select('#weight').events('input')
                            .map(ev => ev.target.value);
                          const changeHeight$ = sources.DOM.select('#height').events('input')
                            .map(ev => ev.target.value);
                        Severity: Minor
                        Found in examples/basic/bmi-naive/src/main.js - About 1 hr to fix

                          Function calculateAnimationSteps has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function calculateAnimationSteps(point$) {
                            function incorporateNewPoint(oldPoints, newPoint) {
                              const index = oldPoints.findIndex(point => point.key === newPoint.key)
                              let points
                              if (index === -1 && newPoint.target === 1) {
                          Severity: Minor
                          Found in examples/advanced/animated-letters/src/main.js - About 1 hr to fix

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

                            export function setup<
                              D extends MatchingDrivers<D, M>,
                              M extends MatchingMain<D, M>
                            >(main: M, drivers: D): CycleProgram<D, M> {
                              if (typeof main !== `function`) {
                            Severity: Minor
                            Found in run/src/index.ts - About 1 hr to fix

                              Function makeAssertEqual has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function makeAssertEqual(
                                timeSource: any,
                                schedule: any,
                                currentTime: () => number,
                                interval: number,
                              Severity: Minor
                              Found in time/src/assert-equal.ts - About 1 hr to fix

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

                                function main(sources) {
                                  // Requests for Github repositories happen when the input field changes,
                                  // debounced by 500ms, ignoring empty input field.
                                  const searchRequest$ = sources.DOM.select('.field').events('input')
                                    .compose(sources.Time.debounce(500))
                                Severity: Minor
                                Found in examples/intermediate/http-search-github/src/main.js - About 1 hr to fix

                                  Function makeAnimationFrames has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function makeAnimationFrames(addFrameCallback: any, currentTime: () => number) {
                                    return function animationFrames(): Stream<Frame> {
                                      const frame = {
                                        time: 0,
                                        delta: 16,
                                  Severity: Minor
                                  Found in time/src/animation-frames.ts - About 1 hr to fix

                                    Function instanceLens has 29 lines of code (exceeds 25 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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language