k13-engineering/node-elf-file

View on GitHub

Showing 9 of 40 total issues

File section.js has 366 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable camelcase */

import assert from "assert";
import util from "../util.js";
import strtab from "../strtab.js";
Severity: Minor
Found in lib/analyze/section.js - About 4 hrs to fix

    Function create has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const create = (buf, endianness) => {
      const delegate = (name) => {
        return buf[name].bind(buf);
      };
    
    
    Severity: Major
    Found in lib/buffer.js - About 2 hrs to fix

      Function layout has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const layout = (data) => {
        const structure = structureFactory.create({ "ei_class": data.file.ei_class, "ei_data": data.file.ei_data });
      
        const { e_ehsize } = prepareFileHeader({ data, structure });
        const { e_phentsize, e_phnum } = prepareProgramHeader({ data, structure });
      Severity: Minor
      Found in lib/layout.js - About 2 hrs to fix

        Function parse has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const parse = (raw) => {
          /* eslint-disable camelcase */
          const { ei_class, ei_data } = identify(raw);
        
          const structure = strucureFactory.create({ ei_class, ei_data });
        Severity: Minor
        Found in lib/elf.js - About 1 hr to fix

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

              const format = (data) => {
                let result = Buffer.alloc(length);
          
                Object.keys(defs).forEach((field) => {
                  const def = defs[field];
          Severity: Minor
          Found in lib/parser.js - About 1 hr to fix

            Function finder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            const finder = ({ data }) => {
              let chunks = [];
              return {
                "process": (offset, size) => {
                  const overlap = chunks.find((chunk) => {
            Severity: Minor
            Found in lib/chunks.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

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

            const create = (buf, endianness) => {
              const delegate = (name) => {
                return buf[name].bind(buf);
              };
            
            
            Severity: Minor
            Found in lib/buffer.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              "create": (defs, { endianness }) => {
                const read = (data, field) => {
                  const def = defs[field];
            
                  let value;
            Severity: Minor
            Found in lib/parser.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            const parse = (raw) => {
              /* eslint-disable camelcase */
              const { ei_class, ei_data } = identify(raw);
            
              const structure = strucureFactory.create({ ei_class, ei_data });
            Severity: Minor
            Found in lib/elf.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