Showing 25 of 42 total issues
Function componentDidMount
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
componentDidMount() {
window.addEventListener('resize', () => {
const currentWidth = GoldCoinSlice.setWindowSize();
const videoPlaying = currentWidth !== 'mobile';
if (videoPlaying) {
- 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 FormInput
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const FormInput = ({
name,
label,
fieldType,
description,
- 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 stateToProps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
stateToProps: ({ badgers, goldCoinPages }, params = {}) => {
if (goldCoinPages) {
// find page that matches passed in slug.
const pageData = goldCoinPages.find(page => page.slug === params.slug);
if (pageData) {
- 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 handleContactUsHash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const handleContactUsHash = stateNavigator => {
const { historyManager } = stateNavigator;
const getUrl = historyManager.getUrl.bind(historyManager);
historyManager.getUrl = hrefElement => {
let url = getUrl(hrefElement);
- 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 validateContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static validateContent(type: string, value: string, required: boolean) {
// for strings with special constraints like emails or phone numbers
// If they input has a special case retrieve that validator and run
// the string through it
if (inputTypes[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"