Showing 40 of 40 total issues
Function warToJson
has 224 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static warToJson(buffer: Buffer): JsonResult<Info> {
const result: Info = {
map: {
name: '',
author: '',
File InfoTranslator.ts
has 458 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { HexBuffer } from '../HexBuffer';
import { W3Buffer } from '../W3Buffer';
import { WarResult, JsonResult } from '../CommonInterfaces'
interface Map {
Function jsonToWar
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public static jsonToWar(infoJson: Info): WarResult {
const outBufferToWar = new HexBuffer();
outBufferToWar.addInt(31); // file version, 0x1F
outBufferToWar.addInt(infoJson.saves || 0);
- 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 jsonToWar
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static jsonToWar(infoJson: Info): WarResult {
const outBufferToWar = new HexBuffer();
outBufferToWar.addInt(31); // file version, 0x1F
outBufferToWar.addInt(infoJson.saves || 0);
Function warToJson
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static warToJson(buffer: Buffer): JsonResult<Terrain> {
// create buffer
const result: Terrain = {
tileset: '',
customTileset: false,
Function warToJson
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public static warToJson(type: string, buffer: Buffer): JsonResult<ObjectModificationTable> {
const result = { original: {}, custom: {} };
const outBufferToJSON = new W3Buffer(buffer);
const fileVersion = outBufferToJSON.readInt();
- 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 warToJson
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static warToJson(buffer: Buffer): JsonResult<Unit[]> {
const result = [];
const outBufferToJSON = new W3Buffer(buffer);
const fileId = outBufferToJSON.readChars(4), // W3do for doodad file
Function warToJson
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static warToJson(buffer: Buffer): JsonResult<Sound[]> {
const result = [];
const outBufferToJSON = new W3Buffer(buffer);
const fileVersion = outBufferToJSON.readInt(), // File version
Function jsonToWar
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static jsonToWar(terrainJson: Terrain): WarResult {
const outBufferToWar = new HexBuffer();
/*
* Header
Function jsonToWar
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static jsonToWar(type: string, json): WarResult {
const outBufferToWar = new HexBuffer();
/*
* Header
Function warToJson
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static warToJson(buffer: Buffer): JsonResult<Unit[]> {
const result = [];
const outBufferToJSON = new W3Buffer(buffer);
const fileId = outBufferToJSON.readChars(4), // W3do for doodad file
- 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 jsonToWar
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static jsonToWar(unitsJson: Unit[]): WarResult {
const outBufferToWar = new HexBuffer();
/*
* Header
Function warToJson
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static warToJson(buffer: Buffer): JsonResult<Doodad[]> {
const result = [];
const outBufferToJSON = new W3Buffer(buffer);
const fileId = outBufferToJSON.readChars(4); // W3do for doodad file
Function warToJson
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static warToJson(buffer: Buffer): JsonResult<Info> {
const result: Info = {
map: {
name: '',
author: '',
- 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 warToJson
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static warToJson(type: string, buffer: Buffer): JsonResult<ObjectModificationTable> {
const result = { original: {}, custom: {} };
const outBufferToJSON = new W3Buffer(buffer);
const fileVersion = outBufferToJSON.readInt();
Function jsonToWar
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static jsonToWar(soundsJson: Sound[]): WarResult {
const outBufferToWar = new HexBuffer();
/*
* Header
Function generateTableFromJson
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const generateTableFromJson = (tableType: TableType, tableData) => { // create "original" or "custom" table
Object.keys(tableData).forEach((defKey) => {
const obj = tableData[defKey];
// Original and new object ids
Function readModificationTable
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const readModificationTable = (isOriginalTable: boolean) => {
const numTableModifications = outBufferToJSON.readInt();
for (let i = 0; i < numTableModifications; i++) {
const objectDefinition = []; // object definition will store one or more modification objects
Function warToJson
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static warToJson(buffer: Buffer): JsonResult<Region[]> {
const result = [];
const outBufferToJSON = new W3Buffer(buffer);
const fileVersion = outBufferToJSON.readInt(), // File version
Function warToJson
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static warToJson(buffer: Buffer): JsonResult<Camera[]> {
const result = [];
const outBufferToJSON = new W3Buffer(buffer);
const fileVersion = outBufferToJSON.readInt(), // File version