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: {
Function extract
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
extract(): this {
let foundPreTag = false;
let spot: SpotInfo = {
name: '',
coordinates: {
- 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 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) => ({
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);
}
- 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 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],
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) => {
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 = '';
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);
}
- 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 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)
- 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"