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";
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);
};
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 });
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 });
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];
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) => {
- Read upRead up
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);
};
- Read upRead up
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;
- Read upRead up
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 });
- Read upRead up
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"