nus-mtp/sashimi-note

View on GitHub

Showing 330 of 330 total issues

Avoid too many return statements within this function.
Open

        return [node, str];
Severity: Major
Found in sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return false;

      Avoid too many return statements within this function.
      Open

              return [`{\\left${symbol.rewriteleftright[0]}${result[0]}\\right${symbol.rewriteleftright[1]}}`, result[1]];
      Severity: Major
      Found in sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js - About 30 mins to fix

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

            const fifthFolder = [{
              folder_id: 5,
              parent_folder_id: 3,
              organization_id: 1,
              creation_date: '2015.01.09 11:33:12',
        sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 237..245
        sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 246..254
        sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 255..263
        sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 264..272
        sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 282..290
        sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 291..299

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

        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

        Avoid too many return statements within this function.
        Open

          return true;

          Avoid too many return statements within this function.
          Open

                  return false;

            Avoid too many return statements within this function.
            Open

              return DO_NOTHING;
            Severity: Major
            Found in sashimi-webapp/src/logic/renderer/core.js - About 30 mins to fix

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

                  const secondFolder = [{
                    folder_id: 2,
                    parent_folder_id: 0,
                    organization_id: 1,
                    creation_date: '2015.01.09 11:33:12',
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 237..245
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 255..263
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 264..272
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 273..281
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 282..290
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 291..299

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

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

                  const sixthFolder = [{
                    folder_id: 6,
                    parent_folder_id: 0,
                    organization_id: 1,
                    creation_date: '2015.01.09 11:33:12',
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 237..245
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 246..254
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 255..263
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 264..272
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 273..281
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 291..299

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

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                browser.execute((data) => {
                  const className = `.${data}`;
                  const currentNumDocs = document.querySelectorAll(className).length;
              
                  return currentNumDocs;
              sashimi-webapp/test/e2e/specs/fileManager/delete-file-folder.spec.js on lines 13..18

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

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                browser.execute((data) => {
                  const className = `.${data}`;
                  const currentNumDocs = document.querySelectorAll(className).length;
              
                  return currentNumDocs;
              sashimi-webapp/test/e2e/specs/fileManager/create-file-folder.spec.js on lines 7..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 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                const firstFolder = [{
                  folder_id: 1,
                  parent_folder_id: 0,
                  organization_id: 1,
                  creation_date: 4433,
              sashimi-webapp/test/unit/specs/database/retrieve/query.spec.js on lines 58..66

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

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                const firstFolder = [{
                  folder_id: 1,
                  parent_folder_id: 0,
                  organization_id: 1,
                  creation_date: 4433,
              Severity: Minor
              Found in sashimi-webapp/test/unit/specs/database/retrieve/query.spec.js and 1 other location - About 30 mins to fix
              sashimi-webapp/test/unit/specs/database/data-modifier/dataAdd.spec.js on lines 69..77

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

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

                  const fourthFolder = [{
                    folder_id: 4,
                    parent_folder_id: 2,
                    organization_id: 1,
                    creation_date: '2015.01.09 11:33:12',
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 237..245
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 246..254
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 255..263
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 273..281
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 282..290
              sashimi-webapp/test/unit/specs/database/sql-related/sqlCommands.spec.js on lines 291..299

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

              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

                    while ((dbFileObj = dbFileList.shift()) != null) {
                      searchFileList.push(idMap.getFileFromMap(dbFileObj.file_id));
                    }
              Severity: Minor
              Found in sashimi-webapp/src/logic/filemanager/operations/search.js and 1 other location - About 30 mins to fix
              sashimi-webapp/src/logic/filemanager/operations/search.js on lines 32..34

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

              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

                    while ((dbFolderObj = dbFolderList.shift()) != null) {
                      searchFolderList.push(idMap.getFolderFromMap(dbFolderObj.folder_id));
                    }
              Severity: Minor
              Found in sashimi-webapp/src/logic/filemanager/operations/search.js and 1 other location - About 30 mins to fix
              sashimi-webapp/src/logic/filemanager/operations/search.js on lines 28..30

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

              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

                                subarr = [newFrag.substr(pos[i]+7, pos[i+1]-pos[i]-15)];
              sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js on lines 686..686

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

              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

                              subarr = [newFrag.substr(pos[i]+8, pos[i+1]-pos[i]-16)];
              sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js on lines 677..677

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

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

              File.prototype.rename = function rename(newFileName) {
                if (!(this instanceof File)) {
                  throw new Error(ERROR_NOT_FILE_INSTANCE);
                }
              
              
              Severity: Minor
              Found in sashimi-webapp/src/logic/filemanager/data/file.js - About 25 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

              Function get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                get(value, targetUnit, shouldPrintUnit) {
                  if (shouldPrintUnit == null) {
                    shouldPrintUnit = true;
                  }
              
              
              Severity: Minor
              Found in sashimi-webapp/src/helpers/unitConverter.js - About 25 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

              Severity
              Category
              Status
              Source
              Language