redbadger/website-honestly

View on GitHub

Showing 25 of 42 total issues

Function FormInput has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const FormInput = ({
  name,
  label,
  fieldType,
  description,
Severity: Minor
Found in site/components/hubspot/form/formField.js - About 35 mins to fix

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 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) {
Severity: Minor
Found in site/slices/gc-slice/index.js - About 35 mins to fix

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) {
Severity: Minor
Found in site/routes/definitions.js - About 25 mins to fix

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);
Severity: Minor
Found in site/routes/index.js - About 25 mins to fix

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]) {
Severity: Minor
Found in site/components/hubspot/form/index.js - About 25 mins to fix

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

Severity
Category
Status
Source
Language