RSG-Group/rsg-components

View on GitHub

Showing 167 of 167 total issues

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

  render () {
    const props: Object = this.props
    const size: number = props.size
    const state = this.state

Severity: Major
Found in src/Clock.js - About 4 hrs to fix

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

              <line
                x1={angleM.x2}
                y1={angleM.y2}
                x2={sine(cx, size * 0.25, 180 - (state.min + 4))}
                y2={cosine(cy, size * 0.25, 180 - (state.min + 4))}
    Severity: Major
    Found in src/Clock.js and 1 other location - About 3 hrs to fix
    src/Clock.js on lines 139..145

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

    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

              <line
                x1={angleM.x2}
                y1={angleM.y2}
                x2={sine(cx, size * 0.25, 180 - (state.min - 4))}
                y2={cosine(cy, size * 0.25, 180 - (state.min - 4))}
    Severity: Major
    Found in src/Clock.js and 1 other location - About 3 hrs to fix
    src/Clock.js on lines 146..152

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

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

    export default function Button (props: Props): React.createElement {
      let sizeId: string
      if (props.sizes) sizeId = props.sizes
      else { sizeId = 'default' }
      let padding = '5px 4px'
    Severity: Major
    Found in src/Button.js - About 2 hrs to fix

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

        state = {
          sec: new Date().getSeconds() * 6,
          min: new Date().getMinutes() * 6,
          hour: new Date().getHours() * 30 + new Date().getMinutes() * 0.5
        }
      Severity: Major
      Found in src/Clock.js and 1 other location - About 2 hrs to fix
      src/Clock.js on lines 39..43

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

      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 2 locations. Consider refactoring.
      Open

            this.setState({
              sec: new Date().getSeconds() * 6,
              min: new Date().getMinutes() * 6,
              hour: new Date().getHours() * 30 + new Date().getMinutes() * 0.5
            })
      Severity: Major
      Found in src/Clock.js and 1 other location - About 2 hrs to fix
      src/Clock.js on lines 21..25

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

      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 angleM: Object = {
            x1: cx,
            y1: cy,
            x2: sine(cx, size * 0.35, 180 - state.min),
            y2: cosine(cy, size * 0.35, 180 - state.min)
      Severity: Major
      Found in src/Clock.js and 1 other location - About 1 hr to fix
      src/Clock.js on lines 94..99

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

      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 angleS: Object = {
            x1: cx,
            y1: cy,
            x2: sine(cx, size * 0.375, 180 - state.sec),
            y2: cosine(cy, size * 0.375, 180 - state.sec)
      Severity: Major
      Found in src/Clock.js and 1 other location - About 1 hr to fix
      src/Clock.js on lines 101..106

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

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

      export default function ProgressBar (props: Props) {
        // If progressCount is not a number then..
        if (!props.progressCount || typeof props.progressCount !== 'number') {
          throw new ReactInvalidPropException({
            prop: 'progressCount',
      Severity: Minor
      Found in src/ProgressBar.js - About 1 hr to fix

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

              <input className={css(styles.inputStyle)} name='password' type='password' key={3} onChange={e => props.onField2Change(e.target.value)} />
        Severity: Major
        Found in example/pages/index.js and 1 other location - About 1 hr to fix
        example/pages/index.js on lines 25..25

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

        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

              <input className={css(styles.inputStyle)} name='user' type='text' key={1} onChange={e => props.onField1Change(e.target.value)} />
        Severity: Major
        Found in example/pages/index.js and 1 other location - About 1 hr to fix
        example/pages/index.js on lines 28..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 66.

        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

          sine (p: number, r: number, deg: number) {
            const theta: number = Math.PI / 180 * deg
            return p + r * Math.sin(theta)
          }
        Severity: Major
        Found in src/Clock.js and 1 other location - About 1 hr to fix
        src/Clock.js on lines 32..35

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

        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

          cosine (p: number, r: number, deg: number) {
            const theta: number = Math.PI / 180 * deg
            return p + r * Math.cos(theta)
          }
        Severity: Major
        Found in src/Clock.js and 1 other location - About 1 hr to fix
        src/Clock.js on lines 27..30

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

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

        export default function FormBasic (props: {}): React.createElement {
          const styles: Object = StyleSheet.create({
            inputStyle: {
              border: '1px solid rgb(128, 128, 128)',
              borderRadius: '3.5px',
        Severity: Minor
        Found in src/FormBasic.js - About 1 hr to fix

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

            render () {
              const props: Object = this.props
              const size: number = props.size
              const state = this.state
          
          
          Severity: Minor
          Found in src/Clock.js - 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 ProgressBar has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function ProgressBar (props: Props) {
            // If progressCount is not a number then..
            if (!props.progressCount || typeof props.progressCount !== 'number') {
              throw new ReactInvalidPropException({
                prop: 'progressCount',
          Severity: Minor
          Found in src/ProgressBar.js - About 55 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

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

                          y2={cosine(cy, i % 3 === 0 ? r - size * 0.085 : r - size * 0.065, 180 + i * 30)}
          Severity: Minor
          Found in src/Clock.js and 1 other location - About 50 mins to fix
          src/Clock.js on lines 169..169

          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

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

                          x2={sine(cx, i % 3 === 0 ? r - size * 0.085 : r - size * 0.065, 180 + i * 30)}
          Severity: Minor
          Found in src/Clock.js and 1 other location - About 50 mins to fix
          src/Clock.js on lines 170..170

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

          export default function Button (props: Props): React.createElement {
            let sizeId: string
            if (props.sizes) sizeId = props.sizes
            else { sizeId = 'default' }
            let padding = '5px 4px'
          Severity: Minor
          Found in src/Button.js - 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

          Headers should be surrounded by blank lines
          Open

          ## Notes:
          Severity: Info
          Found in example/README.md by markdownlint

          MD022 - Headers should be surrounded by blank lines

          Tags: headers, blank_lines

          Aliases: blanks-around-headers

          This rule is triggered when headers (any style) are either not preceded or not followed by a blank line:

          # Header 1
          Some text
          
          Some more text
          ## Header 2

          To fix this, ensure that all headers have a blank line both before and after (except where the header is at the beginning or end of the document):

          # Header 1
          
          Some text
          
          Some more text
          
          ## Header 2

          Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse headers that don't have a blank line before, and will parse them as regular text.

          Severity
          Category
          Status
          Source
          Language