attorest/atto-rest

View on GitHub

Showing 82 of 82 total issues

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

  update: {
    body: async (id, body) => {
      try {
        const client = await pool.connect();
        const { rows } = await client.query(
Severity: Major
Found in src/db/dal/message.js and 1 other location - About 1 day to fix
src/db/dal/dialogue.js on lines 77..122

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

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

  update: {
    pinned: async (id, pinned) => {
      try {
        const client = await pool.connect();
        const { rows } = await client.query(
Severity: Major
Found in src/db/dal/dialogue.js and 1 other location - About 1 day to fix
src/db/dal/message.js on lines 61..106

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

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 5 locations. Consider refactoring.
Open

      id: async (id) => {
        try {
          const client = await pool.connect();
          const { rows } = await client.query(
            'SELECT * FROM message WHERE id = $1',
Severity: Major
Found in src/db/dal/message.js and 4 other locations - About 3 hrs to fix
src/db/dal/dialogue.js on lines 124..137
src/db/dal/invite.js on lines 28..41
src/db/dal/invite.js on lines 75..88
src/db/dal/message.js on lines 108..121

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

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

  remove: async (id) => {
    try {
      const client = await pool.connect();
      const { rows } = await client.query(
        'DELETE FROM dialogue WHERE id = $1 RETURNING *;',
Severity: Major
Found in src/db/dal/dialogue.js and 4 other locations - About 3 hrs to fix
src/db/dal/invite.js on lines 28..41
src/db/dal/invite.js on lines 75..88
src/db/dal/message.js on lines 29..42
src/db/dal/message.js on lines 108..121

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

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

  remove: async (id) => {
    try {
      const client = await pool.connect();
      const { rows } = await client.query(
        'DELETE FROM invite WHERE id = $1 RETURNING *;',
Severity: Major
Found in src/db/dal/invite.js and 4 other locations - About 3 hrs to fix
src/db/dal/dialogue.js on lines 124..137
src/db/dal/invite.js on lines 28..41
src/db/dal/message.js on lines 29..42
src/db/dal/message.js on lines 108..121

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

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

  remove: async (id) => {
    try {
      const client = await pool.connect();
      const { rows } = await client.query(
        'DELETE FROM message WHERE id = $1 RETURNING *;',
Severity: Major
Found in src/db/dal/message.js and 4 other locations - About 3 hrs to fix
src/db/dal/dialogue.js on lines 124..137
src/db/dal/invite.js on lines 28..41
src/db/dal/invite.js on lines 75..88
src/db/dal/message.js on lines 29..42

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

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

      id: async (id) => {
        try {
          const client = await pool.connect();
          const { rows } = await client.query(
            'SELECT * FROM invite WHERE id = $1',
Severity: Major
Found in src/db/dal/invite.js and 4 other locations - About 3 hrs to fix
src/db/dal/dialogue.js on lines 124..137
src/db/dal/invite.js on lines 75..88
src/db/dal/message.js on lines 29..42
src/db/dal/message.js on lines 108..121

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

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

      invited: async (invited) => {
        try {
          const client = await pool.connect();
          const { rows } = await client.query(
            'SELECT * FROM invite WHERE user_to_id = $1',
Severity: Major
Found in src/db/dal/invite.js and 5 other locations - About 2 hrs to fix
src/db/dal/dialogue.js on lines 30..43
src/db/dal/dialogue.js on lines 45..58
src/db/dal/dialogue.js on lines 60..73
src/db/dal/invite.js on lines 43..56
src/db/dal/message.js on lines 44..57

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

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 6 locations. Consider refactoring.
Open

      inviter: async (inviter) => {
        try {
          const client = await pool.connect();
          const { rows } = await client.query(
            'SELECT * FROM invite WHERE user_id = $1',
Severity: Major
Found in src/db/dal/invite.js and 5 other locations - About 2 hrs to fix
src/db/dal/dialogue.js on lines 30..43
src/db/dal/dialogue.js on lines 45..58
src/db/dal/dialogue.js on lines 60..73
src/db/dal/invite.js on lines 58..71
src/db/dal/message.js on lines 44..57

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

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 6 locations. Consider refactoring.
Open

      owner: async (owner) => {
        try {
          const client = await pool.connect();
          const { rows } = await client.query(
            'SELECT * FROM message WHERE owner_id = $1',
Severity: Major
Found in src/db/dal/message.js and 5 other locations - About 2 hrs to fix
src/db/dal/dialogue.js on lines 30..43
src/db/dal/dialogue.js on lines 45..58
src/db/dal/dialogue.js on lines 60..73
src/db/dal/invite.js on lines 43..56
src/db/dal/invite.js on lines 58..71

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

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 6 locations. Consider refactoring.
Open

      partner: async (partner) => {
        try {
          const client = await pool.connect();
          const { rows } = await client.query(
            'SELECT * FROM dialogue WHERE partner_id = $1;',
Severity: Major
Found in src/db/dal/dialogue.js and 5 other locations - About 2 hrs to fix
src/db/dal/dialogue.js on lines 30..43
src/db/dal/dialogue.js on lines 45..58
src/db/dal/invite.js on lines 43..56
src/db/dal/invite.js on lines 58..71
src/db/dal/message.js on lines 44..57

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

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 6 locations. Consider refactoring.
Open

      id: async (id) => {
        try {
          const client = await pool.connect();
          const { rows } = await client.query(
            'SELECT * FROM dialogue WHERE id = $1;',
Severity: Major
Found in src/db/dal/dialogue.js and 5 other locations - About 2 hrs to fix
src/db/dal/dialogue.js on lines 45..58
src/db/dal/dialogue.js on lines 60..73
src/db/dal/invite.js on lines 43..56
src/db/dal/invite.js on lines 58..71
src/db/dal/message.js on lines 44..57

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

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 6 locations. Consider refactoring.
Open

      owner: async (owner) => {
        try {
          const client = await pool.connect();
          const { rows } = await client.query(
            'SELECT * FROM dialogue WHERE owner_id = $1;',
Severity: Major
Found in src/db/dal/dialogue.js and 5 other locations - About 2 hrs to fix
src/db/dal/dialogue.js on lines 30..43
src/db/dal/dialogue.js on lines 60..73
src/db/dal/invite.js on lines 43..56
src/db/dal/invite.js on lines 58..71
src/db/dal/message.js on lines 44..57

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

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 resolver has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const resolver = async (routes: Path<RouteHandler>, req: IncomingMessage): Promise<{ handler: any, input: Input, action: Action }> => {
    routes = {
        '/': {
            read: (input: Input) => response({ message: 'Not found' }, 404),
            write: (input: Input) => response({ message: 'Not found' }, 404),
Severity: Major
Found in src/atto/io.ts - About 2 hrs to fix

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

            '/500': {
                read: (input: Input) => response({ message: 'Internal Server Error' }, 500),
                write: (input: Input) => response({ message: 'Internal Server Error' }, 500),
            },
    Severity: Major
    Found in src/atto/io.ts and 3 other locations - About 1 hr to fix
    src/atto/io.ts on lines 82..85
    src/atto/io.ts on lines 86..89
    src/atto/io.ts on lines 90..93

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

    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 4 locations. Consider refactoring.
    Open

            '/404': {
                read: (input: Input) => response({ message: 'Not found' }, 404),
                write: (input: Input) => response({ message: 'Not found' }, 404),
            },
    Severity: Major
    Found in src/atto/io.ts and 3 other locations - About 1 hr to fix
    src/atto/io.ts on lines 82..85
    src/atto/io.ts on lines 86..89
    src/atto/io.ts on lines 94..97

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

    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 4 locations. Consider refactoring.
    Open

            '/': {
                read: (input: Input) => response({ message: 'Not found' }, 404),
                write: (input: Input) => response({ message: 'Not found' }, 404),
            },
    Severity: Major
    Found in src/atto/io.ts and 3 other locations - About 1 hr to fix
    src/atto/io.ts on lines 86..89
    src/atto/io.ts on lines 90..93
    src/atto/io.ts on lines 94..97

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

    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 4 locations. Consider refactoring.
    Open

            '/400': {
                read: (input: Input) => response({ message: 'Input params error' }, 400),
                write: (input: Input) => response({ message: 'Input params error' }, 400),
            },
    Severity: Major
    Found in src/atto/io.ts and 3 other locations - About 1 hr to fix
    src/atto/io.ts on lines 82..85
    src/atto/io.ts on lines 90..93
    src/atto/io.ts on lines 94..97

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

    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 resolver has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const resolver = async (routes: Path<RouteHandler>, req: IncomingMessage): Promise<{ handler: any, input: Input, action: Action }> => {
        routes = {
            '/': {
                read: (input: Input) => response({ message: 'Not found' }, 404),
                write: (input: Input) => response({ message: 'Not found' }, 404),
    Severity: Minor
    Found in src/atto/io.ts - 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

    == should be ===
    Open

            'l': (function_name == 'read' && id === false && action in ['default', 'l', 'list', 'all', 'ls']),
    Severity: Minor
    Found in src/atto/io.ts by tslint

    Rule: triple-equals

    Requires === and !== in place of == and !=.

    Config

    Two arguments may be optionally provided:

    • "allow-null-check" allows == and != when comparing to null.
    • "allow-undefined-check" allows == and != when comparing to undefined.
    Examples
    "triple-equals": true
    "triple-equals": true,allow-null-check
    "triple-equals": true,allow-undefined-check
    Schema
    {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "allow-null-check",
          "allow-undefined-check"
        ]
      },
      "minLength": 0,
      "maxLength": 2
    }

    For more information see this page.

    Severity
    Category
    Status
    Source
    Language