nus-mtp/sashimi-note

View on GitHub

Showing 330 of 330 total issues

Function AMprocessNode has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function AMprocessNode(n, linebreaks, spanclassAM) {
  let frag;
  let st;
  if (spanclassAM!=null) {
    frag = document.getElementsByTagName('span');

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

function hideShowInline(state, silent) {
  const max = state.posMax;
  const start = state.pos;
  let found;

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

exports.cssLoaders = function (options) {
  options = options || {}
  // generate loader string to be used with extract text plugin
  function generateLoaders (loaders) {
    var sourceLoader = loaders.map(function (loader) {
Severity: Minor
Found in sashimi-webapp/build/utils.js - About 1 hr 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

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

  describe('removeFolderFromMap()', () => {
    it('should throw an error if folder ID is null', () => {
      expect(() => {
        idMap.removeFolderFromMap(null);
      }).to.throw(Error);
sashimi-webapp/test/unit/specs/logic/filemanager/operations/idmap.spec.js on lines 75..81

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

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

  describe('removeFileFromMap()', () => {
    it('should throw an error if file ID is null', () => {
      expect(() => {
        idMap.removeFileFromMap(null);
      }).to.throw(Error);
sashimi-webapp/test/unit/specs/logic/filemanager/operations/idmap.spec.js on lines 84..90

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

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

exports.cssLoaders = function (options) {
  options = options || {}
  // generate loader string to be used with extract text plugin
  function generateLoaders (loaders) {
    var sourceLoader = loaders.map(function (loader) {
Severity: Minor
Found in sashimi-webapp/build/utils.js - About 1 hr to fix

    Function sqlArray has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function sqlArray() {
      this.initializeAlasqlArray = function initializeAlasqlArray() {
        if (!isAlasqlArrayInitialized) {
          sqlObject = {};
          isAlasqlArrayInitialized = constants.CONST_ALASQL_CREATION_INITIALIZED;
    Severity: Minor
    Found in sashimi-webapp/src/database/generated-data/sqlArray.js - About 1 hr to fix

      Function shouldPageBreak has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const shouldPageBreak = function shouldPageBreak(eleHeightArray, index, page) {
        const BREAK_PAGE = true;
        const DO_NOTHING = false;
      
        const element = eleHeightArray[index].ele;
      Severity: Minor
      Found in sashimi-webapp/src/logic/renderer/core.js - About 1 hr to fix

        Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          init: function init(dbList) {
            idMap.clearMap();
        
            const dbFileList = dbList.shift(); // list of File from database list
            const dbFolderList = dbList.shift(); // list of Folder from datbase list
        Severity: Minor
        Found in sashimi-webapp/src/logic/filemanager/operations/core.js - About 1 hr to fix

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

            while (st>='0' && st<='9' && k<=str.length) {
              st = str.slice(k, k+1);
              k+=1;
            }
          sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js on lines 524..527

          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

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

                while (st>='0' && st<='9' && k<=str.length) {
                  st = str.slice(k, k+1);
                  k+=1;
                }
          sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js on lines 515..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 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 2 locations. Consider refactoring.
          Open

                      if (newFrag.charAt(i)===']' || newFrag.charAt(i)===')' || newFrag.charAt(i)==='}') { mxanynestingd-=1; }
          sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js on lines 654..654

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

                      if (newFrag.charAt(i)==='[' || newFrag.charAt(i)==='(' || newFrag.charAt(i)==='{') { mxanynestingd+=1; }
          sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js on lines 655..655

          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

            InvalidRename: function InvalidRename(message) {
              this.message = message || 'Exception: Invalid name that violates SQL injection';
              this.name = 'InvalidRename';
              this.stack = (new Error()).stack;
            }
          Severity: Major
          Found in sashimi-webapp/src/database/exceptions.js and 3 other locations - About 1 hr to fix
          sashimi-webapp/src/database/exceptions.js on lines 9..13
          sashimi-webapp/src/database/exceptions.js on lines 15..19
          sashimi-webapp/src/database/exceptions.js on lines 21..25

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

          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

            IndexedDBNotSupported: function IndexedDBNotSupported(message) {
              this.message = message || 'Exception: IndexedDB not supported on this browser.';
              this.name = 'IndexedDBNotSupported';
              this.stack = (new Error()).stack;
            },
          Severity: Major
          Found in sashimi-webapp/src/database/exceptions.js and 3 other locations - About 1 hr to fix
          sashimi-webapp/src/database/exceptions.js on lines 9..13
          sashimi-webapp/src/database/exceptions.js on lines 21..25
          sashimi-webapp/src/database/exceptions.js on lines 27..31

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 57.

          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

            IndexedDBOnBlock: function IndexedDBOnBlock(message) {
              this.message = message || 'Exception: IndexedDB thread blocked.';
              this.name = 'IndexedDBOnBlock';
              this.stack = (new Error()).stack;
            },
          Severity: Major
          Found in sashimi-webapp/src/database/exceptions.js and 3 other locations - About 1 hr to fix
          sashimi-webapp/src/database/exceptions.js on lines 9..13
          sashimi-webapp/src/database/exceptions.js on lines 15..19
          sashimi-webapp/src/database/exceptions.js on lines 27..31

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 57.

          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

            TableCreationAlreadyInitiated: function TableCreationAlreadyInitiated(message) {
              this.message = message || 'Exception: table creation thread is not closed.';
              this.name = 'TableCreationAlreadyInitiated';
              this.stack = (new Error()).stack;
            },
          Severity: Major
          Found in sashimi-webapp/src/database/exceptions.js and 3 other locations - About 1 hr to fix
          sashimi-webapp/src/database/exceptions.js on lines 15..19
          sashimi-webapp/src/database/exceptions.js on lines 21..25
          sashimi-webapp/src/database/exceptions.js on lines 27..31

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 57.

          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

            for (let i = 0; i < expArr.length; i+=1) {
              expStr.concat(`${expArr[i].innerText} `);
            }
          sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js on lines 66..68

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

          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

            for (let i = 0; i < actArr.length; i+=1) {
              actStr.concat(`${actArr[i].innerText} `);
            }
          sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js on lines 63..65

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

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

            getFile: function getFile(id) {
              let fileID = INVALID_ID;
          
              if (typeof id === 'string') {
                if (id.match(NUMBER_ONLY) == null) {
          Severity: Minor
          Found in sashimi-webapp/src/logic/filemanager/operations/core.js - About 1 hr 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