jdalrymple/html-to-latex

View on GitHub

Showing 5 of 5 total issues

File convert.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { directory } from 'tempy';
import { pathExists, remove, readFile } from 'fs-extra';
import { resolve } from 'path';
import ShortId from 'shortid';
import { convertText, exportFile, convertFile } from '../../src/convert';
Severity: Minor
Found in test/unit/convert.js - About 4 hrs to fix

    File convert.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { parseFragment } from 'parse5';
    import { decodeHTML } from 'entities';
    import { outputFile, readFile, pathExists, ensureDir } from 'fs-extra';
    import { resolve, basename, join, dirname, extname } from 'path';
    import { stream } from 'got';
    Severity: Minor
    Found in src/convert.js - About 2 hrs to fix

      Function setup has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          setup: (args) => {
            args
              .positional('[--ifp] <input-file>', {
                type: 'string',
              })
      Severity: Major
      Found in src/bin.js - About 2 hrs to fix

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

        async function convertImage(
          node,
          {
            compilationDir,
            autoGenImageNames = true,
        Severity: Minor
        Found in src/convert.js - 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 image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export function image(path, { width, height, keepRatio, center } = { center: true }) {
          const line = ['\\includegraphics'];
          const options = [];
        
          if (width) options.push(`width=${width}`);
        Severity: Minor
        Found in src/templates.js - 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