nus-mtp/sashimi-note

View on GitHub

Showing 117 of 330 total issues

Function AMTremoveBrackets has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function AMTremoveBrackets(node) {
  let st;
  if (node.charAt(0)==='{' && node.charAt(node.length-1)==='}') {
    let leftchop = 0;

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

    function searchElement(scrollDocument = document) {
      const x = scrollDocument.defaultView.innerWidth/2;
      const yLimit = (scrollDocument.defaultView.innerHeight * 0.25); // Search only the top 25% of the window
      const offsetTop = 50;
      for (let i = offsetTop; i < yLimit + offsetTop; i += 1) {
    Severity: Minor
    Found in sashimi-webapp/src/logic/inputHandler/scrollSync/index.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

    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

    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

            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

            Function stringManipulation has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function stringManipulation() {
              this.stringConcat = function stringConcat(...stringToConcat) {
                return stringToConcat.join('');
              };
            
            
            Severity: Minor
            Found in sashimi-webapp/src/database/stringManipulation.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

            Function getFolder has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              getFolder: function getFolder(id) {
                let folderID = 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

            Function AMstrarr2docFrag has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function AMstrarr2docFrag(arr, linebreaks) {
              const newFrag=document.createDocumentFragment();
              let expr = false;
              for (let i=0; i<arr.length; i+=1) {
                if (expr) newFrag.appendChild(AMparseMath(arr[i]));

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

            const addElementToPage = function addElementToPage(page, book, eleArray, index) {
              const element = eleArray[index];
              try {
                if (shouldPageBreak(eleArray, index, page)) {
                  // Create a new page if page should be broken here
            Severity: Minor
            Found in sashimi-webapp/src/logic/renderer/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

            Function print has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              print(markdownData) {
                const printFrame = window.open(frame.url, frame.target, frame.feature);
                documentBuilder.rebuild(printFrame);
                documentBuilder.addStyles(printFrame, [
                  '/styles/markdown-pages.css',
            Severity: Minor
            Found in sashimi-webapp/src/logic/inputHandler/DocumentPrinter/core.js - About 1 hr to fix

              Function hideShowInline has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function getReferenceFrame has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                PageRenderer.prototype.getReferenceFrame = function getReferenceFrame() {
                  const idOfReferenceFrame = defaultConfig.prefix.reference + this.renderDomId;
                  let referenceFrame = this.ownerDocument.getElementById(idOfReferenceFrame);
                
                  // Create a new reference frame if doesn't exist
                Severity: Minor
                Found in sashimi-webapp/src/logic/renderer/index.js - About 1 hr to fix

                  Function toggleEditorViewerView has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function toggleEditorViewerView(browser, component) {
                    const devServer = browser.globals.devServerURL;
                  
                    browser.url(`${devServer}/content`);
                    browser.expect.element('#app').to.be.visible.before(5000);

                    Function createNewFile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function createNewFile(organizationId, filePath, folderId, newFileId, newFileName) {
                      return new Promise((resolve, reject) => {
                        const currentDateTime = dateTime.getCurrentLongTime();
                    
                        const fileOrganizationId = organizationId;
                    Severity: Minor
                    Found in sashimi-webapp/src/database/data-modifier/dataAdd.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                            if (state.src.charCodeAt(pos) === 61  /* = */&&
                            state.src.charCodeAt(pos + 1) === 61  /* = */&&
                            state.src.charCodeAt(pos + 2) === 62 /* > */ &&
                            state.src.charCodeAt(pos + 3) === 104 /* h */ &&
                            state.src.charCodeAt(pos + 4) === 105 /* i */ &&
                        Severity
                        Category
                        Status
                        Source
                        Language