mrgodhani/raven-reader

View on GitHub

Showing 24 of 64 total issues

Function createMenu has 263 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

    File Article.js has 311 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 truncate from 'lodash.truncate'
    Severity: Minor
    Found in src/renderer/store/modules/Article.js - About 3 hrs to fix

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

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

        `` has 25 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 createWindow has 70 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

            File menu.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { app, Menu } from 'electron'
            var articleSelected = false
            
            export default function createMenu (mainWindow) {
              // Create the Application's main menu
            Severity: Minor
            Found in src/main/menu.js - About 2 hrs to fix

              actions has 21 functions (exceeds 20 allowed). Consider refactoring.
              Open

              const actions = {
                loadArticles ({ commit }) {
                  db.fetchArticles(docs => {
                    commit('LOAD_ARTICLES', docs)
                  })
              Severity: Minor
              Found in src/renderer/store/modules/Article.js - About 2 hrs to fix

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

                const mutations = {
                  LOAD_ARTICLES (state, articles) {
                    state.articles = articles.map((item) => {
                      item.feed_title = truncate(item.feed_title, { length: 20 })
                      item.title = truncate(item.title, { length: 250 })
                Severity: Minor
                Found in src/renderer/store/modules/Article.js - About 2 hrs to fix

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

                  const sortBy = (key, pref) => {
                    if (pref === 'asc') {
                      return (a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0)
                    }
                      return (a, b) => (a[key] < b[key]) ? 1 : ((b[key] < a[key]) ? -1 : 0)
                  Severity: Minor
                  Found in src/renderer/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)
                      var imgRe = /<img[^>]*src=(['"])(.*?)\1[^>]*>/ig
                  Severity: Minor
                  Found in src/renderer/services/cacheArticle.js - About 1 hr to fix

                    Function task has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        const task = (task, category, refresh) => {
                          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 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 createTray has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Function createOrReadDatabase has 32 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 parseFeed has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export async function parseFeed (feedUrl, faviconUrl = null) {
                            let feed
                            console.log(feedUrl)
                            const feeditem = {
                              meta: '',
                          Severity: Minor
                          Found in src/renderer/parsers/feed.js - About 1 hr to fix

                            Function getArticlesCount has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                    getArticlesCount (type, feedid) {
                                        let articles = this.$store.state.Article.articles
                                        if (type === '' && feedid !== '') {
                                            articles = articles.filter(article => article.feed_id === feedid)
                                        }
                            Severity: Minor
                            Found in src/renderer/mixins/articleCount.js - About 55 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

                            Function MARK_ACTION has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              MARK_ACTION (state, data) {
                                const index = state.articles.findIndex(item => item._id === data.id)
                                if (data.type === 'FAVOURITE') {
                                  state.articles[index].favourite = true
                                }
                            Severity: Minor
                            Found in src/renderer/store/modules/Article.js - About 45 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

                            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 = state.articles.concat().sort(sortBy('publishUnix', 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

                              Severity
                              Category
                              Status
                              Source
                              Language