mrgodhani/raven-reader

View on GitHub

Showing 58 of 58 total issues

Function createMenu has 312 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function createMenu (mainWindow) {
  // Create the Application's main menu
  const template = [{
    label: 'Edit',
    submenu: [{
Severity: Major
Found in src/main/menu.js - About 1 day to fix

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

      UPDATE_ARTICLE_CATEGORY (state, data) {
        const articles = _.filter(state.articles, {
          category: data.old.title
        })
        for (let i = 0; i < articles.length; i++) {
    Severity: Major
    Found in src/renderer/store/modules/Article.js and 1 other location - About 6 hrs to fix
    src/renderer/store/modules/Feed.js on lines 34..43

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

    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

      UPDATE_FEED_CATEGORY (state, data) {
        const feeds = _.filter(state.feeds, { category: data.old.title })
        for (let i = 0; i < feeds.length; i++) {
          const index = _.findIndex(state.feeds, {
            _id: feeds[i]._id
    Severity: Major
    Found in src/renderer/store/modules/Feed.js and 1 other location - About 6 hrs to fix
    src/renderer/store/modules/Article.js on lines 183..194

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

    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

      MARK_CATEGORY_READ (state, data) {
        const feedArticles = _.filter(state.articles, {
          category: data
        })
        for (let i = 0; i < feedArticles.length; i++) {
    Severity: Major
    Found in src/renderer/store/modules/Article.js and 1 other location - About 5 hrs to fix
    src/renderer/store/modules/Article.js on lines 116..123

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

    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

      MARK_FEED_READ (state, id) {
        const feedArticles = _.filter(state.articles, { feed_id: id })
        for (let i = 0; i < feedArticles.length; i++) {
          const index = _.findIndex(state.articles, { _id: feedArticles[i]._id })
          state.articles[index].read = true
    Severity: Major
    Found in src/renderer/store/modules/Article.js and 1 other location - About 5 hrs to fix
    src/renderer/store/modules/Article.js on lines 195..206

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

    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 menu.js has 322 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { app, Menu } from 'electron'
    import Store from 'electron-store'
    import {
      checkForUpdates
    } from './updater.js'
    Severity: Minor
    Found in src/main/menu.js - About 3 hrs to fix

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

      import db from '../../services/db'
      import helper from '../../services/helpers'
      import dayjs from 'dayjs'
      import relativeTime from 'dayjs/plugin/relativeTime'
      import _ from 'lodash'
      Severity: Minor
      Found in src/renderer/store/modules/Article.js - About 3 hrs to fix

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

        function createWindow () {
          /**
           * If there is already data in old directory. Moved it to new
           */
          const oldDirectory = jetpack.cwd(app.getPath('userData'))
        Severity: Major
        Found in src/main/index.js - About 2 hrs to fix

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

            DELETE_ARTICLES_CATEGORY (state, category) {
              const articles = _.filter(state.articles, { title: category })
              articles.forEach(async (article) => {
                await cacheService.uncache(`raven-${article._id}`)
              })
          Severity: Major
          Found in src/renderer/store/modules/Article.js and 1 other location - About 2 hrs to fix
          src/renderer/store/modules/Article.js on lines 131..137

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

          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

            DELETE_ARTICLES (state, id) {
              const articles = _.filter(state.articles, { feed_id: id })
              articles.forEach(async (article) => {
                await cacheService.uncache(`raven-${article._id}`)
              })
          Severity: Major
          Found in src/renderer/store/modules/Article.js and 1 other location - About 2 hrs to fix
          src/renderer/store/modules/Article.js on lines 124..130

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

          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

          `` has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default {
            ensureIndex (db, field) {
              db.ensureIndex({ fieldName: field, unique: true }, (err) => {
                if (err) {}
              })
          Severity: Minor
          Found in src/renderer/services/db.js - About 2 hrs to fix

            Function subscribe has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              subscribe (feeds, category = null, faviconData = null, refresh = false, importData = false) {
                const q = async.queue((task, cb) => {
                  const posts = []
                  if (!refresh) {
                    task.feed.meta.favicon = task.favicon
            Severity: Major
            Found in src/renderer/services/helpers.js - About 2 hrs to fix

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

                updateFeedCategory (id, category) {
                  feed.update({
                    id: id
                  }, {
                    $set: {
              Severity: Major
              Found in src/renderer/services/db.js and 1 other location - About 1 hr to fix
              src/renderer/services/db.js on lines 130..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 73.

              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

                updateArticleCategory (id, category) {
                  article.update({
                    _id: id
                  }, {
                    $set: {
              Severity: Major
              Found in src/renderer/services/db.js and 1 other location - About 1 hr to fix
              src/renderer/services/db.js on lines 85..99

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

              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

                LOAD_CATEGORY (state, data) {
                  state.categories = data.map((item) => {
                    item.title = _.truncate(item.title, { length: 22 })
                    return item
                  })
              Severity: Major
              Found in src/renderer/store/modules/Category.js and 1 other location - About 1 hr to fix
              src/renderer/store/modules/Feed.js on lines 9..14

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

              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

                LOAD_FEEDS (state, feed) {
                  state.feeds = feed.map((item) => {
                    item.title = _.truncate(item.title, { length: 22 })
                    return item
                  })
              Severity: Major
              Found in src/renderer/store/modules/Feed.js and 1 other location - About 1 hr to fix
              src/renderer/store/modules/Category.js on lines 9..14

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

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

              function createWindow () {
                /**
                 * If there is already data in old directory. Moved it to new
                 */
                const oldDirectory = jetpack.cwd(app.getPath('userData'))
              Severity: Minor
              Found in src/main/index.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)
                  var imgRe = /<img[^>]*src=(['"])(.*?)\1[^>]*>/ig
              Severity: Minor
              Found in src/renderer/services/cacheArticle.js - About 1 hr to fix

                Function cacheArticleData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  async cacheArticleData (responseData) {
                    const cacheName = `raven-${responseData._id}`
                    const cache = await caches.open(cacheName)
                    const previouslyCached = await this.isCached(cacheName)
                    var imgRe = /<img[^>]*src=(['"])(.*?)\1[^>]*>/ig
                Severity: Minor
                Found in src/renderer/services/cacheArticle.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

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

                  ADD_CATEGORY (state, data) {
                    if (data) {
                      data.title = _.truncate(data.title, { length: 22 })
                      state.categories.unshift(data)
                    }
                Severity: Major
                Found in src/renderer/store/modules/Category.js and 1 other location - About 1 hr to fix
                src/renderer/store/modules/Feed.js on lines 15..20

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

                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