Showing 20 of 20 total issues

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

    describe('left', () => {
        it('defines left as children[0]', () => {
            expect(node.left).toEqual(node.children[0])
        })

Severity: Major
Found in packages/data-structures/src/BinaryNode.test.js and 1 other location - About 5 hrs to fix
packages/data-structures/src/BinaryNode.test.js on lines 45..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 144.

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

    describe('right', () => {
        it('defines right as children[1]', () => {
            expect(node.right).toEqual(node.children[1])
        })

Severity: Major
Found in packages/data-structures/src/BinaryNode.test.js and 1 other location - About 5 hrs to fix
packages/data-structures/src/BinaryNode.test.js on lines 27..43

Duplicated Code

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

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

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

Tuning

This issue has a mass of 144.

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

        it('zeros a matrix', () => {
            const input = [
                [1, 2, 3, 4, 5],
                [0, 0, 3, 4, 5],
                [1, 2, 0, 4, 5],
Severity: Major
Found in packages/algorithms/src/arrays-and-strings.test.js and 1 other location - About 4 hrs to fix
packages/algorithms/src/arrays-and-strings.test.js on lines 47..65

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

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

        it('does not change the matrix if no zero is encountered', () => {
            const input = [
                [1, 2, 3, 4, 5],
                [1, 2, 3, 4, 5],
                [1, 2, 3, 4, 5],
Severity: Major
Found in packages/algorithms/src/arrays-and-strings.test.js and 1 other location - About 4 hrs to fix
packages/algorithms/src/arrays-and-strings.test.js on lines 27..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 118.

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

const zeroMatrix = (matrix) => {
    const rows = matrix.length
    const columns = matrix[0].length

    const rowsToZero = []
Severity: Minor
Found in packages/algorithms/src/arrays-and-strings.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

function TabTwoNavigator() {
    return (
        <TabTwoStack.Navigator screenOptions={screenOptions}>
            <TabTwoStack.Screen
                component={TabTwoScreen}
Severity: Major
Found in projects/expo/navigation/BottomTabNavigator.tsx and 1 other location - About 1 hr to fix
projects/expo/navigation/BottomTabNavigator.tsx on lines 61..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 74.

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 TabOneNavigator() {
    return (
        <TabOneStack.Navigator screenOptions={screenOptions}>
            <TabOneStack.Screen
                component={TabOneScreen}
Severity: Major
Found in projects/expo/navigation/BottomTabNavigator.tsx and 1 other location - About 1 hr to fix
projects/expo/navigation/BottomTabNavigator.tsx on lines 75..85

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

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

        static async getInitialProps(ctx) {
            const {
                Component,
                router,
                ctx: { req, res },
Severity: Minor
Found in projects/next/lib/with-apollo-client.js - About 1 hr to fix

    Function withThemeProvider has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const withThemeProvider = (App) => {
        const ThemeProvider = (props) => {
            /**
             * This block of code sets the client-side theme to be equal to the
             * server-side theme on the initial client side render.It does so by
    Severity: Minor
    Found in projects/next/containers/withThemeProvider.js - About 1 hr to fix

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

                  <BottomTab.Screen
                      component={TabTwoNavigator}
                      name="TabTwo"
                      options={{
                          tabBarIcon: ({ color }) => (
      Severity: Major
      Found in projects/expo/navigation/BottomTabNavigator.tsx and 1 other location - About 1 hr to fix
      projects/expo/navigation/BottomTabNavigator.tsx on lines 24..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 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 2 locations. Consider refactoring.
      Open

                  <BottomTab.Screen
                      component={TabOneNavigator}
                      name="TabOne"
                      options={{
                          tabBarIcon: ({ color }) => (
      Severity: Major
      Found in projects/expo/navigation/BottomTabNavigator.tsx and 1 other location - About 1 hr to fix
      projects/expo/navigation/BottomTabNavigator.tsx on lines 33..41

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

      const zeroMatrix = (matrix) => {
          const rows = matrix.length
          const columns = matrix[0].length
      
          const rowsToZero = []
      Severity: Minor
      Found in packages/algorithms/src/arrays-and-strings.js - About 1 hr to fix

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

            render() {
                const { apolloClient, Component, pageProps } = this.props
        
                return (
                    <ApolloProvider client={apolloClient}>
        Severity: Minor
        Found in projects/next/pages/_app.js - About 1 hr to fix

          Function BottomTabNavigator has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function BottomTabNavigator() {
              const colorScheme = useColorScheme()
          
              return (
                  <BottomTab.Navigator
          Severity: Minor
          Found in projects/expo/navigation/BottomTabNavigator.tsx - About 1 hr to fix

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

                const zeroRow = (row) => {
                    for (let column = 0; column < columns; column++) {
                        matrix[row][column] = 0
                    }
                }
            Severity: Minor
            Found in packages/algorithms/src/arrays-and-strings.js and 1 other location - About 50 mins to fix
            packages/algorithms/src/arrays-and-strings.js on lines 48..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 51.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                const zeroColumn = (column) => {
                    for (let row = 0; row < rows; row++) {
                        matrix[row][column] = 0
                    }
                }
            Severity: Minor
            Found in packages/algorithms/src/arrays-and-strings.js and 1 other location - About 50 mins to fix
            packages/algorithms/src/arrays-and-strings.js on lines 42..46

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 51.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function arrayIndexAndElementEquality has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            const arrayIndexAndElementEquality = (array) => {
                let start = 0
                let end = array.length - 1
            
                while (start <= end) {
            Severity: Minor
            Found in packages/algorithms/src/binary-search.js - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

            stories.add('with a long title', () => (
                <HeroHeader
                    subtitle={text('Subtitle', 'This is a subtitle')}
                    title={text(
                        'Title',
            Severity: Minor
            Found in projects/next/components/HeroHeader.stories.js and 1 other location - About 30 mins to fix
            projects/next/components/HeroHeader.stories.js on lines 9..14

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

            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

            Avoid too many return statements within this function.
            Open

                return 'purple'
            Severity: Major
            Found in projects/next/lib/theme.js - About 30 mins to fix

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

              stories.add('default', () => (
                  <HeroHeader
                      subtitle={text('Subtitle', 'This is a subtitle')}
                      title={text('Title', 'This is a title')}
                  />
              Severity: Minor
              Found in projects/next/components/HeroHeader.stories.js and 1 other location - About 30 mins to fix
              projects/next/components/HeroHeader.stories.js on lines 20..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 45.

              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