Showing 41 of 41 total issues
Function renderTweets
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderTweets (tweets, i) {
const config = this.getWidgetConfig()
const width = Math.floor(100.0 / (config.layout ? (config.layout.w || 0) : 0)) + '%'
return (
<div className='twitter-feed' style={{width}} key={i}>
Function renderEditor
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderEditor () {
const tempConfig = this.getWidgetTempConfig()
if (tempConfig) {
return (
<div>
Function processRSSItems
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
processRSSItems (set, items) {
const parsedUrls = {}
items.forEach((item) => {
parsedUrls[item.link] = url.parse(item.link)
})
Function build
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function build(previousFileSizes) {
console.log('Creating an optimized production build...');
let compiler = webpack(config);
return new Promise((resolve, reject) => {
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
return (
<div className={['widget-wrapper', (this.state.editing ? 'widget-editing' : null)].join(' ')}>
<div className={this.getMainClassNames().join(' ')}>
<div className='widget-title'>
Function p
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const p = new Promise((resolve, reject) => {
imap.once('error', (err) => reject(err))
imap.once('ready', () => {
const execFlagSearch = () => {
return openMailbox(mailbox.flagMailboxName)
Function renderFeed
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderFeed (feed, i) {
return (
<div className='rss-feed' key={i}>
<div className='rss-feed-title widget-subhead'>
{feed.title}
Function exec
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
exec () {
const now = new Date()
const tonight = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999)
const dayOfWeek = tonight.getDay()
const friday = new Date(tonight.getTime() + ((5 - dayOfWeek) * (1000 * 60 * 60 * 24)))
Function exec
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exec () {
const now = new Date()
const thisMorning = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0)
const tonight = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999)
const dates = {
Function exec
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exec (dataEmitter) {
const outputData = this.cachedResponse ? this.cachedResponse.data : []
const fetchNextFeedSet = (index) => {
if (index < this.config.sets.length) {
const set = this.config.sets[index]
Function fetchExchange
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
fetchExchange (mailbox) {
const exch = new EWSFactory().initInstance(mailbox.credentials)
const response = {
'unread': 0,
'flagged': 0
Function services
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const services = (state = initialServicesState, action) => {
switch (action.type) {
case ACTIONS.SET_SERVICES:
const newServices = action.services.slice(0)
newServices.forEach((service) => {
- 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 renderCalendarConfig
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderCalendarConfig (calendar, i) {
switch (calendar.type) {
case 'exchange':
return (
<div>
Consider simplifying this complex logical expression. Open
if (tempConfig) {
return (
<div>
<div className='widget-editor-section'>
{
Consider simplifying this complex logical expression. Open
if (this.state.listOptions.length === 0 &&
twitterService &&
twitterService.tempConfig &&
twitterService.tempConfig.credentials &&
twitterService.tempConfig.credentials.access &&
Function exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (mainWindow, manager) => {
const sendServices = () => {
console.log('Sending services list')
mainWindow.webContents.send('services', manager.services.map((service) => {
return {
- 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 exec
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exec () {
if (this.config.credentials && this.config.credentials.access && this.config.credentials.access.token && this.config.credentials.access.tokenSecret) {
this.client = new TwitterClient({
'consumer_key': keys.twitter.key,
'consumer_secret': keys.twitter.secret,
- 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
Avoid too many return
statements within this function. Open
return Object.assign({}, state, {
services: newServices1
})
Avoid too many return
statements within this function. Open
return Object.assign({}, state, {
services: newServices
})
Avoid too many return
statements within this function. Open
return state