staltz/cycle

View on GitHub

Showing 188 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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export type MatchingDrivers<D extends Drivers, M extends Main> = Drivers &
        {
          [k in string & keyof Sinks<M>]:
            | (() => Sources<D>[k])
            | ((
      Severity: Major
      Found in rxjs-run/src/index.ts and 2 other locations - About 5 hrs to fix
      most-run/src/index.ts on lines 31..38
      run/src/types.ts on lines 65..72

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 142.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export type MatchingDrivers<D extends Drivers, M extends Main> = Drivers &
        {
          [k in string & keyof Sinks<M>]:
            | (() => Sources<D>[k])
            | ((
      Severity: Major
      Found in most-run/src/index.ts and 2 other locations - About 5 hrs to fix
      run/src/types.ts on lines 65..72
      rxjs-run/src/index.ts on lines 32..39

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 142.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export type MatchingDrivers<D extends Drivers, M extends Main> = Drivers &
        {
          [k in string & keyof Sinks<M>]:
            | (() => Sources<D>[k])
            | ((
      Severity: Major
      Found in run/src/types.ts and 2 other locations - About 5 hrs to fix
      most-run/src/index.ts on lines 31..38
      rxjs-run/src/index.ts on lines 32..39

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 142.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export interface DOMSource {
        select(selector: string): DOMSource;
        elements(): Stream<Array<Element>>;
        element(): Stream<Element>;
        events<K extends keyof HTMLElementEventMap>(
      Severity: Major
      Found in dom/src/most.ts and 1 other location - About 5 hrs to fix
      dom/src/rxjs.ts on lines 7..17

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 141.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export interface DOMSource {
        select(selector: string): DOMSource;
        elements(): Observable<Array<Element>>;
        element(): Observable<Element>;
        events<K extends keyof HTMLElementEventMap>(
      Severity: Major
      Found in dom/src/rxjs.ts and 1 other location - About 5 hrs to fix
      dom/src/most.ts on lines 7..17

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 141.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export interface HTTPSource {
        filter(predicate: (request: RequestOptions) => boolean): HTTPSource;
        select(category?: string): Stream<Stream<Response> & ResponseStream>;
        isolateSource(source: HTTPSource, scope: string | null): HTTPSource;
        isolateSink(
      Severity: Major
      Found in http/src/most.ts and 1 other location - About 4 hrs to fix
      http/src/rxjs.ts on lines 12..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 133.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export interface HTTPSource {
        filter(predicate: (request: RequestOptions) => boolean): HTTPSource;
        select(category?: string): Observable<Observable<Response> & ResponseStream>;
        isolateSource(source: HTTPSource, scope: string | null): HTTPSource;
        isolateSink(
      Severity: Major
      Found in http/src/rxjs.ts and 1 other location - About 4 hrs to fix
      http/src/most.ts on lines 11..19

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 133.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export interface MockTimeSource extends TimeSource {
        diagram(str: string, values?: Object): Stream<any>;
        record(stream: Stream<any>): Stream<Array<any>>;
        assertEqual(
          actual: Stream<any>,
      Severity: Major
      Found in time/src/time-source.ts and 1 other location - About 4 hrs to fix
      time/src/rxjs.ts on lines 25..34

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 129.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      interface MockTimeSource extends TimeSource {
        diagram(str: string, values?: Object): Observable<any>;
        record(observable: Observable<any>): Observable<Array<any>>;
        assertEqual(
          actual: Observable<any>,
      Severity: Major
      Found in time/src/rxjs.ts and 1 other location - About 4 hrs to fix
      time/src/time-source.ts on lines 18..27

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 129.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      interface TimeSource {
        createOperator<T>(): OperatorArgs<T>;
        animationFrames(): Observable<Frame>;
        delay(delayTime: number): Operator;
        debounce(period: number): Operator;
      Severity: Major
      Found in time/src/rxjs.ts and 1 other location - About 4 hrs to fix
      time/src/time-source.ts on lines 7..16

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 123.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export interface TimeSource {
        createOperator<T>(): OperatorArgs<T>;
        animationFrames(): Stream<Frame>;
        delay(delayTime: number): Operator;
        debounce(period: number): Operator;
      Severity: Major
      Found in time/src/time-source.ts and 1 other location - About 4 hrs to fix
      time/src/rxjs.ts on lines 14..23

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 123.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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
            Severity
            Category
            Status
            Source
            Language