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

            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

      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

      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

      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

      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

                          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

          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

          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

          Expected newline after "}" (block-closing-brace-newline-after)
          Open

          function FormBasic(a){var b=StyleSheet.create({inputStyle:{border:'1px solid rgb(128, 128, 128)',borderRadius:'3.5px',background:'rgb(250, 250, 250)',height:'22.5px',paddingLeft:'4.5px',paddingRight:'3px'},buttonStyle:{background:'rgb(50, 120, 180)',color:'white',border:'1px solid rgb(30, 100, 160)',borderRadius:'3px',padding:'5px 10px',fontSize:'16px'},seperator1:{height:'5px'},seperator2:{height:'7.5px'}});return React__default.createElement('form',a,'Username:',React__default.createElement('input',{className:css(b.inputStyle),name:'user',type:'text',key:1}),React__default.createElement('div',{className:css(b.seperator1),key:2}),'Password:',React__default.createElement('input',{className:css(b.inputStyle),name:'password',type:'password',key:3}),React__default.createElement('div',{className:css(b.seperator2),key:4}),React__default.createElement('button',{className:css(b.buttonStyle),key:5,type:'submit'}))}
          Severity: Minor
          Found in example/imports/rsg-components.js by stylelint

          block-closing-brace-newline-after

          Require a newline or disallow whitespace after the closing brace of blocks.

          <!-- prettier-ignore -->
          a { color: pink; }
          a { color: red; }↑
          /**              ↑
           * The newline after this brace */

          This rule allows an end-of-line comment separated from the closing brace by spaces, as long as the comment contains no newlines. For example,

          <!-- prettier-ignore -->
          a {
            color: pink;
          } /* end-of-line comment */

          This rule allows a trailing semicolon after the closing brace of a block. For example,

          <!-- prettier-ignore -->
          :root {
            --toolbar-theme: {
              background-color: hsl(120, 70%, 95%);
            };
          /* ↑
           * This semicolon */
          }

          The [fix option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.

          Severity
          Category
          Status
          Source
          Language