cyclejs/cycle-core

View on GitHub

Showing 188 of 188 total issues

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

  sourceOrSinkNodeStyle: styleSheet.registerStyle({
    'fill': GRAY_LIGHTER,
    'stroke': GRAY_DARK,
    'stroke-width': NODE_STROKE_WIDTH,
    'transition': `fill ${ZCOD}, stroke ${ZCOD}, stroke-width ${ZCOD}`,
Severity: Minor
Found in devtool/src/panel/graph/styles.ts and 1 other location - About 50 mins to fix
devtool/src/panel/graph/styles.ts on lines 48..53

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 51.

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

Function bubble has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  private bubble(
    eventType: string,
    elm: Element,
    rootElement: Element | undefined,
    event: CycleDOMEvent,
Severity: Minor
Found in dom/src/EventDelegator.ts - About 45 mins 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 getVirtualListeners has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  private getVirtualListeners(
    eventType: string,
    namespace: Array<Scope>,
    exact = false,
    max?: number
Severity: Minor
Found in dom/src/EventDelegator.ts - About 45 mins 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 showReport has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function showReport(status) {
  var headerShown = false;
  for (var package in status) {
    if (status.hasOwnProperty(package) && status[package].increment > 0) {
      if (!headerShown) {
Severity: Minor
Found in .scripts/check-release.js - About 45 mins 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 makeSetter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function makeSetter<T, R>(scope: Scope<T, R>): Setter<T, R> {
  if (typeof scope === 'string' || typeof scope === 'number') {
    return function lensSet(
      state: T | undefined,
      childState: R | undefined
Severity: Minor
Found in state/src/StateSource.ts - About 45 mins 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 processEvent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function processEvent(args: any) {
  const {scheduler, done, currentTime, setTime, timeToRunTo} = args;
  const nextEvent = scheduler.peek();
  const outOfTime = nextEvent && timeToRunTo && nextEvent.time >= timeToRunTo;

Severity: Minor
Found in time/src/run-virtually.ts - About 45 mins 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 call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public call(vnode: VNode | null): VNode {
    if (isDocFrag(this.rootElement)) {
      return this.wrapDocFrag(vnode === null ? [] : [vnode]);
    }
    if (vnode === null) {
Severity: Minor
Found in dom/src/VNodeWrapper.ts - About 45 mins 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

Consider simplifying this complex logical expression.
Open

        if (
          !event.propagationHasBeenStopped &&
          dest.scopeChecker.isDirectlyInScope(elm) &&
          ((sel !== '' && elm.matches(sel)) ||
            (sel === '' && elm === rootElement))
Severity: Major
Found in dom/src/EventDelegator.ts - About 40 mins to fix

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

           div([
             'Weight ' + weight + 'kg',
             input('#weight', {
               attrs: {type: 'range', min: 40, max: 140, value: weight}
             })
    Severity: Minor
    Found in examples/basic/bmi-naive/src/main.js and 1 other location - About 40 mins to fix
    examples/basic/bmi-naive/src/main.js on lines 29..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 48.

    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

           div([
             'Height ' + height + 'cm',
             input('#height', {
               attrs: {type: 'range', min: 140, max: 210, value: height}
             })
    Severity: Minor
    Found in examples/basic/bmi-naive/src/main.js and 1 other location - About 40 mins to fix
    examples/basic/bmi-naive/src/main.js on lines 23..28

    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 48.

    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

      const heightProps$ = xs.of({
        label: 'Height', unit: 'cm', min: 140, initial: 170, max: 210,
      }).remember();
    Severity: Minor
    Found in examples/intermediate/bmi-typescript/src/BmiCalculator.ts and 1 other location - About 40 mins to fix
    examples/intermediate/bmi-typescript/src/BmiCalculator.ts on lines 17..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 48.

    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

      private clearInterval() {
        const id = this.intervalId;
        if (id !== null) {
          clearInterval(id);
          this.intervalId = null;
    Severity: Minor
    Found in devtool/src/utils/timeSpread.ts and 1 other location - About 40 mins to fix
    devtool/src/utils/timeSpread.ts on lines 46..52

    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 48.

    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

          tspanElem.setAttribute('y',
            String(DIAGRAM_PADDING_V + (node.y || 0) + textElem.clientHeight * 0.5 - P * 0.5),
          );
    Severity: Minor
    Found in devtool/src/panel/graph/view.ts and 1 other location - About 40 mins to fix
    devtool/src/panel/graph/view.ts on lines 65..67

    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 48.

    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

          tspanElem.setAttribute('x',
            String(DIAGRAM_PADDING_H + (node.x || 0) - textElem.clientWidth * 0.5 - P * 0.4),
          );
    Severity: Minor
    Found in devtool/src/panel/graph/view.ts and 1 other location - About 40 mins to fix
    devtool/src/panel/graph/view.ts on lines 68..70

    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 48.

    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

      private clearTimeout() {
        const id = this.timeoutId;
        if (id !== null) {
          clearTimeout(id);
          this.timeoutId = null;
    Severity: Minor
    Found in devtool/src/utils/timeSpread.ts and 1 other location - About 40 mins to fix
    devtool/src/utils/timeSpread.ts on lines 38..44

    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 48.

    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

      const weightProps$ = xs.of({
        label: 'Weight', unit: 'kg', min: 40, initial: 70, max: 140,
      }).remember();
    Severity: Minor
    Found in examples/intermediate/bmi-typescript/src/BmiCalculator.ts and 1 other location - About 40 mins to fix
    examples/intermediate/bmi-typescript/src/BmiCalculator.ts on lines 20..22

    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 48.

    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

    Function makeThrottleListener has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      schedule: any,
      currentTime: () => number,
      period: number,
      listener: Listener<any>,
      state: any
    Severity: Minor
    Found in time/src/throttle.ts - About 35 mins to fix

      Function runVirtually has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        scheduler: any,
        done: any,
        currentTime: () => number,
        setTime: any,
        timeToRunTo = 0
      Severity: Minor
      Found in time/src/run-virtually.ts - About 35 mins to fix

        Function visitEdge has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          graph: dagre.graphlib.Graph,
          idTable: IdTable,
          inStream: Stream<any>,
          operator: InternalProducer,
          outStream: Stream<any>,
        Severity: Minor
        Found in devtool/src/graphSerializer.ts - About 35 mins to fix

          Function makeAssertEqual has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            timeSource: any,
            schedule: any,
            currentTime: () => number,
            interval: number,
            addAssert: any
          Severity: Minor
          Found in time/src/assert-equal.ts - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language