exivity/proton

View on GitHub

Showing 36 of 36 total issues

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

class Planet extends PureComponent {
  constructor (props) {
    super(props)

    const recordNotFoundInCache = props.id && !props.planet
Severity: Major
Found in .storybook/orbitStories/Planet.js and 1 other location - About 6 days to fix
.storybook/orbitStories/Moon.js on lines 7..163

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

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

class Moon extends PureComponent {
  constructor (props) {
    super(props)

    const recordNotFoundInCache = props.id && !props.moon
Severity: Major
Found in .storybook/orbitStories/Moon.js and 1 other location - About 6 days to fix
.storybook/orbitStories/Planet.js on lines 7..163

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

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 Planets extends PureComponent {
  constructor (props) {
    super (props)

    this.state = {
Severity: Major
Found in .storybook/orbitStories/Planets.js and 2 other locations - About 3 days to fix
.storybook/orbitStories/Moons.js on lines 8..87
src/OrbitClient/utils/templates/entities.js on lines 7..86

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

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 Moons extends PureComponent {
  constructor (props) {
    super (props)

    this.state = {
Severity: Major
Found in .storybook/orbitStories/Moons.js and 2 other locations - About 3 days to fix
.storybook/orbitStories/Planets.js on lines 8..87
src/OrbitClient/utils/templates/entities.js on lines 7..86

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

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 _Entities extends PureComponent {
  constructor (props) {
    super (props)

    this.state = {
Severity: Major
Found in src/OrbitClient/utils/templates/entities.js and 2 other locations - About 3 days to fix
.storybook/orbitStories/Moons.js on lines 8..87
.storybook/orbitStories/Planets.js on lines 8..87

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

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 createRecordComponent = (model) => {
  fs.readFile(pathUtils + '/templates/entity.js', 'utf8', (err, result) => {
    if (err) throw err
    const capitalizedModel = capitalize(model)
    const component = result.replace(/_Entity/g, capitalizedModel)
Severity: Major
Found in src/OrbitClient/utils/createStoryBookEntities.js and 1 other location - About 5 hrs to fix
src/OrbitClient/utils/createEntities.js on lines 51..64

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

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 createRecordComponent = (model, savePath) => {
  fs.readFile(pathUtils + '/templates/entity.js', 'utf8', (err, result) => {
    if (err) throw err
    const capitalizedModel = capitalize(model)
    const component = result.replace(/_Entity/g, capitalizedModel)
Severity: Major
Found in src/OrbitClient/utils/createEntities.js and 1 other location - About 5 hrs to fix
src/OrbitClient/utils/createStoryBookEntities.js on lines 41..54

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

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

export const withState = (WrappedComponent) => {
  class StateWrapper extends PureComponent {
    constructor (props) {
      super(props)

Severity: Major
Found in src/Crud/wrappers/withState.js - About 3 hrs to fix

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

    Moons.propTypes = {
      sort: PropTypes.oneOfType([
        PropTypes.string,
        PropTypes.object
      ]),
    Severity: Major
    Found in .storybook/orbitStories/Moons.js and 1 other location - About 2 hrs to fix
    .storybook/orbitStories/Planets.js on lines 97..110

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

    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

    Planets.propTypes = {
      sort: PropTypes.oneOfType([
        PropTypes.string,
        PropTypes.object
      ]),
    Severity: Major
    Found in .storybook/orbitStories/Planets.js and 1 other location - About 2 hrs to fix
    .storybook/orbitStories/Moons.js on lines 97..110

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

    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

      add = async (...args) => {
        const { beforeAdd, addRecord, onAdd } = this.props
        const proceed = await beforeAdd()
    
        if (proceed) addRecord(...args).then(onAdd)
    Severity: Major
    Found in src/Crud/Crud.js and 1 other location - About 1 hr to fix
    src/Crud/Crud.js on lines 17..22

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

    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

      update = async (...args) => {
        const { beforeUpdate, updateRecord, onUpdate } = this.props
        const proceed = await beforeUpdate()
    
        if (proceed) updateRecord(...args).then(onUpdate)
    Severity: Major
    Found in src/Crud/Crud.js and 1 other location - About 1 hr to fix
    src/Crud/Crud.js on lines 10..15

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

    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

    const mapRecordsToProps = ({ sort, filter, page }) => {
      return ({
        _entities: decorateQuery(q => q.findRecords('_entity'), { sort, filter, page }),
      })
    }
    Severity: Major
    Found in src/OrbitClient/utils/templates/entities.js and 2 other locations - About 1 hr to fix
    .storybook/orbitStories/Moons.js on lines 89..93
    .storybook/orbitStories/Planets.js on lines 89..93

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

    const mapRecordsToProps = ({ sort, filter, page }) => {
      return ({
        moons: decorateQuery(q => q.findRecords('moon'), { sort, filter, page }),
      })
    }
    Severity: Major
    Found in .storybook/orbitStories/Moons.js and 2 other locations - About 1 hr to fix
    .storybook/orbitStories/Planets.js on lines 89..93
    src/OrbitClient/utils/templates/entities.js on lines 88..92

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

    const mapRecordsToProps = ({ sort, filter, page }) => {
      return ({
        planets: decorateQuery(q => q.findRecords('planet'), { sort, filter, page }),
      })
    }
    Severity: Major
    Found in .storybook/orbitStories/Planets.js and 2 other locations - About 1 hr to fix
    .storybook/orbitStories/Moons.js on lines 89..93
    src/OrbitClient/utils/templates/entities.js on lines 88..92

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

      static getDerivedStateFromProps (props, state) {
        const newIdProp = !!props.id && props.id !== state.idReference
        const buildRecord = !props.id && props.id !== state.idReference
        const newRecord = !!props.moon && (props.moon !== state.recordReference)
        const recordNotFoundInCache = props.id && !props.moon
    Severity: Minor
    Found in .storybook/orbitStories/Moon.js - About 1 hr to fix

      Function getDerivedStateFromProps has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static getDerivedStateFromProps (props, state) {
          const newIdProp = !!props.id && props.id !== state.idReference
          const buildRecord = !props.id && props.id !== state.idReference
          const newRecord = !!props.planet && (props.planet !== state.recordReference)
          const recordNotFoundInCache = props.id && !props.planet
      Severity: Minor
      Found in .storybook/orbitStories/Planet.js - About 1 hr to fix

        Function getDerivedStateFromProps has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static getDerivedStateFromProps (props, state) {
            const newIdProp = !!props.id && props.id !== state.idReference
            const buildRecord = !props.id && props.id !== state.idReference
            const newRecord = !!props._entity && (props._entity !== state.recordReference)
            const recordNotFoundInCache = props.id && !props._entity
        Severity: Minor
        Found in src/OrbitClient/utils/templates/entity.js - About 1 hr to fix

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

          const mapRecordsToProps = (ownProps) => {
            if (ownProps.id) {
              return { moon: q => q.findRecord({ type: 'moon', id: ownProps.id }) }
            }
          
          
          Severity: Major
          Found in .storybook/orbitStories/Moon.js and 2 other locations - About 1 hr to fix
          .storybook/orbitStories/Planet.js on lines 165..171
          src/OrbitClient/utils/templates/entity.js on lines 165..171

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

          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

          const mapRecordsToProps = (ownProps) => {
            if (ownProps.id) {
              return { _entity: q => q.findRecord({ type: '_entity', id: ownProps.id }) }
            }
          
          
          Severity: Major
          Found in src/OrbitClient/utils/templates/entity.js and 2 other locations - About 1 hr to fix
          .storybook/orbitStories/Moon.js on lines 165..171
          .storybook/orbitStories/Planet.js on lines 165..171

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

          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

          Severity
          Category
          Status
          Source
          Language