jeroentvb/wind-scrape

View on GitHub

Showing 9 of 15 total issues

Function extract has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

   extract(): this {
      let foundPreTag = false;
      let spot: SpotInfo = {
         name: '',
         coordinates: {
Severity: Major
Found in src/partials/data-parsers/windguru-parser.ts - About 2 hrs to fix

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

       extract(): this {
          let foundPreTag = false;
          let spot: SpotInfo = {
             name: '',
             coordinates: {
    Severity: Minor
    Found in src/partials/data-parsers/windguru-parser.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 parse has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

       parse(): this {
          this.parsedData = {
             name: this.extractedData.name,
             models: this.extractedData.models.map((model) => {
                const hours: WindyModelHour[] = model.time.map((hour, i) => ({
    Severity: Minor
    Found in src/partials/data-parsers/windy-parser.ts - About 1 hr to fix

      Function customWindguru has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

         static customWindguru(coordinates: any, credentials: any, model?: unknown) {
            if (!coordinates || !credentials) {
               throw new TypeError(WindguruErrors.NO_COORDINATES_OR_CREDENTIALS);
            }
      
      
      Severity: Minor
      Found in src/partials/utils/type-check.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 models has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

               models: this.extractedData.models.map((model) => {
                  const hours: WindyModelHour[] = model.time.map((hour, i) => ({
                     hour,
                     windspeed: model.windspeed[i],
                     windgust: model.windgust[i],
      Severity: Minor
      Found in src/partials/data-parsers/windy-parser.ts - About 1 hr to fix

        Function extract has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

           extract(): this {
              this.extractedData = {
                 name: 'Windy',
                 date: this.getDataArray(['.sticky-title-wrapper', '.td-days'], (el) => this.$(el).data('day')),
                 models: this.getDataArray(['.legend-left', '.legend-windCombined'], (el, i) => {
        Severity: Minor
        Found in src/partials/data-parsers/windy-parser.ts - About 1 hr to fix

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

             parse(): this {
                // Group the data by day
                const models = this.extractedData.models.map(model => {
                   const days: WindguruModelDay[] = [];
                   let currentDay = '';
          Severity: Minor
          Found in src/partials/data-parsers/windguru-parser.ts - About 1 hr to fix

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

               static windy(lat: unknown, lon: unknown) {
                  if (!lat || !lon) {
                     throw new Error(WindyErrors.NO_COORDINATES);
                  }
            
            
            Severity: Minor
            Found in src/partials/utils/type-check.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 getWindguru has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            async function getWindguru(url: string, custom = false): Promise<WindguruData> {
               const res = await fetch(url);
               const txt = await res.text();
            
               const windguru = new Windguru(txt)
            Severity: Minor
            Found in src/partials/windguru.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