mrgodhani/raven-reader

View on GitHub

Showing 16 of 54 total issues

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

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

    File index.js has 478 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict'
    
    import {
      app,
      BrowserWindow,
    Severity: Minor
    Found in src/main/index.js - About 7 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 75 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 3 hrs to fix

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

              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 createWindow has a Cognitive Complexity of 12 (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 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

                Function q has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    const q = async.queue((task, cb) => {
                      const posts = []
                      if (!refresh) {
                        task.feed.meta.favicon = task.favicon
                        task.feed.meta.id = uuid(task.feed.meta.xmlurl)
                Severity: Minor
                Found in src/renderer/services/helpers.js - About 1 hr to fix

                  Function createTray has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function createTray () {
                    if (os.platform() === 'darwin') {
                      trayImage = require('path').join(__static, '/mactrayiconTemplate.png')
                    }
                  
                  
                  Severity: Minor
                  Found in src/main/index.js - About 1 hr to fix

                    Function checkForUpdates has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const checkForUpdates = (menuItem, focusedWindow, event) => {
                      updater = menuItem
                      updater.enabled = false
                      const licenseKey = store.get('license_key')
                      if (licenseKey !== TEST_LICENSE_KEY) {
                    Severity: Minor
                    Found in src/main/updater.js - About 1 hr to fix

                      Function createOrReadDatabase has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        createOrReadDatabase (db) {
                          const dirName = process.env.NODE_ENV === 'development' ? '.rss-reader-dev' : '.rss-reader'
                          const existsDir = jetpack.exists(this.useDataDir.path(dirName))
                          if (!existsDir) {
                            fs.mkdir(this.useDataDir.path(`${dirName}`), (err) => {
                      Severity: Minor
                      Found in src/renderer/db.js - About 1 hr to fix

                        Function subscribe has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          subscribe (feeds, category = null, faviconData = null, refresh = false, importData = false) {
                        Severity: Minor
                        Found in src/renderer/services/helpers.js - About 35 mins to fix

                          Function filteredArticles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            filteredArticles: state => {
                              const sortPref = store.get('settings.oldestArticles') === 'off' ? 'desc' : 'asc'
                              const orderedArticles = _.orderBy(state.articles, ['pubDate'], [sortPref])
                              if (state.type !== 'feed' && state.type !== 'search') {
                                return filters[state.type](orderedArticles)
                          Severity: Minor
                          Found in src/renderer/store/modules/Article.js - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Avoid too many return statements within this function.
                          Open

                              return filters[state.type](orderedArticles, state.feed)
                          Severity: Major
                          Found in src/renderer/store/modules/Article.js - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language