gabrielbull/react-desktop

View on GitHub

Showing 257 of 257 total issues

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

function applyChildenClasses() {
  return function(ComposedComponent) {
    const nextItem = Item;
    ComposedComponent.prototype.Item = ComposedComponent.Item = function(
      ...args
Severity: Major
Found in src/NavPane/windows/index.js and 1 other location - About 2 hrs to fix
src/SegmentedControl/macOs/index.js on lines 12..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 94.

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

function applyItem() {
  return function(ComposedComponent) {
    const nextItem = Item;
    ComposedComponent.prototype.Item = ComposedComponent.Item = function(
      ...args
Severity: Major
Found in src/SegmentedControl/macOs/index.js and 1 other location - About 2 hrs to fix
src/NavPane/windows/index.js on lines 14..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 94.

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

  render() {
    let {
      style,
      label,
      size,
Severity: Minor
Found in src/TextArea/macOs/index.js - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  render() {
    const { style } = this.props;

    let children;
    // todo: use Children.map
Severity: Minor
Found in src/SegmentedControl/macOs/Tabs/index.js - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  render() {
    let {
      style,
      onClick,
      onMaximizeClick,
Severity: Major
Found in src/TitleBar/macOs/Controls/Resize.js - About 2 hrs to fix

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

      button: {
        WebkitUserSelect: 'none',
        userSelect: 'none',
        WebkitAppRegion: 'no-drag',
        cursor: 'default',
    Severity: Major
    Found in src/TitleBar/windows/Controls/Maximize.js and 1 other location - About 2 hrs to fix
    src/TitleBar/windows/Controls/Close.js on lines 9..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 88.

    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

      handleBlur = e => {
        if (this.props.centerPlaceholder) {
          if (!e.target.value) {
            pushCenter(e.target, ReactDOM.findDOMNode(this.refs.label));
          }
    Severity: Major
    Found in src/TextArea/macOs/index.js and 1 other location - About 2 hrs to fix
    src/TextInput/macOs/index.js on lines 128..136

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

    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

      handleBlur = e => {
        if (this.props.centerPlaceholder) {
          if (!e.target.value) {
            pushCenter(e.target, ReactDOM.findDOMNode(this.refs.label));
          }
    Severity: Major
    Found in src/TextInput/macOs/index.js and 1 other location - About 2 hrs to fix
    src/TextArea/macOs/index.js on lines 129..137

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

    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

      button: {
        WebkitUserSelect: 'none',
        userSelect: 'none',
        WebkitAppRegion: 'no-drag',
        cursor: 'default',
    Severity: Major
    Found in src/TitleBar/windows/Controls/Close.js and 1 other location - About 2 hrs to fix
    src/TitleBar/windows/Controls/Maximize.js on lines 10..31

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

    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

        if (size && parseInt(size) !== 13) {
          const ratio = size / 13;
          componentStyle.lineHeight = parseDimension(size * 1.4);
          componentStyle.paddingLeft = parseDimension(3.5 * ratio);
          componentStyle.paddingRight = parseDimension(3.5 * ratio);
    Severity: Major
    Found in src/TextArea/macOs/index.js and 1 other location - About 2 hrs to fix
    src/TextInput/macOs/index.js on lines 213..218

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

    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

        if (size && parseInt(size) !== 13) {
          const ratio = size / 13;
          componentStyle.lineHeight = parseDimension(size * 1.4);
          componentStyle.paddingLeft = parseDimension(3.5 * ratio);
          componentStyle.paddingRight = parseDimension(3.5 * ratio);
    Severity: Major
    Found in src/TextInput/macOs/index.js and 1 other location - About 2 hrs to fix
    src/TextArea/macOs/index.js on lines 213..218

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

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

    function mapAlignmentStyle(key, value, props) {
      let finalKey, finalValue;
      if (allowedValues.indexOf(value) === -1) {
        console.error('Unknown value for ' + key + ': ' + value);
      } else {
    Severity: Minor
    Found in src/style/alignment.js - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function mapRules has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    function mapRules(selector, style) {
      let styles = { 0: style };
      if (style[':hover']) {
        styles = { ...styles, ':hover': style[':hover'] };
        delete styles[0][':hover'];
    Severity: Minor
    Found in src/placeholderStyle.js - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function applyDefaultProps has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    export function applyDefaultProps(props, context, defaultProps) {
      let finalProps = { ...props };
    
      for (let prop in defaultProps) {
        if (defaultProps.hasOwnProperty(prop)) {
    Severity: Minor
    Found in src/styleHelper.js - About 2 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

        if (label) {
          return (
            <div>
              <Text
                style={{ marginBottom: '5px', ...labelStyle }}
    Severity: Major
    Found in src/TextArea/windows/index.js and 1 other location - About 2 hrs to fix
    src/TextInput/windows/index.js on lines 117..129

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

    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

        if (label) {
          return (
            <div>
              <Text
                style={{ marginBottom: '5px', ...labelStyle }}
    Severity: Major
    Found in src/TextInput/windows/index.js and 1 other location - About 2 hrs to fix
    src/TextArea/windows/index.js on lines 114..126

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

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

      render() {
        let { style, label, isWindowFocused, ...props } = this.props;
        const { transition } = this.state;
        let componentStyle = { ...styles.radio, ...style };
        let labelStyle = styles.label;
    Severity: Major
    Found in src/Radio/macOs/index.js - About 2 hrs to fix

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

        render() {
          let { style, label, isWindowFocused, ...props } = this.props;
          const { transition } = this.state;
          let componentStyle = { ...styles.checkbox, ...style };
          let labelStyle = styles.label;
      Severity: Major
      Found in src/Checkbox/macOs/index.js - About 2 hrs to fix

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

          render() {
            const isChecked = this.state.theme === 'dark';
        
            let colorPicker;
            if (this.state.displayColorPicker) {
        Severity: Major
        Found in playground/ui/sidebar/sidebar.js - About 2 hrs to fix

          Function rotateCircle has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function rotateCircle(circles) {
            let lastFrame = false;
            for (var i = 0, len = circles.length; i < len; ++i) {
              if (this.iteration >= circlesInterval * i) {
                let iteration = this.iteration - circlesInterval * i;
          Severity: Minor
          Found in src/ProgressCircle/windows/progressCircleAnimation.js - About 2 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

          Severity
          Category
          Status
          Source
          Language