Showing 4 of 61 total issues
Function render
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { postNode, postPath, postSEO } = this.props;
let title;
let description;
let image;
- 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 onCreateNode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.onCreateNode = ({ node, boundActionCreators, getNode }) => {
const { createNodeField } = boundActionCreators;
let slug;
if (node.internal.type === "MarkdownRemark") {
const fileNode = getNode(node.parent);
- 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 getLocalTitle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getLocalTitle() {
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
const pathPrefix = config.pathPrefix ? config.pathPrefix : "/";
- 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 mapToListParts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const mapToListParts = (item, index) => {
if (typeof item === "string" || typeof item === "number") {
return createElement(ListItem, { key: item, primaryText: item });
} else if (isValidElement(item)) {
return item;
- 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"