packages/miew/src/gfx/shaders/UberMaterial.js

Summary

Maintainability
D
1 day
Test Coverage

Function setValues has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  setValues(values) {
    if (typeof values === 'undefined') {
      return
    }

Severity: Minor
Found in packages/miew/src/gfx/shaders/UberMaterial.js - About 4 hrs 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

File UberMaterial.js has 325 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable no-magic-numbers */
/* eslint-disable guard-for-in */

import vertexShader from './Uber.vert'
import fragmentShader from './Uber.frag'
Severity: Minor
Found in packages/miew/src/gfx/shaders/UberMaterial.js - About 3 hrs to fix

    Function setValues has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      setValues(values) {
        if (typeof values === 'undefined') {
          return
        }
    
    
    Severity: Major
    Found in packages/miew/src/gfx/shaders/UberMaterial.js - About 3 hrs to fix

      Function constructor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(params) {
          super()
          // add fog
          this.fog = true
          // used for instanced geometry
      Severity: Minor
      Found in packages/miew/src/gfx/shaders/UberMaterial.js - About 1 hr to fix

        Function copy has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          copy(source) {
            super.copy(source)
        
            this.fragmentShader = source.fragmentShader
            this.vertexShader = source.vertexShader
        Severity: Minor
        Found in packages/miew/src/gfx/shaders/UberMaterial.js - About 1 hr to fix

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

            setUberOptions(values) {
              if (typeof values === 'undefined') {
                return
              }
          
          
          Severity: Minor
          Found in packages/miew/src/gfx/shaders/UberMaterial.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

          There are no issues that match your filters.

          Category
          Status