mrgodhani/raven-reader

View on GitHub

Showing 218 of 218 total issues

mutations has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

const mutations = {
  LOAD_SETTINGS (state) {
    const settings = JSON.parse(JSON.stringify(electronstore.getSettings()))
    if (settings.fever_creds) {
      settings.fever = JSON.parse(settings.fever)
Severity: Minor
Found in src/store/modules/Setting.js - About 3 hrs to fix

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

          if (diff.length > 0) {
            const deleteFeed = currentSubscriptions.filter((x) => diff.includes(x.xmlurl))
            deleteFeed.forEach(async (item) => {
              await db.deleteArticles(item.uuid)
              await db.deleteFeed(item.uuid)
    Severity: Major
    Found in src/services/feedbin.js and 2 other locations - About 3 hrs to fix
    src/services/fever.js on lines 132..138
    src/services/greader.js on lines 197..203

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

    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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

          if (diff.length > 0) {
            const deleteFeed = currentSubscriptions.filter((x) => diff.includes(x.xmlurl))
            deleteFeed.forEach(async (item) => {
              await db.deleteArticles(item.uuid)
              await db.deleteFeed(item.uuid)
    Severity: Major
    Found in src/services/fever.js and 2 other locations - About 3 hrs to fix
    src/services/feedbin.js on lines 116..122
    src/services/greader.js on lines 197..203

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

    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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

          if (diff.length > 0) {
            const deleteFeed = currentSubscriptions.filter((x) => diff.includes(x.xmlurl))
            deleteFeed.forEach(async (item) => {
              await db.deleteArticles(item.uuid)
              await db.deleteFeed(item.uuid)
    Severity: Major
    Found in src/services/greader.js and 2 other locations - About 3 hrs to fix
    src/services/feedbin.js on lines 116..122
    src/services/fever.js on lines 132..138

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

    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

    File Setting.js has 290 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const state = {
      pocket_connected: false,
      pocket: null,
      inoreader: null,
      instapaper_connected: false,
    Severity: Minor
    Found in src/store/modules/Setting.js - About 2 hrs to fix

      File greader.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import dayjs from 'dayjs'
      import db from './db.js'
      import uuidstring from 'uuid-by-string'
      import * as database from '../db'
      import truncate from './truncate'
      Severity: Minor
      Found in src/services/greader.js - About 2 hrs to fix

        Function createWindow has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function createWindow () {
          // Create the browser window.
          win = new BrowserWindow({
            minWidth: 1280,
            minHeight: 720,
        Severity: Major
        Found in src/background.js - About 2 hrs to fix

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              const chunks = ids.reduce((resultArray, item, index) => {
                const chunkIndex = Math.floor(index / perChunk)
          
                if (!resultArray[chunkIndex]) {
                  resultArray[chunkIndex] = [] // start a new chunk
          Severity: Major
          Found in src/services/greader.js and 2 other locations - About 2 hrs to fix
          src/services/feedbin.js on lines 35..45
          src/services/fever.js on lines 44..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 89.

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              const chunks = ids.reduce((resultArray, item, index) => {
                const chunkIndex = Math.floor(index / perChunk)
          
                if (!resultArray[chunkIndex]) {
                  resultArray[chunkIndex] = [] // start a new chunk
          Severity: Major
          Found in src/services/fever.js and 2 other locations - About 2 hrs to fix
          src/services/feedbin.js on lines 35..45
          src/services/greader.js on lines 107..117

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

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              const chunks = ids.reduce((resultArray, item, index) => {
                const chunkIndex = Math.floor(index / perChunk)
          
                if (!resultArray[chunkIndex]) {
                  resultArray[chunkIndex] = [] // start a new chunk
          Severity: Major
          Found in src/services/feedbin.js and 2 other locations - About 2 hrs to fix
          src/services/fever.js on lines 44..54
          src/services/greader.js on lines 107..117

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

          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

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

              switch (type) {
                case 'READ':
                  postData.append('a', TAGS.READ_TAG)
                  break
                case 'UNREAD':
          Severity: Major
          Found in src/services/greader.js and 1 other location - About 2 hrs to fix
          src/services/inoreader.js on lines 162..175

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

          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

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

              switch (type) {
                case 'READ':
                  postData.append('a', TAGS.READ_TAG)
                  break
                case 'UNREAD':
          Severity: Major
          Found in src/services/inoreader.js and 1 other location - About 2 hrs to fix
          src/services/greader.js on lines 140..153

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

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

          export function ParseFeedPost (feed) {
            const feeditems = JSON.parse(JSON.stringify(feed))
            const posts = feeditems.posts.map((item) => {
              const podcast = checkIsPodCast(item)
              const articleLink = item.link ?? feed.meta.xmlurl ?? Math.random().toString(36).substring(7)
          Severity: Minor
          Found in src/parsers/feed.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

          File Article.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import db from '../../services/db'
          import helper from '../../services/helpers'
          import dayjs from 'dayjs'
          import advanced from 'dayjs/plugin/advancedFormat'
          import timezone from 'dayjs/plugin/timezone'
          Severity: Minor
          Found in src/store/modules/Article.js - About 2 hrs to fix

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

                    const transformedEntries = JSON.parse(JSON.stringify(entries)).filter((item) => {
                      const feed = subscriptions.filter(feed => feed.id === item.origin.streamId)[0]
                      return typeof feed !== 'undefined'
                    }).map((item) => {
                      const itemId = item.id.split('/')
            Severity: Major
            Found in src/services/inoreader.js and 1 other location - About 2 hrs to fix
            src/services/greader.js on lines 229..277

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

            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 3 locations. Consider refactoring.
            Open

              async getSubscriptions (credsData) {
                try {
                  const subscriptions = await window.fever.post(`${credsData.endpoint}?api&feeds`, credsData.hash)
                  return subscriptions.feeds
                } catch (e) {
            Severity: Major
            Found in src/services/fever.js and 2 other locations - About 2 hrs to fix
            src/services/fever.js on lines 25..32
            src/services/fever.js on lines 33..40

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

            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

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

                    const transformedEntries = JSON.parse(JSON.stringify(entries)).filter((item) => {
                      const feed = subscriptions.filter(feed => feed.id === item.origin.streamId)[0]
                      return typeof feed !== 'undefined'
                    }).map((item) => {
                      const itemId = item.id.split('/')
            Severity: Major
            Found in src/services/greader.js and 1 other location - About 2 hrs to fix
            src/services/inoreader.js on lines 249..297

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

            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 3 locations. Consider refactoring.
            Open

              async getUnreadIds (credsData) {
                try {
                  const unread = await window.fever.post(`${credsData.endpoint}?api&unread_item_ids`, credsData.hash)
                  return unread.unread_item_ids
                } catch (e) {
            Severity: Major
            Found in src/services/fever.js and 2 other locations - About 2 hrs to fix
            src/services/fever.js on lines 17..24
            src/services/fever.js on lines 33..40

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

            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 3 locations. Consider refactoring.
            Open

              async getStarredIds (credsData) {
                try {
                  const starred = await window.fever.post(`${credsData.endpoint}?api&saved_item_ids`, credsData.hash)
                  return starred.saved_item_ids
                } catch (e) {
            Severity: Major
            Found in src/services/fever.js and 2 other locations - About 2 hrs to fix
            src/services/fever.js on lines 17..24
            src/services/fever.js on lines 25..32

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

            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 subscribe has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              subscribe (feeds, category = null, refresh = false, importData = false) {
                const items = feeds.map(async (feed) => {
                  let url
            
                  if (!importData) {
            Severity: Major
            Found in src/services/helpers.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language