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,
- Read upRead up
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'),
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
})
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)
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
- Read upRead up
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) {
- Read upRead up
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)
- Read upRead up
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
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),
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
- Read upRead up
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 = []
- Read upRead up
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)
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', {
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({
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 () {
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: []
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) {
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
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}`)
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'