Showing 8 of 20 total issues

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

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

      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

            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

            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
              Severity
              Category
              Status
              Source
              Language