nus-mtp/sashimi-note

View on GitHub
sashimi-webapp/src/database/sql-related/sqlCommands.js

Summary

Maintainability
F
1 wk
Test Coverage

Function sqlCommands has 315 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function sqlCommands() {
  this.linkDatabaseToIndexedDB = function linkDatabaseToIndexedDB(databaseName) {
    return new Promise((resolve, reject) => {
      databaseName = resolveSQLInjection(databaseName);
      const databaseRequestStr = stringManipulator.stringConcat(
Severity: Major
Found in sashimi-webapp/src/database/sql-related/sqlCommands.js - About 1 day to fix

    File sqlCommands.js has 528 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import StringManipulator from 'src/database/stringManipulation';
    import constants from 'src/database/constants';
    import DateTime from 'src/database/generated-data/dateTime';
    import exceptions from 'src/database/exceptions';
    
    
    Severity: Major
    Found in sashimi-webapp/src/database/sql-related/sqlCommands.js - About 1 day to fix

      Function sqlCommands has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function sqlCommands() {
        this.linkDatabaseToIndexedDB = function linkDatabaseToIndexedDB(databaseName) {
          return new Promise((resolve, reject) => {
            databaseName = resolveSQLInjection(databaseName);
            const databaseRequestStr = stringManipulator.stringConcat(
      Severity: Minor
      Found in sashimi-webapp/src/database/sql-related/sqlCommands.js - 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 changeFolderName has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        this.changeFolderName = function changeFolderName(folderId, newFolderName) {
          return new Promise((resolve, reject) => {
            let prevFolderPath;
            let thisFolderPath;
            let newFolderPath;
      Severity: Major
      Found in sashimi-webapp/src/database/sql-related/sqlCommands.js - About 2 hrs to fix

        Function deleteFolder has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          this.deleteFolder = function deleteFolder(folderId) {
            return new Promise((resolve, reject) => {
              let thisFolderPath;
              let foldersToDelete;
              let filesToDelete;
        Severity: Minor
        Found in sashimi-webapp/src/database/sql-related/sqlCommands.js - About 1 hr to fix

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

          function cascadeChangeFilePath(index, prevBasePath, newBasePath, fileArr) {
            return new Promise((resolve, reject) => {
              if (index >= fileArr.length) {
                resolve(true);
              }
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 1 day to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 112..135

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

          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

          function cascadeChangeFolderPath(index, prevBasePath, newBasePath, folderArr) {
            return new Promise((resolve, reject) => {
              if (index >= folderArr.length) {
                resolve(true);
              }
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 1 day to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 63..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 231.

          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

          function cascadeDeleteFolder(index, folderArr) {
            return new Promise((resolve, reject) => {
              if (index >= folderArr.length) {
                resolve(true);
              }
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 4 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 174..188

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

          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

          function cascadeDeleteFile(index, fileArr) {
            return new Promise((resolve, reject) => {
              if (index >= fileArr.length) {
                resolve(true);
              }
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 4 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 147..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 133.

          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

            this.getMaxFileId = function getMaxFileId() {
              return new Promise((resolve, reject) =>
                alasql.promise([stringManipulator.stringConcat('SELECT max(', constants.HEADER_FILE_MANAGER_FILE_ID,
                                                               ') FROM ', constants.ENTITIES_FILE_MANAGER)])
                .then((data) => {
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 4 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 337..350

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

          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

            this.getMaxFolderId = function getMaxFolderId() {
              return new Promise((resolve, reject) =>
                alasql.promise([stringManipulator.stringConcat('SELECT MAX(', constants.HEADER_FOLDER_FOLDER_ID,
                                                               ') FROM ', constants.ENTITIES_FOLDER)])
                .then((data) => {
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 4 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 323..336

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

          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

            this.partialSearchFolderName = function partialSearchFolderName(searchString) {
              return new Promise((resolve, reject) => {
                searchString = resolveSQLInjection(searchString);
                return alasql.promise([stringManipulator.stringConcat('SELECT * FROM ', constants.ENTITIES_FOLDER,
                                                                      ' WHERE ', constants.HEADER_FOLDER_FOLDER_NAME,
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 4 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 283..292

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

          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

            this.partialSearchFileName = function partialSearchFileName(searchString) {
              return new Promise((resolve, reject) => {
                searchString = resolveSQLInjection(searchString);
                return alasql.promise([stringManipulator.stringConcat('SELECT * FROM ', constants.ENTITIES_FILE_MANAGER,
                                                                      ' WHERE ', constants.HEADER_FILE_MANAGER_FILE_NAME,
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 4 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 363..372

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

          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

          function changeSingleFolderPath(folderId, newPath) {
            return new Promise((resolve, reject) =>
              alasql.promise([stringManipulator.stringConcat('UPDATE ', constants.ENTITIES_FOLDER,
                                                             ' SET ', constants.HEADER_FOLDER_PATH,
                                                             ' = "', newPath,
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 2 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 100..110

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

          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

          function changeSingleFolderName(folderId, newFolderName) {
            return new Promise((resolve, reject) =>
              alasql.promise([stringManipulator.stringConcat('UPDATE ', constants.ENTITIES_FOLDER,
                                                             ' SET ', constants.HEADER_FOLDER_FOLDER_NAME,
                                                             ' = "', newFolderName,
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 2 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 88..98

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

          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

          function getCurrentFolderPath(folderId) {
            return new Promise((resolve, reject) =>
              alasql.promise([stringManipulator.stringConcat('SELECT ', constants.HEADER_FOLDER_PATH,
                                                             ' FROM ', constants.ENTITIES_FOLDER,
                                                             ' WHERE ', constants.HEADER_FOLDER_FOLDER_ID,
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 2 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 28..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 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

          function getCurrentFilePath(fileId) {
            return new Promise((resolve, reject) =>
              alasql.promise([stringManipulator.stringConcat('SELECT ', constants.HEADER_FILE_MANAGER_PATH,
                                                             ' FROM ', constants.ENTITIES_FILE_MANAGER,
                                                             ' WHERE ', constants.HEADER_FILE_MANAGER_FILE_ID,
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 2 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 39..48

          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

          function deleteSingleFolder(folderId) {
            return new Promise((resolve, reject) =>
              alasql.promise([stringManipulator.stringConcat('DELETE FROM ', constants.ENTITIES_FOLDER,
                                                             ' WHERE ', constants.HEADER_FOLDER_FOLDER_ID,
                                                             ' = ', folderId)])
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 2 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 164..172

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

          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

          function deleteSingleFile(fileId) {
            return new Promise((resolve, reject) =>
              alasql.promise([stringManipulator.stringConcat('DELETE FROM ', constants.ENTITIES_FILE_MANAGER,
                                                             ' WHERE ', constants.HEADER_FILE_MANAGER_FILE_ID,
                                                             ' = ', fileId)])
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 2 hrs to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 137..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 77.

          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

                return alasql.promise([stringManipulator.stringConcat('SELECT * FROM ', constants.ENTITIES_FILE_MANAGER,
                                                                      ' WHERE ', constants.HEADER_FILE_MANAGER_FOLDER_ID,
                                                                      ' = ', folderId)])
                .then(data => resolve(getArray(data)))
                .catch(sqlError => reject(sqlError));
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 1 hr to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 355..359

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

          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

                alasql.promise([stringManipulator.stringConcat('SELECT * FROM ', constants.ENTITIES_FILE_MANAGER,
                                                               ' WHERE ', constants.HEADER_FILE_MANAGER_FILE_ID,
                                                               ' = ', fileId)])
                .then(data => resolve(getArray(data)))
                .catch(sqlError => reject(sqlError));
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 1 other location - About 1 hr to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 377..381

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

          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

                  alasql.promise([stringManipulator.stringConcat('UPDATE ', constants.ENTITIES_FILE_MANAGER,
                                                                ' SET ', constants.HEADER_FILE_MANAGER_PATH,
                                                                ' = "', newPath,
                                                                '" WHERE ', constants.HEADER_FILE_MANAGER_FILE_ID,
                                                                ' = ', fileId)])
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 2 other locations - About 1 hr to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 505..510
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 513..518

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

          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

                  return alasql.promise([stringManipulator.stringConcat('UPDATE ', constants.ENTITIES_FILE_MANAGER,
                                                                        ' SET ', constants.HEADER_FILE_MANAGER_LAST_MODIFIED_DATE,
                                                                        ' = "', currentDateTime,
                                                                        '" WHERE ', constants.HEADER_FILE_MANAGER_FILE_ID,
                                                                        ' = ', fileId)])
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 2 other locations - About 1 hr to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 427..432
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 505..510

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

          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

                return alasql.promise([stringManipulator.stringConcat('UPDATE ', constants.ENTITIES_FILE_MANAGER,
                                                                      ' SET ', constants.HEADER_FILE_MANAGER_FILE_MARKDOWN,
                                                                      ' = "', markdownFile,
                                                                      '" WHERE ', constants.HEADER_FILE_MANAGER_FILE_ID,
                                                                      ' = ', fileId)])
          Severity: Major
          Found in sashimi-webapp/src/database/sql-related/sqlCommands.js and 2 other locations - About 1 hr to fix
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 427..432
          sashimi-webapp/src/database/sql-related/sqlCommands.js on lines 513..518

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

          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