jefer94/choco

View on GitHub

Showing 266 of 266 total issues

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

export default async function addProject(obj: ProjectArgs): Promise<AddProject> {
  try {
    const scope = new Project(obj)
    await scope.save()
    return { data: scope }
Severity: Major
Found in services/projects/src/actions/addProject.ts and 2 other locations - About 2 hrs to fix
services/projects/src/actions/addCode.ts on lines 19..28
services/projects/src/actions/addProjectPermission.ts on lines 21..31

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

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

test('GET /posts bad token', async () => {
  const { text, statusCode } = await request(app)
    .get('/posts')
    .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 60..67

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

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

export default async function addCode(arg: CodeArgs): Promise<AddCode> {
  try {
    const code = new Code(arg)
    await code.save()
    return { data: code }
Severity: Major
Found in services/projects/src/actions/addCode.ts and 2 other locations - About 2 hrs to fix
services/projects/src/actions/addProject.ts on lines 19..28
services/projects/src/actions/addProjectPermission.ts on lines 21..31

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

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

export default async function addProjectPermission(obj: ProjectPermissionArgs):
  Promise<AddProjectPermission> {
  try {
    const perm = new ProjectPermission(obj)
    await perm.save()
Severity: Major
Found in services/projects/src/actions/addProjectPermission.ts and 2 other locations - About 2 hrs to fix
services/projects/src/actions/addCode.ts on lines 19..28
services/projects/src/actions/addProject.ts on lines 19..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 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

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

export default function MenuLink({ href, children, className }: LinkProps): ReactElement {
  return (
    <MaterialUiLink
      href={href}
      className={className}
Severity: Major
Found in services/algorithm/src/components/MenuLink.tsx and 1 other location - About 2 hrs to fix
services/algorithm/src/components/Link.tsx on lines 28..40

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

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 function Link({ href, children, className }: LinkProps): ReactElement {
  return (
    <MaterialUiLink
      href={href}
      className={className}
Severity: Major
Found in services/algorithm/src/components/Link.tsx and 1 other location - About 2 hrs to fix
services/algorithm/src/components/MenuLink.tsx on lines 26..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 88.

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

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

                  <div className={classes.alternative}>
                    <Typography variant="body1" className={classes.alternativeText}>
                      Ya tienes una cuenta?
                    </Typography>
                    <Link href="/register" className={classes.alternativeLink}>acceder</Link>
        Severity: Major
        Found in services/algorithm/src/containers/LoginContainer.tsx and 1 other location - About 2 hrs to fix
        services/algorithm/src/containers/RegisterContainer.tsx on lines 156..161

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

        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

                  <div className={classes.alternative}>
                    <Typography variant="body1" className={classes.alternativeText}>
                      Ya tienes una cuenta?
                    </Typography>
                    <Link href="/register" className={classes.alternativeLink}>acceder</Link>
        Severity: Major
        Found in services/algorithm/src/containers/RegisterContainer.tsx and 1 other location - About 2 hrs to fix
        services/algorithm/src/containers/LoginContainer.tsx on lines 134..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 81.

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

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

                <ListItem button onClick={clickSrc}>
                  <ListItemIcon>
                    <FolderOpenIcon />
                  </ListItemIcon>
                  <ListItemText primary="src" />
          Severity: Major
          Found in services/algorithm/src/containers/FilesContainer.tsx and 1 other location - About 2 hrs to fix
          services/algorithm/src/containers/FilesContainer.tsx on lines 80..86

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

          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

                <ListItem button onClick={clickTest}>
                  <ListItemIcon>
                    <FolderOpenIcon />
                  </ListItemIcon>
                  <ListItemText primary="test" />
          Severity: Major
          Found in services/algorithm/src/containers/FilesContainer.tsx and 1 other location - About 2 hrs to fix
          services/algorithm/src/containers/FilesContainer.tsx on lines 55..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 78.

          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('add scope', async () => {
            const { data, ...obj1 } = await SendCommand(actions.addScope, { name: 'Can edit' })
            expect(Object.keys(obj1)).toHaveLength(0)
            testScope(data)
          })
          Severity: Major
          Found in services/authenticator/src/server.test.ts and 1 other location - About 2 hrs to fix
          services/authenticator/src/server.test.ts on lines 208..212

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

          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('delete scope', async () => {
            const { data, ...obj1 } = await SendCommand(actions.deleteScope, { name: 'Can edit' })
            expect(Object.keys(obj1)).toHaveLength(0)
            testScope(data)
          })
          Severity: Major
          Found in services/authenticator/src/server.test.ts and 1 other location - About 2 hrs to fix
          services/authenticator/src/server.test.ts on lines 195..199

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

          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('add once service again', async () => {
            const { data, ...obj } = await SendCommand(actions.addOnceService, { name: service1 })
            expect(Object.keys(obj)).toHaveLength(0)
            testService(data)
          })
          Severity: Major
          Found in services/activity/src/server.test.ts and 1 other location - About 2 hrs to fix
          services/activity/src/server.test.ts on lines 258..262

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

          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('delete service', async () => {
            const { data, ...obj } = await SendCommand(actions.deleteService, { name: service1 })
            expect(Object.keys(obj)).toHaveLength(0)
            testService(data)
          })
          Severity: Major
          Found in services/activity/src/server.test.ts and 1 other location - About 2 hrs to fix
          services/activity/src/server.test.ts on lines 141..145

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

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