wopian/tracker-killer

View on GitHub

Showing 17 of 17 total issues

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

  async updateAnime (ID) {
    await client.updateAnime(ID, options.anime)
      .then(res => {
        this.log(ID, res, lastAction, 'trace', ++this.requests)
      })
Severity: Major
Found in src/api/myanimelist.js and 1 other location - About 6 hrs to fix
src/api/myanimelist.js on lines 122..134

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 157.

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

  async updateManga (ID) {
    await client.updateManga(ID, options.manga)
      .then(res => {
        this.log(ID, res, lastAction, 'trace', ++this.requests)
      })
Severity: Major
Found in src/api/myanimelist.js and 1 other location - About 6 hrs to fix
src/api/myanimelist.js on lines 96..108

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 157.

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

  async addManga (ID) {
    await client.addManga(ID, options.manga)
      .then(res => {
        this.log(ID, res, lastAction, 'trace', ++this.requests)
      })
Severity: Major
Found in src/api/myanimelist.js and 1 other location - About 4 hrs to fix
src/api/myanimelist.js on lines 84..94

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 120.

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

  async addAnime (ID) {
    await client.addAnime(ID, options.anime)
      .then(res => {
        this.log(ID, res, lastAction, 'trace', ++this.requests)
      })
Severity: Major
Found in src/api/myanimelist.js and 1 other location - About 4 hrs to fix
src/api/myanimelist.js on lines 110..120

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 120.

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

  async log (ID = '', action = '', last, level = 'info', requests = this.requests, err = '') {
    logFile(level, 'Kitsu', this.type, ID, action, err, requests)
    this.ondata(logList(ID, action, last, requests))
    lastAction = moment()
  }
Severity: Major
Found in src/api/kitsu.js and 1 other location - About 2 hrs to fix
src/api/myanimelist.js on lines 50..54

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 83.

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

  async log (ID = '', action = '', last, level = 'info', requests = this.requests, err = '') {
    logFile(level, 'MyAnimeList', this.type, ID, action, err, requests)
    this.ondata(logList(ID, action, last, requests))
    lastAction = moment()
  }
Severity: Major
Found in src/api/myanimelist.js and 1 other location - About 2 hrs to fix
src/api/kitsu.js on lines 24..28

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 83.

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 addLibraryEntry has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  async addLibraryEntry (media) {
    for (let mediaEntry in await media) {
      try {
        await api.post('libraryEntries', {
          media: { type: this.type, id: media[mediaEntry].id },
Severity: Minor
Found in src/api/kitsu.js - 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

Consider simplifying this complex logical expression.
Open

    if (!KITSU.USERNAME || KITSU.USERNAME === 'yourUsername' ||
        !KITSU.PASSWORD || KITSU.PASSWORD === 'yourPassword' ||
        !KITSU.CLIENT_ID || KITSU.CLIENT_ID === 'yourClientID' ||
        !KITSU.CLIENT_SECRET || KITSU.CLIENT_SECRET === 'yourClientSecret') {
      console.log('\nKitsu needs some user info to authorise\n\n' +
Severity: Critical
Found in src/api/kitsu.js - About 1 hr to fix

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

    export default function anilist (service, type) {
      top(service, type, ANILIST.username)
    
      const clientId = ANILIST.client_id
      const clientSecret = ANILIST.client_secret
    Severity: Minor
    Found in src/api/anilist.js - About 1 hr to fix

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

        async setup (ID) {
          try {
            // Prevent service from running if token hasn't been set
            if (!ANNICT.PERSONAL_TOKEN || ANNICT.PERSONAL_TOKEN === 'yourPersonalToken') {
              console.log('\nAnnict needs a personal access token to authorise.\n\n' +
      Severity: Minor
      Found in src/api/annict.js - 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

      Lists should be surrounded by blank lines
      Open

      Severity: Info
      Found in README.md by markdownlint

      MD032 - Lists should be surrounded by blank lines

      Tags: bullet, ul, ol, blank_lines

      Aliases: blanks-around-lists

      This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

      Some text
      * Some
      * List
      
      1. Some
      2. List
      Some text

      To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      * Some
      * List
      
      1. Some
      2. List
      
      Some text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

      Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

      * This is
      not okay
      
      * This is
        okay

      Code block style
      Open

      Severity: Info
      Found in README.md by markdownlint

      Code block style
      Open

      Severity: Info
      Found in README.md by markdownlint

      Line length
      Open

      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Code block style
      Open

      Severity: Info
      Found in README.md by markdownlint

      Line length
      Open

      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Code block style
      Open

      Severity: Info
      Found in README.md by markdownlint
      Severity
      Category
      Status
      Source
      Language