mrgodhani/raven-reader

View on GitHub

Showing 218 of 218 total issues

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

  unassignFeeds (uuids) {
    return db.database.update(db.feedTable)
      .set(db.feedTable.category, null)
      .where(db.feedTable.uuid.in(uuids))
      .exec()
Severity: Major
Found in src/services/db.js and 1 other location - About 2 hrs to fix
src/services/db.js on lines 224..229

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

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

export function createFeedMenu (feeddata, window, i18nextMain) {
  const menu = new Menu()
  menu.append(
    new MenuItem({
      label: i18nextMain.t('Copy feed link'),
Severity: Major
Found in src/main/menu.js - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if (subscriptions) {
          const currentSubscriptions = await db.fetchServicesFeeds('greader')
          const currentFeedUrls = JSON.parse(JSON.stringify(currentSubscriptions)).map((item) => {
            return item.xmlurl
          })
    Severity: Critical
    Found in src/services/greader.js - About 2 hrs to fix

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

      export async function parseArticle (url) {
        const res = await fetch(url)
        const content = await decodeFetchResponse(res)
        const result = await Mercury.parse(url, {
          html: Buffer.from(content, 'utf-8')
      Severity: Major
      Found in src/parsers/article.js and 1 other location - About 1 hr to fix
      src/main/article.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 74.

      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

      export async function parseArticle (url) {
        const res = await fetch(url)
        const content = await decodeFetchResponse(res)
        const result = await Mercury.parse(url, {
          html: Buffer.from(content, 'utf-8')
      Severity: Major
      Found in src/main/article.js and 1 other location - About 1 hr to fix
      src/parsers/article.js on lines 26..33

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

      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

                const markUnFavourite = res.filter(item => !starredList.split(',').includes(item.articles.source_id.toString())).map(item => item.articles.uuid)
      Severity: Major
      Found in src/services/fever.js and 1 other location - About 1 hr to fix
      src/services/fever.js on lines 203..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 72.

      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

                const markRead = res.filter(item => !unreadList.split(',').includes(item.articles.source_id.toString())).map(item => item.articles.uuid)
      Severity: Major
      Found in src/services/fever.js and 1 other location - About 1 hr to fix
      src/services/fever.js on lines 204..204

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

      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 (rootState.Setting.fever_connected) {
            sourceIds.filter(item => item !== null).forEach((item) => {
              fever.markItem(rootState.Setting.fever, 'UNREAD', item)
            })
          }
      Severity: Major
      Found in src/store/modules/Article.js and 1 other location - About 1 hr to fix
      src/store/modules/Article.js on lines 146..150

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

      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 (rootState.Setting.fever_connected) {
            sourceIds.filter(item => item !== null).forEach((item) => {
              fever.markItem(rootState.Setting.fever, 'READ', item)
            })
          }
      Severity: Major
      Found in src/store/modules/Article.js and 1 other location - About 1 hr to fix
      src/store/modules/Article.js on lines 115..119

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

      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

          const sourceIds = state.articles.reduce((arr, item) => {
            if (!item.articles.read) {
              arr.push(item.articles.source_id)
            }
            return arr
      Severity: Major
      Found in src/store/modules/Article.js and 1 other location - About 1 hr to fix
      src/store/modules/Article.js on lines 133..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 67.

      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

          const unreadArticles = state.articles.reduce((arr, item) => {
            if (!item.articles.read) {
              arr.push(item.articles.uuid)
            }
            return arr
      Severity: Major
      Found in src/store/modules/Article.js and 1 other location - About 1 hr to fix
      src/store/modules/Article.js on lines 139..144

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

      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 40 lines of code (exceeds 25 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 1 hr to fix

        Function decodeFetchResponse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        async function decodeFetchResponse (response, isHTML = false) {
          const CHARSET_RE = /charset=([^()<>@,;:\\"/[\]?.=\s]*)/i
          const buffer = await response.arrayBuffer()
          let ctype = response.headers.has('content-type') && response.headers.get('content-type')
          let charset = (ctype && CHARSET_RE.test(ctype)) ? CHARSET_RE.exec(ctype)[1] : undefined
        Severity: Minor
        Found in src/main/article.js - About 1 hr 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 subscribe has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          subscribe (feeds, category = null, refresh = false, importData = false) {
            const items = feeds.map(async (feed) => {
              let url
        
              if (!importData) {
        Severity: Minor
        Found in src/services/helpers.js - About 1 hr 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 sortBy has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        const sortBy = (key, pref) => {
          if (pref === 'asc') {
            return (a, b) => (a.articles[key] > b.articles[key] ? 1 : b.articles[key] > a.articles[key] ? -1 : 0)
          }
          return (a, b) => (a.articles[key] < b.articles[key] ? 1 : b.articles[key] < a.articles[key] ? -1 : 0)
        Severity: Minor
        Found in src/store/modules/Article.js - About 1 hr 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 cacheArticleData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async cacheArticleData (responseData) {
            const cacheName = `raven-${responseData._id}`
            const cache = await caches.open(cacheName)
            const previouslyCached = await this.isCached(cacheName)
            const imgRe = /<img[^>]*src=(['"])(.*?)\1[^>]*>/ig
        Severity: Minor
        Found in src/services/cacheArticle.js - About 1 hr to fix

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

            fetchArticlesByFeedMulti (feedIds) {
              return db.database
                .select()
                .from(db.articleTable)
                .where(db.articleTable.feed_uuid.in(feedIds))
          Severity: Major
          Found in src/services/db.js and 12 other locations - About 1 hr to fix
          src/services/db.js on lines 10..12
          src/services/db.js on lines 28..34
          src/services/db.js on lines 45..47
          src/services/db.js on lines 48..50
          src/services/db.js on lines 51..53
          src/services/db.js on lines 70..72
          src/services/db.js on lines 73..75
          src/services/db.js on lines 76..78
          src/services/db.js on lines 110..112
          src/services/db.js on lines 119..121
          src/services/db.js on lines 122..124
          src/services/db.js on lines 125..127

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

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

            deleteArticlesSyncAccount (subscription) {
              return db.database.delete().from(db.articleTable).where(db.articleTable.source.eq(subscription)).exec()
            },
          Severity: Major
          Found in src/services/db.js and 12 other locations - About 1 hr to fix
          src/services/db.js on lines 10..12
          src/services/db.js on lines 28..34
          src/services/db.js on lines 35..41
          src/services/db.js on lines 45..47
          src/services/db.js on lines 48..50
          src/services/db.js on lines 51..53
          src/services/db.js on lines 70..72
          src/services/db.js on lines 76..78
          src/services/db.js on lines 110..112
          src/services/db.js on lines 119..121
          src/services/db.js on lines 122..124
          src/services/db.js on lines 125..127

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

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

            deleteAllSyncAccountSubscriptions (subscription) {
              return db.database.delete().from(db.feedTable).where(db.feedTable.source.eq(subscription)).exec()
            },
          Severity: Major
          Found in src/services/db.js and 12 other locations - About 1 hr to fix
          src/services/db.js on lines 10..12
          src/services/db.js on lines 28..34
          src/services/db.js on lines 35..41
          src/services/db.js on lines 45..47
          src/services/db.js on lines 51..53
          src/services/db.js on lines 70..72
          src/services/db.js on lines 73..75
          src/services/db.js on lines 76..78
          src/services/db.js on lines 110..112
          src/services/db.js on lines 119..121
          src/services/db.js on lines 122..124
          src/services/db.js on lines 125..127

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

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

            fetchCategoriesBySource (source) {
              return db.database.select().from(db.categoryTable).where(db.categoryTable.source.eq(source)).exec()
            },
          Severity: Major
          Found in src/services/db.js and 12 other locations - About 1 hr to fix
          src/services/db.js on lines 10..12
          src/services/db.js on lines 28..34
          src/services/db.js on lines 35..41
          src/services/db.js on lines 45..47
          src/services/db.js on lines 48..50
          src/services/db.js on lines 51..53
          src/services/db.js on lines 70..72
          src/services/db.js on lines 73..75
          src/services/db.js on lines 76..78
          src/services/db.js on lines 119..121
          src/services/db.js on lines 122..124
          src/services/db.js on lines 125..127

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

          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

          Severity
          Category
          Status
          Source
          Language