wopian/tracker-killer

View on GitHub

Showing 4 of 17 total issues

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

      Severity
      Category
      Status
      Source
      Language