shierro/territory-manager

View on GitHub

Showing 33 of 49 total issues

Function actions has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  actions: data => {
    // Generate index.js and index.test.js
    var componentTemplate; // eslint-disable-line no-var

    switch (data.type) {
Severity: Major
Found in internals/generators/container/index.js - About 4 hrs to fix

    Function mainFolderListItems has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const mainFolderListItems = params => {
      const getLiProps = nested => ({
        classes: {
          root: `${params.classes.liRoot} ${nested && params.classes.liNested}`,
          button: params.classes.liButton,
    Severity: Major
    Found in app/components/LeftDrawer/tileData.js - About 2 hrs to fix

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

                <ListItem
                  {...getLiProps(true)}
                  selected={params.path === '/people/list'}
                  onClick={() => params.history.push('/people/list')}
                >
      Severity: Major
      Found in app/components/LeftDrawer/tileData.js and 1 other location - About 2 hrs to fix
      app/components/LeftDrawer/tileData.js on lines 72..81

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

      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

                <ListItem
                  {...getLiProps(true)}
                  selected={params.path === '/people/map'}
                  onClick={() => params.history.push('/people/map')}
                >
      Severity: Major
      Found in app/components/LeftDrawer/tileData.js and 1 other location - About 2 hrs to fix
      app/components/LeftDrawer/tileData.js on lines 62..71

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

      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

            <ListItem
              {...getLiProps()}
              selected={params.path === '/placements'}
              onClick={() => params.history.push('/placements')}
            >
      Severity: Major
      Found in app/components/LeftDrawer/tileData.js and 1 other location - About 2 hrs to fix
      app/components/LeftDrawer/tileData.js on lines 29..38

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

      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

            <ListItem
              {...getLiProps()}
              selected={params.path === '/home'}
              onClick={() => params.history.push('/home')}
            >
      Severity: Major
      Found in app/components/LeftDrawer/tileData.js and 1 other location - About 2 hrs to fix
      app/components/LeftDrawer/tileData.js on lines 39..48

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

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

      Pagination.propTypes = {
        count: PropTypes.number.isRequired,
        rowsPerPage: PropTypes.number.isRequired,
        page: PropTypes.number.isRequired,
        handleChangePage: PropTypes.func.isRequired,
      Severity: Major
      Found in app/components/TablePagination/index.js and 3 other locations - About 2 hrs to fix
      app/components/AddVisit/index.js on lines 130..136
      app/containers/App/index.js on lines 41..47
      app/containers/PlacementsPage/index.js on lines 99..105

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

      PlacementsPage.propTypes = {
        title: PropTypes.string.isRequired,
        grouping: PropTypes.string.isRequired,
        increment: PropTypes.func.isRequired,
        placements: PropTypes.object.isRequired,
      Severity: Major
      Found in app/containers/PlacementsPage/index.js and 3 other locations - About 2 hrs to fix
      app/components/AddVisit/index.js on lines 130..136
      app/components/TablePagination/index.js on lines 26..32
      app/containers/App/index.js on lines 41..47

      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

      Function actions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        actions: () => {
          const actions = [];
          actions.push({
            type: 'modify',
            path: '../../app/i18n.js',
      Severity: Major
      Found in internals/generators/language/index.js - About 2 hrs to fix

        Function actions has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          actions: data => {
            // Generate index.js and index.test.js
            let componentTemplate;
        
            switch (data.type) {
        Severity: Minor
        Found in internals/generators/component/index.js - About 1 hr to fix

          Function extractFromFile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          const extractFromFile = fileName => {
            return readFile(fileName)
              .then(code => {
                // Use babel plugin to extract instances where react-intl is used
                const { metadata: result } = transform(code, { presets, plugins });
          Severity: Minor
          Found in internals/scripts/extract-intl.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 injectSagaFactory has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          export function injectSagaFactory(store, isValid) {
            return function injectSaga(key, descriptor = {}, args) {
              if (!isValid) checkStore(store);
              const newDescriptor = {
                ...descriptor,
          Severity: Minor
          Found in app/utils/sagaInjectors.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

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

          LeftDrawer.propTypes = {
            classes: PropTypes.object.isRequired,
            open: PropTypes.bool.isRequired,
            hidden: PropTypes.bool.isRequired,
            toggleDrawer: PropTypes.func.isRequired,
          Severity: Major
          Found in app/components/LeftDrawer/index.js and 2 other locations - About 1 hr to fix
          app/components/Header/index.js on lines 59..64
          app/components/TableHead/index.js on lines 54..59

          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

          Header.propTypes = {
            classes: PropTypes.object.isRequired,
            token: PropTypes.string.isRequired,
            open: PropTypes.bool.isRequired,
            handleDrawerOpen: PropTypes.func.isRequired,
          Severity: Major
          Found in app/components/Header/index.js and 2 other locations - About 1 hr to fix
          app/components/LeftDrawer/index.js on lines 56..61
          app/components/TableHead/index.js on lines 54..59

          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

          EnhancedTableHead.propTypes = {
            onRequestSort: PropTypes.func.isRequired,
            order: PropTypes.string.isRequired,
            orderBy: PropTypes.string.isRequired,
            columns: PropTypes.array.isRequired,
          Severity: Major
          Found in app/components/TableHead/index.js and 2 other locations - About 1 hr to fix
          app/components/Header/index.js on lines 59..64
          app/components/LeftDrawer/index.js on lines 56..61

          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

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

          function mapPageReducer(state = initialState, action) {
            switch (action.type) {
              case GET_INITIAL_LOCATION:
                return state.set('loading', true);
              case SET_INITIAL_LOCATION:
          Severity: Minor
          Found in app/containers/MapPage/reducer.js - About 1 hr to fix

            Function renderMarkers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              renderMarkers(people, history) {
                return Object.keys(people).map(key => (
                  <Marker
                    key={key}
                    position={people[key].location}
            Severity: Minor
            Found in app/containers/MapPage/index.js - About 1 hr to fix

              Function ejectSagaFactory has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              export function ejectSagaFactory(store, isValid) {
                return function ejectSaga(key) {
                  if (!isValid) checkStore(store);
                  checkKey(key);
                  if (Reflect.has(store.injectedSagas, key)) {
              Severity: Minor
              Found in app/utils/sagaInjectors.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 renderVisits has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                renderVisits(visits) {
                  const { order, orderBy, handleRequestSort, classes } = this.props;
                  const { page, rowsPerPage } = this.props;
                  return (
                    <div className={classes.tableWrapper}>
              Severity: Minor
              Found in app/containers/PersonDetailsPage/index.js - About 1 hr to fix

                Function injectSagaFactory has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function injectSagaFactory(store, isValid) {
                  return function injectSaga(key, descriptor = {}, args) {
                    if (!isValid) checkStore(store);
                    const newDescriptor = {
                      ...descriptor,
                Severity: Minor
                Found in app/utils/sagaInjectors.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language