jefer94/choco

View on GitHub

Showing 266 of 266 total issues

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

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

              {top.map(({ name, url, Icon }) => (
                <Link href={url} key={name}>
                  <ListItem button component="li">
                    <ListItemIcon><Icon /></ListItemIcon>
                    <ListItemText primary={name} />
    Severity: Major
    Found in services/algorithm/src/containers/MenuContainer.tsx and 1 other location - About 3 hrs to fix
    services/algorithm/src/containers/MenuContainer.tsx on lines 155..162

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

    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

              {bottom.map(({ name, url, Icon }) => (
                <Link href={url} key={name}>
                  <ListItem button component="li">
                    <ListItemIcon><Icon /></ListItemIcon>
                    <ListItemText primary={name} />
    Severity: Major
    Found in services/algorithm/src/containers/MenuContainer.tsx and 1 other location - About 3 hrs to fix
    services/algorithm/src/containers/MenuContainer.tsx on lines 145..152

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

    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

    export default async function updateProject(arg: ProjectArgs): Promise<UpdateProject> {
      const { id, ...obj } = arg
      try {
        return { data: await Project.findOneAndUpdate({ _id: id }, obj, { new: true }) }
      }
    Severity: Major
    Found in services/projects/src/actions/updateProject.ts and 1 other location - About 3 hrs to fix
    services/projects/src/actions/updateCode.ts on lines 18..26

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

    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

    export default async function updateCode(arg: CodeArgs): Promise<UpdateCode> {
      const { id, ...obj } = arg
      try {
        return { data: await Code.findOneAndUpdate({ _id: id }, obj, { new: true }) }
      }
    Severity: Major
    Found in services/projects/src/actions/updateCode.ts and 1 other location - About 3 hrs to fix
    services/projects/src/actions/updateProject.ts on lines 18..26

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

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

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

        type FieldProps = {
          readonly type?: 'text' | 'password' | 'number' | 'email'
          readonly id: string
          readonly label: string
          readonly value?: number | string
        Severity: Major
        Found in services/algorithm/src/components/FieldFilled.tsx and 1 other location - About 3 hrs to fix
        services/algorithm/src/components/Field.tsx on lines 27..37

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

        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

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

        type FieldProps = {
          readonly type?: 'text' | 'password' | 'number' | 'email'
          readonly id: string
          readonly label: string
          readonly value?: number | string
        Severity: Major
        Found in services/algorithm/src/components/Field.tsx and 1 other location - About 3 hrs to fix
        services/algorithm/src/components/FieldFilled.tsx on lines 28..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 97.

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

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

              context('Check editor global attributes', () => {
                it('Can visit page', () => {
                  cy.visit('/landing')
                })
              
              
              Severity: Major
              Found in services/algorithm/cypress/integration/landing.spec.js and 1 other location - About 2 hrs to fix
              services/algorithm/cypress/integration/landing.es.spec.js on lines 3..12

              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

              context('Check editor lang es', () => {
                it('Can visit page', () => {
                  cy.visit('/landing')
                })
              
              
              Severity: Major
              Found in services/algorithm/cypress/integration/landing.es.spec.js and 1 other location - About 2 hrs to fix
              services/algorithm/cypress/integration/landing.spec.js on lines 3..12

              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

              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

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

                export function mutateWithAuthUser(service: string, project: string): Mutate {
                  return async (_, message, ctx) => {
                    if (ctx.auth?.user) {
                      return SendCommand(service, project, { ...message.input, id: message.id })
                    }
                Severity: Major
                Found in services/graphql-gateway/src/nats.ts and 1 other location - About 2 hrs to fix
                services/graphql-gateway/src/nats.ts on lines 132..139

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

                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

                export function mutateWithAuth(service: string, project: string): Mutate {
                  return async (_, message, ctx) => {
                    if (ctx.auth?.user) {
                      return SendCommand(service, project, { ...message.input, id: message.id })
                    }
                Severity: Major
                Found in services/graphql-gateway/src/nats.ts and 1 other location - About 2 hrs to fix
                services/graphql-gateway/src/nats.ts on lines 141..148

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

                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

                test('GET /users/me bad token', async () => {
                  const { text, statusCode } = await request(app)
                    .get('/users/me')
                    .set({ Authorization: 'Bad token' })
                
                
                Severity: Major
                Found in services/graphql-gateway/src/gateway.test.ts and 1 other location - About 2 hrs to fix
                services/graphql-gateway/src/gateway.test.ts on lines 97..104

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

                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