jefer94/choco

View on GitHub

Showing 42 of 266 total issues

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

export default async function server(): Promise<void> {
  const nc = await connection()

  subscription = await nc.subscribe(host, { callback: async (err, msg) => {
    const { decode, encode } = JSONCodec()
Severity: Minor
Found in services/activity/src/server.ts - 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 ProjectCardSkeleton has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function ProjectCardSkeleton(): ReactElement {
  const classes = useStyles()

  return (
    <Card className={classes.root}>
Severity: Minor
Found in services/algorithm/src/components/ProjectCardSkeleton.tsx - About 1 hr to fix

    Function ProjectCard has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function ProjectCard(): ReactElement {
      const classes = useStyles()
    
      return (
        <Card className={classes.root}>
    Severity: Minor
    Found in services/algorithm/src/components/ProjectCard.tsx - About 1 hr to fix

      Function write has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function write(...args: readonly WriteInput[]): IoLine {
        const error = locale.one<LangError>('error')
        // var
        let result = ''
        let err
      Severity: Minor
      Found in packages/algorithm-transpiler/src/io.ts - About 1 hr to fix

        Function server has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        export default async function server(): Promise<void> {
          const nc = await connect(process.env.BROKER ?
            { servers: process.env.BROKER } : {})
        
          nc.subscribe(host, { callback: async (err, msg) => {
        Severity: Minor
        Found in services/cache/src/server.ts - 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 chocolabTokens has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function chocolabTokens(/* lang: string */): ChocolabTokens {
          const algorithmWord = locale.one<string>('algorithmWord')
          const begin = locale.one<string>('begin')
          const end = locale.one<string>('end')
          const forWord = locale.one<string>('forWord')
        Severity: Minor
        Found in packages/algorithm-transpiler/src/chocolabTokens.ts - About 1 hr to fix

          Function server has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default async function server(): Promise<void> {
            const nc = await connect(process.env.BROKER ?
              { servers: process.env.BROKER } : {})
          
            nc.subscribe(host, { callback: async (error, msg) => {
          Severity: Minor
          Found in services/authenticator/src/server.ts - About 1 hr to fix

            Function ProjectsContainer has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function ProjectsContainer(): ReactElement {
              const classes = useStyles()
              const { data = [], error, loading } = useFetchProjects()
              console.info(loading, data, error)
            
            
            Severity: Minor
            Found in services/algorithm/src/containers/ProjectsContainer.tsx - About 1 hr to fix

              Function server has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default async function server(): Promise<void> {
                const nc = await connection()
              
                subscription = await nc.subscribe(host, { callback: async (err, msg) => {
                  const { decode, encode } = JSONCodec()
              Severity: Minor
              Found in services/activity/src/server.ts - About 1 hr to fix

                Function Tags has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function Tags(): ReactElement {
                    return (
                      <>
                        <Field
                          id="username"
                Severity: Minor
                Found in services/algorithm/src/containers/NewProjectContainer.tsx - About 1 hr to fix

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

                    function Data(): ReactElement {
                      return (
                        <div>
                          <div>
                            <Field
                  Severity: Minor
                  Found in services/algorithm/src/containers/NewProjectContainer.tsx - About 1 hr to fix

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

                    export default function reducer(state = getDefaults(), action: LazyActions): readonly Tab[] {
                      switch (action.type) {
                        case 'ADD_TAB':
                          return add(state)
                    
                    
                    Severity: Minor
                    Found in services/algorithm/src/reducers/tabs.ts - About 1 hr to fix

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

                        nc.subscribe(host, { callback: async (error, msg) => {
                          const { decode, encode } = JSONCodec()
                          const { reply, data } = msg
                      
                          if (reply) {
                      Severity: Minor
                      Found in services/authenticator/src/server.ts - About 1 hr to fix

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

                          subscription = await nc.subscribe(host, { callback: async (err, msg) => {
                            const { decode, encode } = JSONCodec()
                            const { reply, data } = msg
                        
                            if (reply) {
                        Severity: Minor
                        Found in services/activity/src/server.ts - About 1 hr to fix

                          Function authenticatorMock has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export default async function authenticatorMock(): Promise<void> {
                            const host = process.env.AUTHENTICATOR || 'authenticator'
                            const nc = await connection()
                          
                            subscription = await nc.subscribe(host, { callback: async (err, msg) => {
                          Severity: Minor
                          Found in services/activity/src/mocks/authenticatorMock.ts - About 55 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

                          Function checkVariables has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function checkVariables(type: JavascriptType, newLastLine: IoLine, input: string): ReadResponse |
                            undefined {
                            const typeError = locale.one<LangTypeError>('typeError')
                          
                            switch (type) {
                          Severity: Minor
                          Found in packages/algorithm-transpiler/src/io.ts - About 55 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 `${keyword} `
                          Severity: Major
                          Found in packages/algorithm-transpiler/src/brackets.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return <Text>{s}</Text>
                            Severity: Major
                            Found in packages/editor/src/Editor.tsx - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  if (types[0] && types.some((exp) => exp[0].test(s))) return <Type dark>{s}</Type>
                              Severity: Major
                              Found in packages/editor/src/Editor.tsx - About 30 mins to fix

                                Function NewProjectContainer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export default function NewProjectContainer(): ReactElement {
                                  const classes = useStyles()
                                  const [activeStep, setActiveStep] = React.useState(0)
                                
                                  const handleNext = (): void => {
                                Severity: Minor
                                Found in services/algorithm/src/containers/NewProjectContainer.tsx - About 25 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

                                Severity
                                Category
                                Status
                                Source
                                Language