AlexAegis/advent-of-code

View on GitHub

Showing 28 of 422 total issues

Interval has 70 functions (exceeds 20 allowed). Consider refactoring.
Open

export class Interval implements IntervalLike, IntervalQualifier {
    low: number;
    high: number;
    /**
     * @default 'open'
Severity: Major
Found in solutions/typescript/libs/lib/src/math/common/interval.class.ts - About 1 day to fix

    File letter-matrix.const.ts has 596 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { NEWLINE } from '../../regex/index.js';
    
    export type SmallLetterMatrixAlphabet = (typeof UPPERCASE_ALPHABET)[number];
    type RowRenderedLetter = string[];
    export type RowRenderedAlphaBet = Record<SmallLetterMatrixAlphabet, RowRenderedLetter>;

      BoundingBox has 61 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class BoundingBox {
          /**
           * from left to right
           */
          horizontal: Interval = Interval.EMPTY;
      Severity: Major
      Found in solutions/typescript/libs/lib/src/model/vector/bounding-box.class.ts - About 1 day to fix

        File interval.class.ts has 517 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Vec2 } from '../../model/vector/vec2.class.js';
        import type { Vec2Like, Vec2String } from '../../model/vector/vec2.class.types.js';
        
        export interface IntervalLike extends Partial<IntervalQualifier> {
            low: number;
        Severity: Major
        Found in solutions/typescript/libs/lib/src/math/common/interval.class.ts - About 1 day to fix

          File bounding-box.class.ts has 424 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Direction, Interval, max } from '../../index.js';
          import { Vec2 } from './vec2.class.js';
          import type { Vec2Like } from './vec2.class.types.js';
          
          export type BoundingBoxCorner = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
          Severity: Minor
          Found in solutions/typescript/libs/lib/src/model/vector/bounding-box.class.ts - About 6 hrs to fix

            IntCodeComputer has 33 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class IntCodeComputer implements Iterable<number | undefined> {
                public tape: Map<number, number>;
                public cursor = 0;
                public relBase = 0;
                private halt = false;
            Severity: Minor
            Found in solutions/typescript/libs/intcode/src/intcode/intcode.class.ts - About 4 hrs to fix

              Function addCameraFollowSystem has a Cognitive Complexity of 53 (exceeds 30 allowed). Consider refactoring.
              Open

              export const addCameraFollowSystem = (gridWorld: GridWorld): void => {
                  gridWorld.addSystem((world) => {
                      const camera = world.query(CameraComponent)[0]?.[1];
                      // IO-less worlds have no camera
                      if (!camera) {

              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 calculateVariations has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const calculateVariations = (
                  state: State,
                  cache: Map<string, number> = new Map(),
              ): number => {
                  const key = `${state.remainingCriteria.join(',')};${state.remainingDamagedLog};${state.remainingDamagedLog};${state.currentOriginalCriteria};${state.currentCriteria}`;
              Severity: Major
              Found in solutions/typescript/2023/12/src/parse.ts - About 3 hrs to fix

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

                export const parse = (input: string): Card => {
                    let parsing: ParseableData = ParseableData.SEEDS;
                    let seeds: number[] = [];
                    const seedToSoilMap: Range[] = [];
                    const soilToFertilizerMap: Range[] = [];
                Severity: Major
                Found in solutions/typescript/2023/05/src/parse.ts - About 2 hrs to fix

                  PairTree has 24 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export class PairTree<T = number> {
                      public parent?: PairTree<T> | undefined;
                      public parentSide?: PairSide | undefined;
                      public leftTree?: PairTree<T> | undefined;
                      public leftValue?: T | undefined;
                  Severity: Minor
                  Found in solutions/typescript/libs/lib/src/model/tree/pair-tree.class.ts - About 2 hrs to fix

                    Function addCameraFollowSystem has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const addCameraFollowSystem = (gridWorld: GridWorld): void => {
                        gridWorld.addSystem((world) => {
                            const camera = world.query(CameraComponent)[0]?.[1];
                            // IO-less worlds have no camera
                            if (!camera) {

                      LeafonlyBinaryTree has 21 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export class LeafonlyBinaryTree<T = number> {
                          public parent?: LeafonlyBinaryTree<T> | undefined;
                          public parentSide?: BinarySide | undefined;
                          public leftTree?: LeafonlyBinaryTree<T> | undefined;
                          public leftValue?: T | undefined;

                        Function dijkstra has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const dijkstra = <
                            T extends ToString,
                            Dir extends ToString,
                            N extends BasicGraphNode<T, Dir>,
                        >(
                        Severity: Major
                        Found in solutions/typescript/libs/lib/src/pathfinding/dijkstra.ts - About 2 hrs to fix

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

                          export const parse = (input: string): { monkeyMap: Record<number, Monkey>; monkeys: Monkey[] } => {
                              const lines = split(input, true);
                              const monkeyMap: Record<number, Monkey> = {};
                          
                              const monkeyIdMatcher = /^Monkey (\d+):$/;
                          Severity: Minor
                          Found in solutions/typescript/2022/11/src/parse.function.ts - About 1 hr to fix

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

                                public *[Symbol.iterator](): IterableIterator<number | undefined> {
                                    do {
                                        const v = this.tape.get(this.cursor) ?? 0;
                                        const i = toInstruction(v);
                                        switch (i) {
                            Severity: Minor
                            Found in solutions/typescript/libs/intcode/src/intcode/intcode.class.ts - About 1 hr to fix

                              Function mergeQualifiedNumbers has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  static mergeQualifiedNumbers(
                                      this: void,
                                      qualifiedNumbers: QualifiedNumber[],
                                      useSort = true,
                                  ): Interval[] {
                              Severity: Minor
                              Found in solutions/typescript/libs/lib/src/math/common/interval.class.ts - About 1 hr to fix

                                Function energizeMap has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const energizeMap = (gg: GridGraph, startingBeam: Beam): number => {
                                    let beams: Beam[] = [startingBeam];
                                    const beamPathHistory = new Map<string, Set<string>>();
                                    while (beams.length > 0) {
                                        const spawnedBeams: Beam[] = [];
                                Severity: Minor
                                Found in solutions/typescript/2023/16/src/internal/beam.ts - About 1 hr to fix

                                  Function compress has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public compress(rounds = 1, maxDistinctKeys = Number.POSITIVE_INFINITY): number[] {
                                          let p: string | undefined = this.tape[0];
                                          let result: number[] = [];
                                          let i = 0;
                                          let r = rounds;
                                  Severity: Minor
                                  Found in solutions/typescript/libs/lib/src/math/lz/lzw.class.ts - About 1 hr to fix

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

                                    export const parse = (input: string): TicketObservation => {
                                        const lines = split(input);
                                        const fieldRanges = new Map<string, Interval[]>();
                                        let myTicket: Ticket = [];
                                        const nearbyTickets: Ticket[] = [];
                                    Severity: Minor
                                    Found in solutions/typescript/2020/16/src/parse.function.ts - About 1 hr to fix

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

                                          init(): void {
                                              this.backend.onKeyPress((event, _modifier) => {
                                                  this.keyBuffer[event] = 1;
                                      
                                                  switch (event) {
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language