ginpei/potoshop

View on GitHub

Showing 24 of 42 total issues

Function calculateProperPos has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  protected calculateProperPos (pos: IPos): IPos {
    const el = this.el.current;
    if (!el || !el.offsetParent) {
      throw new Error('Element has to be mounted');
    }
Severity: Minor
Found in src/components/BubbleButton.tsx - About 1 hr 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 constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor (props: IPaintPagePros) {
    super(props);
    this.state = {
      dirty: false,
      height: 0,
Severity: Minor
Found in src/pages/paint/PaintPage.tsx - About 1 hr to fix

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

    export function getUrlParamOf (name: string, defaultValue?: any) {
      const values = getUrlParamsOf(name);
      const value = values.length > 0 ? values[0] : defaultValue;
      let converted: any;
      if (typeof defaultValue === 'number') {
    Severity: Minor
    Found in src/misc.ts - 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 setUpSizes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      protected setUpSizes () {
        // this is called only from `componentWillMount()`
    
        const el = document.documentElement!;
        const screenHeight = el.clientHeight;
    Severity: Minor
    Found in src/pages/paint/PaintPage.tsx - 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

    Severity
    Category
    Status
    Source
    Language