samuele-cozzi/obsidian-marp-slides

View on GitHub

Showing 5 of 19 total issues

Function export has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    async export(file: TFile, type: string){
        const filesTool = new FilePath(this.settings);
        await filesTool.removeFileFromRoot(file);
        await filesTool.copyFileToRoot(file);
        const completeFilePath = filesTool.getCompleteFilePath(file);
Severity: Minor
Found in src/utilities/marpExport.ts - 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 export has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async export(file: TFile, type: string){
        const filesTool = new FilePath(this.settings);
        await filesTool.removeFileFromRoot(file);
        await filesTool.copyFileToRoot(file);
        const completeFilePath = filesTool.getCompleteFilePath(file);
Severity: Major
Found in src/utilities/marpExport.ts - About 2 hrs to fix

    Function loadLibs has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        loadLibs(app: App){
            const libPathUtility = new FilePath(this.settings);
            const libPath = libPathUtility.getLibDirectory(app.vault);
    
            if (!existsSync(libPath)) {
    Severity: Minor
    Found in src/utilities/libs.ts - About 1 hr to fix

      Function run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private async run(argv: string[], resourcesPath: string){
              const { CHROME_PATH } = process.env;
      
              try {
                  process.env.CHROME_PATH = this.settings.CHROME_PATH || CHROME_PATH;
      Severity: Minor
      Found in src/utilities/marpExport.ts - About 45 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 onTrigger has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          onTrigger(cursor: EditorPosition, editor: Editor, file: TFile): EditorSuggestTriggerInfo | null {
              //console.log("line: " + cursor.line);
              //console.log("ch: " + cursor.ch);
              //console.log("value: " + editor.getValue());
              
      Severity: Minor
      Found in src/main.ts - About 35 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