mrgodhani/raven-reader

View on GitHub

Showing 59 of 218 total issues

Function createWindow has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

async function createWindow () {
  // Create the browser window.
  win = new BrowserWindow({
    minWidth: 1280,
    minHeight: 720,
Severity: Minor
Found in src/background.js - About 2 hrs 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 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

      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

          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 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)
                const imgRe = /<img[^>]*src=(['"])(.*?)\1[^>]*>/ig
            Severity: Minor
            Found in src/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 parseOPML has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            export function parseOPML (data) {
              const domParser = new DOMParser()
              const doc = domParser.parseFromString(data, 'text/xml').getElementsByTagName('body')
              const parseError = doc[0].getElementsByTagName('parsererror')
              const sources = []
            Severity: Minor
            Found in src/services/opml.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 posts has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const posts = feeditems.posts.map((item) => {
                const podcast = checkIsPodCast(item)
                const articleLink = item.link ?? feed.meta.xmlurl ?? Math.random().toString(36).substring(7)
                if (podcast) {
                  item.id = uuidstring(item.enclosure.url)
            Severity: Minor
            Found in src/parsers/feed.js - About 1 hr to fix

              Function handleInoreader has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function handleInoreader (url) {
                if (url.includes('ravenreader://inoreader/auth')) {
                  const q = new URL(url).searchParams
                  if (q.has('code')) {
                    axios.post('https://www.inoreader.com/oauth2/token', {
              Severity: Minor
              Found in src/background.js - About 1 hr to fix

                Function createCategoryMenu has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function createCategoryMenu (categorydata, window, i18nextMain) {
                  const menu = new Menu()
                
                  menu.append(
                    new MenuItem({
                Severity: Minor
                Found in src/main/menu.js - About 1 hr to fix

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

                  export function createArticleItemMenu (article, window, i18nextMain) {
                    const menu = new Menu()
                    menu.append(new MenuItem({
                      label: i18nextMain.t('Copy link'),
                      click () {
                  Severity: Minor
                  Found in src/main/menu.js - About 1 hr to fix

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

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

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

                          function handleNavigation (url) {
                            const urlItem = new URL(url)
                            const params = urlItem.searchParams
                            const hostname = urlItem.hostname
                            if (params) {
                      Severity: Minor
                      Found in src/main/pocket.js - About 1 hr to fix

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

                            const items = feeds.map(async (feed) => {
                              let url
                        
                              if (!importData) {
                                url = feed.url
                        Severity: Minor
                        Found in src/services/helpers.js - About 1 hr to fix

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

                          export async function init () {
                            database = await schemaBuilder.connect({
                              onUpgrade: function (rawDb) {
                                const ver = rawDb.getVersion()
                                console.log(`updating to database v${ver}`)
                          Severity: Minor
                          Found in src/db.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
                              Severity
                              Category
                              Status
                              Source
                              Language