rsercano/mongoclient

View on GitHub
server/imports/methods/mongodb/admin.js

Summary

Maintainability
D
1 day
Test Coverage

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

  addUser({ username, password, options, runOnAdminDB, sessionId }) {
    const methodArray = [
      {
        addUser: [username, password, options]
      },
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 6 other locations - About 2 hrs to fix
server/imports/methods/mongodb/collection.js on lines 50..57
server/imports/methods/mongodb/collection.js on lines 69..77
server/imports/methods/mongodb/collection.js on lines 137..144
server/imports/methods/mongodb/collection.js on lines 146..153
server/imports/methods/mongodb/collection.js on lines 217..224
server/imports/methods/mongodb/collection.js on lines 226..233

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

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

  command({ command, runOnAdminDB, options, sessionId }) {
    const methodArray = [
      {
        command: [command, options],
      },
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 5 other locations - About 2 hrs to fix
server/imports/methods/mongodb/collection.js on lines 32..39
server/imports/methods/mongodb/collection.js on lines 89..97
server/imports/methods/mongodb/collection.js on lines 155..162
server/imports/methods/mongodb/collection.js on lines 174..181
server/imports/methods/mongodb/collection.js on lines 208..215

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

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

  removeUser({ username, runOnAdminDB, sessionId }) {
    const methodArray = [
      {
        removeUser: [username],
      },
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 3 other locations - About 1 hr to fix
server/imports/methods/mongodb/collection.js on lines 59..67
server/imports/methods/mongodb/collection.js on lines 79..87
server/imports/methods/mongodb/collection.js on lines 235..242

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

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

  replSetGetStatus({ sessionId }) {
    const methodArray = [
      {
        replSetGetStatus: [],
      },
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 5 other locations - About 1 hr to fix
server/imports/methods/mongodb/admin.js on lines 34..41
server/imports/methods/mongodb/admin.js on lines 43..50
server/imports/methods/mongodb/admin.js on lines 71..78
server/imports/methods/mongodb/admin.js on lines 80..87
server/imports/methods/mongodb/admin.js on lines 107..114

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

  buildInfo({ sessionId }) {
    const methodArray = [
      {
        buildInfo: []
      },
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 5 other locations - About 1 hr to fix
server/imports/methods/mongodb/admin.js on lines 34..41
server/imports/methods/mongodb/admin.js on lines 43..50
server/imports/methods/mongodb/admin.js on lines 52..59
server/imports/methods/mongodb/admin.js on lines 71..78
server/imports/methods/mongodb/admin.js on lines 80..87

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

  listDatabases({ sessionId }) {
    const methodArray = [
      {
        listDatabases: []
      }
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 5 other locations - About 1 hr to fix
server/imports/methods/mongodb/admin.js on lines 34..41
server/imports/methods/mongodb/admin.js on lines 43..50
server/imports/methods/mongodb/admin.js on lines 52..59
server/imports/methods/mongodb/admin.js on lines 71..78
server/imports/methods/mongodb/admin.js on lines 107..114

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

  serverInfo({ sessionId }) {
    const methodArray = [
      {
        serverInfo: [],
      },
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 5 other locations - About 1 hr to fix
server/imports/methods/mongodb/admin.js on lines 34..41
server/imports/methods/mongodb/admin.js on lines 52..59
server/imports/methods/mongodb/admin.js on lines 71..78
server/imports/methods/mongodb/admin.js on lines 80..87
server/imports/methods/mongodb/admin.js on lines 107..114

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

  ping({ sessionId }) {
    const methodArray = [
      {
        ping: []
      }
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 5 other locations - About 1 hr to fix
server/imports/methods/mongodb/admin.js on lines 34..41
server/imports/methods/mongodb/admin.js on lines 43..50
server/imports/methods/mongodb/admin.js on lines 52..59
server/imports/methods/mongodb/admin.js on lines 80..87
server/imports/methods/mongodb/admin.js on lines 107..114

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

  serverStatus({ sessionId }) {
    const methodArray = [
      {
        serverStatus: [],
      },
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 5 other locations - About 1 hr to fix
server/imports/methods/mongodb/admin.js on lines 43..50
server/imports/methods/mongodb/admin.js on lines 52..59
server/imports/methods/mongodb/admin.js on lines 71..78
server/imports/methods/mongodb/admin.js on lines 80..87
server/imports/methods/mongodb/admin.js on lines 107..114

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

  dbStats({ sessionId }) {
    const methodArray = [
      {
        stats: [],
      }
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 2 other locations - About 55 mins to fix
server/imports/methods/mongodb/admin.js on lines 116..123
server/imports/methods/mongodb/collection.js on lines 5..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 53.

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

  dropDB({ sessionId }) {
    const methodArray = [
      {
        dropDatabase: []
      }
Severity: Major
Found in server/imports/methods/mongodb/admin.js and 2 other locations - About 55 mins to fix
server/imports/methods/mongodb/admin.js on lines 15..23
server/imports/methods/mongodb/collection.js on lines 5..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 53.

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

There are no issues that match your filters.

Category
Status