Showing 18 of 39 total issues

File geo.ts has 756 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const statesOrProvinces = {

  SIB: 'Siberia',
  STP: 'Saint Petersburg',

Severity: Major
Found in src/output/db/udb/geo.ts - About 1 day to fix

    Function desc has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

      desc(record: UdbOutputRecord) {
        const ref = record.ref ? record.ref : ""
    
        const month = record.month
        const day = record.day
    Severity: Minor
    Found in src/output/db/udb/UdbTextRecordOutput.ts - About 2 hrs 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

    File flags.ts has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    export class Flags {
      /**
       * Location of the OBSERVER.
       * @type {{MAP: string, GND: string, CST: string, SEA: string, AIR: string, MIL: string, CIV: string, HQO: string}}
       */
    Severity: Minor
    Found in src/output/db/udb/flags.ts - About 2 hrs to fix

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

        desc(record: UdbOutputRecord) {
          const ref = record.ref ? record.ref : ""
      
          const month = record.month
          const day = record.day
      Severity: Major
      Found in src/output/db/udb/UdbTextRecordOutput.ts - About 2 hrs to fix

        Function read has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          read(filePos: number, recordIndex?: number): UdbInputRecord {
            const record = <UdbInputRecord>super.read(filePos, recordIndex);
        
            this.readSignedInt('year');
            this.readNibbles('unknownLocale', 'locale');
        Severity: Major
        Found in src/input/db/udb/UdbRecordReader.ts - About 2 hrs to fix

          Function execute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            async execute(matchCriteria: string, firstIndex: number, maxCount: number, format: boolean = true,
                          allowEmpty: boolean = true): Promise<void> {
              this.logger.logVerbose(`Querying...`)
              const processingStart = Date.now()
              const recordEnumerator: RecordEnumerator = this.input.recordEnumerator(firstIndex, maxCount)
          Severity: Minor
          Found in src/Query.ts - About 2 hrs 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 constructor has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            constructor(private criteria = '', private allowEmpty = true) {
              const andCriterions = criteria.split('&');
              for (let a = 0; a < andCriterions.length; ++a) {
                let type: string = 'and';
                const andCriterion = andCriterions[a];
          Severity: Minor
          Found in src/match.ts - About 1 hr 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 execute has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async execute(matchCriteria: string, firstIndex: number, maxCount: number, format: boolean = true,
                          allowEmpty: boolean = true): Promise<void> {
              this.logger.logVerbose(`Querying...`)
              const processingStart = Date.now()
              const recordEnumerator: RecordEnumerator = this.input.recordEnumerator(firstIndex, maxCount)
          Severity: Minor
          Found in src/Query.ts - About 1 hr to fix

            Function start has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              start() {
                const rl = readline.createInterface({input: process.stdin, output: process.stdout})
                rl.setPrompt("udb> ")
                rl.prompt()
            
            
            Severity: Minor
            Found in src/Interactive.ts - About 1 hr to fix

              Function formatData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                formatData(rec: UdbInputRecord): UdbOutputRecord {
                  const record: UdbOutputRecord = <UdbOutputRecord>Util.copy(rec);
                  let continent = Geo.getContinent(rec.continentCode);
                  if (continent) {
                    record.continent = continent.name;
              Severity: Minor
              Found in src/output/db/udb/UdbRecordFormatter.ts - About 1 hr to fix

                Function open has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  open(sourcesReader: ReadInterface): Promise<void> {
                    return new Promise((resolve, reject) => {
                      sourcesReader
                        .on("line", line => {
                          switch (line.charAt(0)) {
                Severity: Minor
                Found in src/input/db/udb/Sources.ts - About 1 hr to fix

                  Function getLinks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    getLinks(pageContents: WebRecord, linkCheck: LinkCheck): string[] {
                      const reports = [];
                      let pos = 0;
                      let reportLinkStart;
                      let done = 0;
                  Severity: Minor
                  Found in src/input/WebInput.ts - About 55 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 formatProperties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    formatProperties(record: UdbInputRecord): UdbOutputRecord {
                      delete record.unknownMonth;
                      delete record.unknownLocale;
                      delete record.refIndexHigh;
                      delete record.ymdt;
                  Severity: Minor
                  Found in src/output/db/udb/UdbRecordFormatter.ts - About 55 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 fetch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private fetch(reject) {
                      let remaining = this.queue.length > 0 || this.reading > 0;
                      if (remaining) {
                        if (this.queue.length > 0 && this.reading <= this.maxConcurrent) {
                          let read = this.queue.shift();
                  Severity: Minor
                  Found in src/input/WebInput.ts - About 55 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 formatProperties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    formatProperties(record: NuforcInputRecord): NuforcOutputRecord {
                      let expectedKeysOrder = ["source", "occurred", "entered", "reported", "posted", "location", "shape", "duration", "desc"]
                      let sortedRecord: NuforcOutputRecord = <NuforcOutputRecord>Util.sortProps(record, (prop1, prop2) => {
                        let index1 = expectedKeysOrder.indexOf(prop1);
                        if (index1 < 0) index1 = 1000;
                  Severity: Minor
                  Found in src/output/db/nuforc/NuforcRecordFormatter.ts - About 55 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 getStateOrProvince has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    static getStateOrProvince(country, record) {
                      let stateOrProvinceKey = record.stateOrProvince;
                      let end;
                      let found;
                      do {
                  Severity: Minor
                  Found in src/output/db/udb/geo.ts - 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 getDay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    static getDay(record, padding = false) {
                      const dayAccuracy = (record.ymdt >> 2) & 0b11;
                      let day = padding ? (record.day > 31 ? '--' : (record.day < 10 ? '0' : '') + record.day) : record.day;
                      return Time.accuracy(day, dayAccuracy, padding);
                    }
                  Severity: Minor
                  Found in src/output/db/udb/time.ts - 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 ddToDms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    static ddToDms(lat: number, lng: number) {
                      let latResult = Geo.getDms(lat) + ' ';
                      latResult += !lat ? 'Q' : lat > 0 ? 'N' : 'S';
                  
                      let lngResult = Geo.getDms(lng) + ' ';
                  Severity: Minor
                  Found in src/output/db/udb/geo.ts - 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