jefer94/choco

View on GitHub

Showing 42 of 266 total issues

File server.test.ts has 445 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable no-await-in-loop */
/* eslint-disable functional/no-loop-statement */
/* eslint-disable no-restricted-syntax */
import { connect, NatsConnection, JSONCodec, StringCodec } from 'nats'
import { MongoMemoryServer } from 'mongodb-memory-server-core'
Severity: Minor
Found in services/projects/src/server.test.ts - About 6 hrs to fix

    Function NewProjectContainer has 131 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function NewProjectContainer(): ReactElement {
      const classes = useStyles()
      const [activeStep, setActiveStep] = React.useState(0)
    
      const handleNext = (): void => {
    Severity: Major
    Found in services/algorithm/src/containers/NewProjectContainer.tsx - About 5 hrs to fix

      Function Register has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function Register(): ReactElement {
        const classes = useStyles()
        // const [register, { loading, data }] = useRegister()
        const [register, request] = useRegisterUser()
        const [username, setUsername] = useState('')
      Severity: Major
      Found in services/algorithm/src/containers/RegisterContainer.tsx - About 3 hrs to fix

        Function server has a Cognitive Complexity of 24 (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 (error, msg) => {
        Severity: Minor
        Found in services/projects/src/server.ts - About 3 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 Editor has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function Editor({ content, lang }: EditorProps): ReactElement {
          // const [localContent, setLocalContet] = useState(content || '')
          const [reRender, setReRender] = useState(false)
          const localContent = useRef(tokenizer(content))
        
        
        Severity: Minor
        Found in packages/editor/src/Editor.tsx - About 3 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 en has 80 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function en(): void {
          locale.set(lang, 'algorithmWord', 'algorithm')
          locale.set(lang, 'begin', 'begin')
          locale.set(lang, 'end', 'end')
          locale.set(lang, 'forWord', 'for')
        Severity: Major
        Found in packages/algorithm-transpiler/src/lang/en.ts - About 3 hrs to fix

          Function es has 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function es(): void {
            locale.set(lang, 'algorithmWord', 'algoritmo')
            locale.set(lang, 'begin', 'inicio')
            locale.set(lang, 'end', 'fin')
            locale.set(lang, 'forWord', 'para')
          Severity: Major
          Found in packages/algorithm-transpiler/src/lang/es.ts - About 3 hrs to fix

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

            export default function Login(): ReactElement {
              if (localStorage.getItem('T__T__T')) Router.push('/')
              const classes = useStyles()
              // const [register, { loading, data }] = useRegister()
              const [login, request] = useLoginUser()
            Severity: Major
            Found in services/algorithm/src/containers/LoginContainer.tsx - About 2 hrs to fix

              Function Console has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function Console(): ReactElement {
                const { theme } = useContext(ThemeContext)
                const [runtimeObj, setRuntimeObj] = useState(null)
                const [variables, dispatch] = useReducer(varsReducer, {})
                const { tabs } = useTabs()
              Severity: Major
              Found in services/algorithm/src/containers/ConsoleContainer.tsx - About 2 hrs to fix

                File gateway.test.ts has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* eslint-disable @typescript-eslint/no-empty-function */
                import request from 'supertest'
                import { app } from './gateway'
                
                const db = {}
                Severity: Minor
                Found in services/graphql-gateway/src/gateway.test.ts - About 2 hrs to fix

                  Function NestedList has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function NestedList(): ReactElement {
                    const classes = useStyles()
                    const [openSrc, setOpenSrc] = React.useState(true)
                    const [openTest, setOpenTest] = React.useState(true)
                  
                  
                  Severity: Major
                  Found in services/algorithm/src/containers/FilesContainer.tsx - About 2 hrs to fix

                    Function Register has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function Register(): ReactElement {
                      const classes = useStyles()
                      // const [register, { loading, data }] = useRegister()
                      const [register, request] = useRegisterUser()
                      const [username, setUsername] = useState('')
                    Severity: Minor
                    Found in services/algorithm/src/containers/RegisterContainer.tsx - 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 Tabs has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function Tabs(): ReactElement {
                      const classes = useStyles()
                      const { tabs, addTab, changeTab, saveTab, removeTab } = useTabs()
                      // const { theme } = setContent(ThemeContext)
                      const [value, setValue] = React.useState(0)
                    Severity: Major
                    Found in services/algorithm/src/containers/EditorContainer.tsx - About 2 hrs to fix

                      Function server has 60 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: Major
                      Found in services/projects/src/server.ts - About 2 hrs to fix

                        Function cloneCodemirror has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        async function cloneCodemirror() {
                          console.log('installing codemirror')
                          // "type": "commonjs"
                        
                          if (!fs.existsSync(libsDir)) fs.mkdirSync(libsDir)
                        Severity: Major
                        Found in scripts/development/prepare.js - About 2 hrs to fix

                          Function callback has 56 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: Major
                          Found in services/projects/src/server.ts - About 2 hrs to fix

                            Function LoadingScreen has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function LoadingScreen(): ReactElement {
                              const classes = useStyles()
                              return (
                                <>
                                  <div className={classes.project}>
                            Severity: Minor
                            Found in services/algorithm/src/containers/ProjectsContainer.tsx - About 2 hrs to fix

                              Function Login has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export default function Login(): ReactElement {
                                if (localStorage.getItem('T__T__T')) Router.push('/')
                                const classes = useStyles()
                                // const [register, { loading, data }] = useRegister()
                                const [login, request] = useLoginUser()
                              Severity: Minor
                              Found in services/algorithm/src/containers/LoginContainer.tsx - 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 server has a Cognitive Complexity of 14 (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 (error, msg) => {
                              Severity: Minor
                              Found in services/authenticator/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 Landing has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export default function Landing(): ReactElement {
                                // router.prefetch('/dashboard')
                                return (
                                  <>
                                    <Head title="Algorithm" />
                              Severity: Minor
                              Found in services/algorithm/src/pages/landing.tsx - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language