mrgodhani/raven-reader

View on GitHub
src/services/feedbin.js

Summary

Maintainability
F
3 days
Test Coverage

Function syncItems has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async syncItems (feedbinCreds) {
    let subscriptions = await this.getSubscriptions(feedbinCreds)
    const unreadList = await this.getUnreadEntries(feedbinCreds)
    const starredList = await this.getStarredEntries(feedbinCreds)
    const entries = this.transformEntriesAndFeed(unreadList, starredList, await this.getEntries(feedbinCreds, unreadList))
Severity: Major
Found in src/services/feedbin.js - About 3 hrs to fix

    Function transformedEntries has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            const transformedEntries = JSON.parse(JSON.stringify(entries)).map((item) => {
              const isMedia = item.url.includes('youtube') || item.url.includes('vimeo')
              return {
                id: item.enclosure ? uuidstring(item.enclosure.enclosure_url) : uuidstring(item.url),
                uuid: item.enclosure ? uuidstring(item.enclosure.enclosure_url) : uuidstring(item.url),
    Severity: Minor
    Found in src/services/feedbin.js - About 1 hr to fix

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

        async markItem (feedbinCreds, type, ids) {
          let data, url
          switch (type) {
            case 'READ':
              url = 'unread_entries/delete'
      Severity: Minor
      Found in src/services/feedbin.js - About 1 hr to fix

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

                currentArticles.then((res) => {
                  const markRead = res.filter(item => !unreadList.includes(item.articles.source_id)).map(item => item.articles.uuid)
                  const markUnFavourite = res.filter(item => !starredList.includes(item.articles.source_id)).map(item => item.articles.uuid)
                  const markFavourite = res.filter(item => starredList.includes(item.articles.source_id)).map(item => item.articles.uuid)
                  db.markAllRead(markRead)
        Severity: Major
        Found in src/services/feedbin.js and 2 other locations - About 1 day to fix
        src/services/greader.js on lines 280..287
        src/services/inoreader.js on lines 300..307

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

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

        function getCoverImage (postContent) {
          const dom = new DOMParser()
          const doc = dom.parseFromString(postContent, 'text/html')
          const image = doc.querySelector('img')
          if (image !== null && typeof image.getAttribute('src') !== 'undefined' && image.getAttribute('src').startsWith('https://')) {
        Severity: Major
        Found in src/services/feedbin.js and 4 other locations - About 4 hrs to fix
        src/parsers/feed.js on lines 100..108
        src/services/fever.js on lines 6..14
        src/services/greader.js on lines 23..31
        src/services/inoreader.js on lines 30..38

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

        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/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

            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

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

          async getUnreadEntries (feedbinCreds) {
            const unreads = await window.feedbin.fetch(`${feedbinCreds.endpoint}unread_entries.json`, feedbinCreds)
            return unreads
          },
        Severity: Minor
        Found in src/services/feedbin.js and 1 other location - About 35 mins to fix
        src/services/feedbin.js on lines 60..63

        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

          async getStarredEntries (feedbinCreds) {
            const starred = await window.feedbin.fetch(`${feedbinCreds.endpoint}starred_entries.json`, feedbinCreds)
            return starred
          },
        Severity: Minor
        Found in src/services/feedbin.js and 1 other location - About 35 mins to fix
        src/services/feedbin.js on lines 56..59

        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

        There are no issues that match your filters.

        Category
        Status