ai-labs-team/casium-devtools

View on GitHub

Showing 16 of 16 total issues

Function render has 166 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const { messages, selected, active, replayedDeltas } = this.state;

    return (
      <div
Severity: Major
Found in src/App.tsx - About 6 hrs to fix

    Function dependencyTrace has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    export const dependencyTrace = (context: string, name: string, model: {}, message = {}, relay = {}) => {
    
      /**
       * Symbols cannot cross the `eval` boundary, so they need to be coerced to
       * their string equivalent.
    Severity: Minor
    Found in src/dependency-trace.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

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

      protected _renderPrevState() {
        if (!this.props.showPrevState) {
          return;
        }
    
    
    Severity: Major
    Found in src/MessageView.tsx and 1 other location - About 3 hrs to fix
    src/MessageView.tsx on lines 196..209

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

    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

      protected _renderNextState() {
        if (!this.props.showNextState) {
          return;
        }
    
    
    Severity: Major
    Found in src/MessageView.tsx and 1 other location - About 3 hrs to fix
    src/MessageView.tsx on lines 161..174

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

    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 dependencyTrace has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const dependencyTrace = (context: string, name: string, model: {}, message = {}, relay = {}) => {
    
      /**
       * Symbols cannot cross the `eval` boundary, so they need to be coerced to
       * their string equivalent.
    Severity: Major
    Found in src/dependency-trace.ts - About 3 hrs to fix

      File App.tsx has 301 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as React from 'react';
      
      import { GenericObject } from 'casium/core';
      import * as FontAwesome from 'react-fontawesome';
      import { concat, contains, equals, head, last, isNil, merge, omit, pipe, prop, slice, takeWhile, where, nth } from 'ramda';
      Severity: Minor
      Found in src/App.tsx - About 3 hrs to fix

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

          render() {
            const { messages, selected, active, replayedDeltas } = this.state;
        
            return (
              <div
        Severity: Minor
        Found in src/App.tsx - 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 _renderMessages has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected _renderMessages() {
            const { selected, useDependencyTrace } = this.props;
            const { relativeTime, dependencyTraces } = this.state;
        
            const items = selected.map((msg, index) => {
        Severity: Minor
        Found in src/MessageView.tsx - About 1 hr to fix

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

          export const generateUnitTest = (messages: SerializedMessage[], initialState: GenericObject, finalState: GenericObject, traces: DependencyTrace[]) => {
            const aggregateTrace = traces.length ? traces.reduce(mergeUniquePaths, {
              model: [],
              relay: [],
              message: []
          Severity: Minor
          Found in src/test-generator.ts - About 1 hr to fix

            Function _renderMessages has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              protected _renderMessages() {
                const { selected, useDependencyTrace } = this.props;
                const { relativeTime, dependencyTraces } = this.state;
            
                const items = selected.map((msg, index) => {
            Severity: Minor
            Found in src/MessageView.tsx - 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

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

              const relayProxy = deepGetProxy(relay, path => {
                if (!relayPaths.find(existingPath => arrayEq(existingPath, path))) {
                  relayPaths.push(path);
                }
              });
            Severity: Major
            Found in src/dependency-trace.ts and 1 other location - About 1 hr to fix
            src/dependency-trace.ts on lines 110..114

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

            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 messageProxy = deepGetProxy(message, path => {
                if (!messagePaths.find(existingPath => arrayEq(existingPath, path))) {
                  messagePaths.push(path);
                }
              });
            Severity: Major
            Found in src/dependency-trace.ts and 1 other location - About 1 hr to fix
            src/dependency-trace.ts on lines 116..120

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

            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 generateUnitTest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export const generateUnitTest = (messages: SerializedMessage[], initialState: GenericObject, finalState: GenericObject, traces: DependencyTrace[]) => {
              const aggregateTrace = traces.length ? traces.reduce(mergeUniquePaths, {
                model: [],
                relay: [],
                message: []
            Severity: Minor
            Found in src/test-generator.ts - About 35 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 messageNames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            const messageNames = (pairs: MessageTracePair[]) =>
              countConsecutive(pairs.map(([msg]) => msg.message))
                .reduce((result, [message, count], index, list) => {
                  const append = count > 1 ? `${message} (x${count})` : message;
            
            
            Severity: Minor
            Found in src/test-generator.ts - About 25 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 timeSince has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const timeSince = (ts: number) => {
              const now = new Date(),
                timeStamp = new Date(ts),
                secondsPast = (now.getTime() - timeStamp.getTime()) / 1000;
            
            
            Severity: Minor
            Found in src/MessageHeading.tsx - About 25 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 componentWillReceiveProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              componentWillReceiveProps(nextProps: Props) {
                const shouldUpdateNext = nextProps.selected !== this.props.selected;
                if (shouldUpdateNext) {
                  this._updateNext(nextProps.initialState, nextProps.selected);
                }
            Severity: Minor
            Found in src/MessageView.tsx - About 25 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

            Severity
            Category
            Status
            Source
            Language