Fiszcz/OLX-flats-notificator

View on GitHub

Showing 690 of 690 total issues

Function getTextOfLocation has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const getTextOfLocation = (textWithLocation: string) => {
    let wordsCount = 0,
        isSpaceBetweenWords = false,
        lengthOfWord = 0,
        addressStringLength = 0;
Severity: Minor
Found in src/LocationFinder/LocationFinder.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 message has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public get message(): string {
        return (
            '<div align="center">' +
                `<H2>${this.subject}</H2>` +
                '\n' +
Severity: Minor
Found in src/EmailMessage/EmailMessage.ts - About 1 hr to fix

    Function checkTransportTime has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const checkTransportTime = async (flatLocation: string): Promise<TransportInformation[]> => {
        const flatLocationForAPI = flatLocation.split(' ').join('+');
        const requests = transportDestinations.map(destination =>
            axios
                .get<DirectionsResult>(getGoogleMapsAPIUrlRequest(flatLocationForAPI, destination.locationToAPI))
    Severity: Minor
    Found in src/TransportConnection/TransportConnection.ts - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  if (this.shouldComposeIteration) {
                      const title = `😃 Good advertisements - (${this.emailMessages.length} ads)`;
                      this.emailService.sendEmails([composeEmailMessages([...this.emailMessages], title)]);
                  } else {
                      this.emailService.sendEmails([...this.emailMessages]);
      Severity: Major
      Found in src/OLXNotifier.ts and 1 other location - About 1 hr to fix
      src/OLXNotifier.ts on lines 71..74

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 58.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if (this.isWorseAdvertisementsAcceptable && this.emailMessagesForWorseAdvertisements.length) {
                  const title = `💩 Worse advertisements - (${this.emailMessagesForWorseAdvertisements.length} ads)`;
                  this.emailService.sendEmails([composeEmailMessages([...this.emailMessagesForWorseAdvertisements], title)]);
              }
      Severity: Major
      Found in src/OLXNotifier.ts and 1 other location - About 1 hr to fix
      src/OLXNotifier.ts on lines 77..82

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 58.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function getTextOfLocation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const getTextOfLocation = (textWithLocation: string) => {
          let wordsCount = 0,
              isSpaceBetweenWords = false,
              lengthOfWord = 0,
              addressStringLength = 0;
      Severity: Minor
      Found in src/LocationFinder/LocationFinder.ts - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if (this.description === undefined)
                    console.warn('Cannot find description of open advertisement: ' + this.title + '\nWith address: ' + this.href + '\n');
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts and 1 other location - About 35 mins to fix
        src/Advertisement/Advertisement.ts on lines 85..86

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if (this._location === undefined)
                    console.warn('Cannot find location of flat in open advertisement: ' + this.title + '\nWith address: ' + this.href + '\n');
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts and 1 other location - About 35 mins to fix
        src/Advertisement/Advertisement.ts on lines 83..84

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Expected linebreak to be 'CRLF'
        Open

        import { websiteSelectors } from '../../config/websiteSelectors';
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

        
        
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

            private readonly maxPriceWithRent?: number;
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

            private _price?: number;
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

            private _location?: string;
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

                this.maxPriceWithRent = maxPriceWithRent;
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

                    console.error('Cannot find time of advertisement!');
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

            };
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

            private getLocationFromOtodomAdvertisement = async () => {
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

                    await this.advertisementPage.screenshot({ path: this.screenshotPath, fullPage: true });
        Severity: Minor
        Found in src/Advertisement/Advertisement.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

                this.departureTime.setMinutes(this.minutes);
        Severity: Minor
        Found in src/DepartureTime/DepartureTime.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Expected linebreak to be 'CRLF'
        Open

        }
        Severity: Minor
        Found in src/DepartureTime/DepartureTime.ts by tslint

        Rule: linebreak-style

        Enforces a consistent linebreak style.

        Notes
        • Has Fix

        Config

        One of the following options must be provided:

        • "LF" requires LF (\n) linebreaks
        • "CRLF" requires CRLF (\r\n) linebreaks
        Examples
        "linebreak-style": true,LF
        "linebreak-style": true,CRLF
        Schema
        {
          "type": "string",
          "enum": [
            "LF",
            "CRLF"
          ]
        }

        For more information see this page.

        Severity
        Category
        Status
        Source
        Language