Showing 60 of 123 total issues
Function exports
has 455 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
var app = express();
app.use('/img', express.static(__dirname + '/img'))
Function loadLanguages
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
export function loadLanguages(pack, cb) {
if (Object.keys(pack).length > 0) {
var state = store.getState().i18n
var loadNow = null
var fallbacks = []
- 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
File app.js
has 473 lines of code (exceeds 250 allowed). Consider refactoring. Open
var express = require('express');
var bodyParser = require('body-parser');
var jsonParser = bodyParser.json();
var fs = require('fs');
Function i18n
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
export default function i18n(state = initialState, action) {
switch (action.type) {
case types.I18N_PARSE_LANGUAGE:
var newState = Object.assign({}, state)
var generals = {
- 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 loadLanguages
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function loadLanguages(pack, cb) {
if (Object.keys(pack).length > 0) {
var state = store.getState().i18n
var loadNow = null
var fallbacks = []
Function render
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {state, actions} = this.props
var content = (
<span></span>
)
Function i18n
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function i18n(state = initialState, action) {
switch (action.type) {
case types.I18N_PARSE_LANGUAGE:
var newState = Object.assign({}, state)
var generals = {
Function matchPattern
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function matchPattern(pattern, pathname) {
// Make leading slashes consistent between pattern and pathname.
if (pattern.charAt(0) !== '/') {
pattern = `/${pattern}`
}
Function config
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function config(state = initialState, action) {
switch (action.type) {
case types.CONFIG_SET_PAGE:
if (pageTypes[action.page] != null) {
var newState = Object.assign({}, state)
Function loginSubmit
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function loginSubmit() {
return (dispatch, getState) => {
dispatch(authLoginSubmit())
var state = getState()
superagent
Function render
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {state, actions} = this.props
var errorOutput = (
<span></span>
Function checkLogin
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function checkLogin(err) {
return (dispatch, getState) => {
var state = getState()
//var a = state.auth.token !== ''
if (state.auth.token !== '' && state.auth.profile != null && state.auth.profile.firstname !== '' && state.auth.profile.lastname !== '' && state.auth.profile.avatarUrl !== '') {
Function search
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function search(state = initialState, action) {
switch (action.type) {
case types.SEARCH_ACTIVATE:
var newState = Object.assign({}, state)
newState.active = true
Function _compilePattern
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _compilePattern(pattern) {
let regexpSource = ''
const paramNames = []
const tokens = []
Function superagentPlugin
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var superagentPlugin = function(config = {}) {
if (config.disable == null) {
config.disable = {}
}
return function(request) {
Function matchPattern
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function matchPattern(pattern, pathname) {
// Make leading slashes consistent between pattern and pathname.
if (pattern.charAt(0) !== '/') {
pattern = `/${pattern}`
}
- 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 auth
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function auth(state = initialState, action) {
switch (action.type) {
case types.AUTH_LOGIN_SUBMIT:
var newState = Object.assign({}, state)
newState.loginLoading = true
Function router
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function router(state = initialState, action) {
switch (action.type) {
case types.ROUTER_LOCATION_CHANGED:
var newState = Object.assign({}, state)
newState.location = action.location
Function loadModuleIfNecessary
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
var loadModuleIfNecessary = function(id, cb) {
if (store[id] != null) {
if (store[id].state !== c.LOADING && store[id].state !== c.LOADED && store[id].url != null) {
store[id].state = c.LOADING
store[id].callbacks.push(cb)
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {state, actions} = this.props
if (state.router.error === true) {
return (
<div className={ styles.center }>