Showing 17 of 26 total issues
Function compile
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
compile () {
if (!this.props.cookBook) {
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 render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function render (instance, setRecipeProperty) {
return (
<div>
<div className="float-left mr-3 form-group form-check">
<input
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function render (instance, setRecipeProperty) {
return (
<div>
<RecipeTextField
bindTo="username"
Function compile
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
compile () {
if (!this.props.cookBook) {
return ''
}
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function render (instance, setRecipeProperty) {
return (
<div>
<RecipeTextField
bindTo="callbackUrl"
Function cook
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function cook (instance, vars) {
const url = buildUrl(['/', instance.adminPath, 'user-new.php'])
const nonceCallback = `${instance.id}_createUser`
const username = instance.username.replace(/\\/, '\\\\').replace(/'/g, "\\'")
const password = instance.password.replace(/\\/, '\\\\').replace(/'/g, "\\'")
Function cook
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function cook (instance, vars) {
let cookieSelection = 'var c = document.cookie'
if (instance.cookie) {
cookieSelection = `var c = document.cookie.match(new RegExp('(^| )${instance.cookie}=([^;]+)'));)[2]`
Function cookBook
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const cookBook = (previousState = initialState, action) => {
let state = Object.assign([], previousState)
let payload = action.payload
switch (action.type) {
Function cookBook
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const cookBook = (previousState = initialState, action) => {
let state = Object.assign([], previousState)
let payload = action.payload
switch (action.type) {
- 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 render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function render (instance, setRecipeProperty) {
return (
<div>
<RecipeTextField
bindTo="resource"
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
let item = this.loadItem()
let recipe = item.recipe
let instance = item.instance
let isValid = recipe && recipe.validate(instance)
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
let payload = beautify(this.compile(), {
indent_size: 2,
space_after_anon_function: true,
space_after_named_function: true
Function cook
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function cook (instance, vars) {
let payload = vars.payload.replace(/\n?__XSS_CHEF_.+?__/g, '')
let encoded = ''
for (var i = 0; i < payload.length; i++) {
- 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 false
Avoid too many return
statements within this function. Open
return true
Function cook
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function cook (instance, vars) {
let cookieSelection = 'var c = document.cookie'
if (instance.cookie) {
cookieSelection = `var c = document.cookie.match(new RegExp('(^| )${instance.cookie}=([^;]+)'));)[2]`
- 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 validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function validate (instance) {
if (!instance.username.match(/^.{4,}$/)) {
return false
}
- 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"