smashingboxes/cardboard

View on GitHub

Showing 29 of 29 total issues

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

const propTypes = {
  actions: PropTypes.shape({
    stories: PropTypes.shape({
      show: PropTypes.func.isRequired
    }).isRequired
Severity: Major
Found in app/javascript/main/containers/Stories/Show.jsx and 1 other location - About 4 hrs to fix
app/javascript/main/containers/Projects/Show.jsx on lines 12..24

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

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 propTypes = {
  actions: PropTypes.shape({
    projects: PropTypes.shape({
      show: PropTypes.func.isRequired
    }).isRequired
Severity: Major
Found in app/javascript/main/containers/Projects/Show.jsx and 1 other location - About 4 hrs to fix
app/javascript/main/containers/Stories/Show.jsx on lines 12..24

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

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

function TextArea({ className, input, label }) {
  return (
    <div className={`c-formfield ${className}`}>
      <label htmlFor={input.name}>{label}</label>
      <input type="radio" id={input.name} {...input} />
Severity: Major
Found in app/javascript/main/components/FormFields/Radio.jsx and 2 other locations - About 3 hrs to fix
app/javascript/main/components/FormFields/Checkbox.jsx on lines 10..17
app/javascript/main/components/FormFields/Text.jsx on lines 10..17

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

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

class ConnectedStoryNew extends Component {
  componentDidMount() {
    this.props.actions.projects.show(this.props.match.params.projectId);
  }

Severity: Major
Found in app/javascript/main/containers/Stories/New.jsx and 2 other locations - About 3 hrs to fix
app/javascript/main/containers/Projects/Show.jsx on lines 26..37
app/javascript/main/containers/Stories/Show.jsx on lines 26..37

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

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

class ConnectedStoryShow extends Component {
  componentDidMount() {
    this.props.actions.stories.show(this.props.match.params.storyId);
  }

Severity: Major
Found in app/javascript/main/containers/Stories/Show.jsx and 2 other locations - About 3 hrs to fix
app/javascript/main/containers/Projects/Show.jsx on lines 26..37
app/javascript/main/containers/Stories/New.jsx on lines 34..45

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

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

class ConnectedProjectShow extends Component {
  componentDidMount() {
    this.props.actions.projects.show(this.props.match.params.projectId);
  }

Severity: Major
Found in app/javascript/main/containers/Projects/Show.jsx and 2 other locations - About 3 hrs to fix
app/javascript/main/containers/Stories/New.jsx on lines 34..45
app/javascript/main/containers/Stories/Show.jsx on lines 26..37

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

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

function Text({ className, input, label }) {
  return (
    <div className={`c-formfield ${className}`}>
      <label htmlFor={input.name}>{label}</label>
      <input type="text" id={input.name} {...input} />
Severity: Major
Found in app/javascript/main/components/FormFields/Text.jsx and 2 other locations - About 3 hrs to fix
app/javascript/main/components/FormFields/Checkbox.jsx on lines 10..17
app/javascript/main/components/FormFields/Radio.jsx on lines 10..17

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

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

function Checkbox({ className, input, label }) {
  return (
    <div className={`c-formfield ${className}`}>
      <label htmlFor={input.name}>{label}</label>
      <input type="checkbox" id={input.name} {...input} />
Severity: Major
Found in app/javascript/main/components/FormFields/Checkbox.jsx and 2 other locations - About 3 hrs to fix
app/javascript/main/components/FormFields/Radio.jsx on lines 10..17
app/javascript/main/components/FormFields/Text.jsx on lines 10..17

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

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

  case 'show':
    return (id) => {
      return (dispatch) => {
        dispatch({ type: `${actionPrefix}_START` });

Severity: Major
Found in app/javascript/main/restfulApi/createAction.js and 2 other locations - About 3 hrs to fix
app/javascript/main/restfulApi/createAction.js on lines 38..52
app/javascript/main/restfulApi/createAction.js on lines 68..82

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

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

  case 'create':
    return (body) => {
      return (dispatch) => {
        dispatch({ type: `${actionPrefix}_START` });

Severity: Major
Found in app/javascript/main/restfulApi/createAction.js and 2 other locations - About 3 hrs to fix
app/javascript/main/restfulApi/createAction.js on lines 23..37
app/javascript/main/restfulApi/createAction.js on lines 68..82

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

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

  case 'delete':
    return (id) => {
      return (dispatch) => {
        dispatch({ type: `${actionPrefix}_START` });

Severity: Major
Found in app/javascript/main/restfulApi/createAction.js and 2 other locations - About 3 hrs to fix
app/javascript/main/restfulApi/createAction.js on lines 23..37
app/javascript/main/restfulApi/createAction.js on lines 38..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 100.

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

function createAction(resource, operation, services) {
  // eg PROJECTS_LIST
  const actionPrefix = `${resource.toUpperCase()}_${operation.toUpperCase()}`;
  // eg services.projects.list
  const service = services[resource][operation];
Severity: Major
Found in app/javascript/main/restfulApi/createAction.js - About 2 hrs to fix

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

        case `${actionPrefix}_DELETE_SUCCESS`:
          return state.withMutations((map) => {
            map.set('isActive', false);
            map.set('isFetched', true);
            map.set('data', Immutable.fromJS(action.payload.response));
    app/javascript/main/restfulApi/reducerCreators/Immutable/createListReducer.js on lines 21..26

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

    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

        case `${actionPrefix}_LIST_SUCCESS`:
          return state.withMutations((map) => {
            map.set('isActive', false);
            map.set('isFetched', true);
            map.set('data', Immutable.fromJS(action.payload.response));
    app/javascript/main/restfulApi/reducerCreators/Immutable/createItemReducer.js on lines 28..33

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

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

    function createItemReducer(resource, resourceConfig) {
      const customReducer = resourceConfig.itemReducer;
      // eg PROJECTS
      const actionPrefix = resource.toUpperCase();
    
    

      Function createItemReducer has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function createItemReducer(resource) {
        // eg PROJECTS
        const actionPrefix = resource.toUpperCase();
      
        const INITIAL_STATE = new Immutable.Map({

        Function createService has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createService(resource, operation) {
          switch (operation) {
          case 'list':
            return () => {
              return apiService
        Severity: Minor
        Found in app/javascript/main/restfulApi/createService.js - About 1 hr to fix

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

              case `${actionPrefix}_DELETE_FAILURE`:
                return state.withMutations((map) => {
                  map.set('error', action.payload.error);
                  map.set('isActive', false);
                });
          app/javascript/main/restfulApi/reducerCreators/Immutable/createListReducer.js on lines 28..32

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

          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

              case `${actionPrefix}_LIST_FAILURE`:
                return state.withMutations((map) => {
                  map.set('error', action.payload.error);
                  map.set('isActive', false);
                });
          app/javascript/main/restfulApi/reducerCreators/Immutable/createItemReducer.js on lines 38..42

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

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

            return function reducer(state = INITIAL_STATE, action) {
              switch (action.type) {
              case `${actionPrefix}_SHOW_START`:
              case `${actionPrefix}_CREATE_START`:
              case `${actionPrefix}_UPDATE_START`:
            Severity
            Category
            Status
            Source
            Language