packages/miew/src/Miew.ts

Summary

Maintainability
F
1 mo
Test Coverage

File Miew.ts has 3458 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global DEBUG:false, PACKAGE_VERSION:false */
// eslint-disable-next-line
//@ts-nocheck
import { Spinner } from 'spin.js'
import Stats from './gfx/Stats'
Severity: Major
Found in packages/miew/src/Miew.ts - About 1 wk to fix

    Miew has 139 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class Miew extends EventDispatcher {
      constructor(opts: MiewOptions) {
        super()
        this._opts = merge(
          {
    Severity: Major
    Found in packages/miew/src/Miew.ts - About 2 days to fix

      Function _initGfx has 162 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _initGfx() {
          const gfx = {
            width: this._container.clientWidth,
            height: this._container.clientHeight
          }
      Severity: Major
      Found in packages/miew/src/Miew.ts - About 6 hrs to fix

        Function _initOnSettingsChanged has 146 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _initOnSettingsChanged() {
            const on = (props, func) => {
              props = isArray(props) ? props : [props]
              props.forEach((prop) => {
                this.settings.addEventListener(`change:${prop}`, func)
        Severity: Major
        Found in packages/miew/src/Miew.ts - About 5 hrs to fix

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

            _renderScene(camera, distortion, target) {
              distortion = distortion || false
              target = target || null
          
              const gfx = this._gfx
          Severity: Minor
          Found in packages/miew/src/Miew.ts - 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

          Function _renderScene has 100 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _renderScene(camera, distortion, target) {
              distortion = distortion || false
              target = target || null
          
              const gfx = this._gfx
          Severity: Major
          Found in packages/miew/src/Miew.ts - About 4 hrs to fix

            Function init has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              init() {
                const container = this._container
                const elem = utils.createElement('div', { class: 'miew-canvas' })
                _setContainerContents(container, elem)
                this._container = elem
            Severity: Major
            Found in packages/miew/src/Miew.ts - About 3 hrs to fix

              Function _onLoad has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                _onLoad(dataSource, opts) {
                  const gfx = this._gfx
                  let visualName = null
              
                  if (opts.animation) {
              Severity: Minor
              Found in packages/miew/src/Miew.ts - About 3 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

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

                constructor(opts: MiewOptions) {
                  super()
                  this._opts = merge(
                    {
                      settingsCookie: 'settings',
              Severity: Major
              Found in packages/miew/src/Miew.ts - About 3 hrs to fix

                Function _onLoad has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _onLoad(dataSource, opts) {
                    const gfx = this._gfx
                    let visualName = null
                
                    if (opts.animation) {
                Severity: Major
                Found in packages/miew/src/Miew.ts - About 3 hrs to fix

                  Function _performAO has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _performAO(
                      srcColorBuffer,
                      normalBuffer,
                      srcDepthTexture,
                      targetBuffer,
                  Severity: Major
                  Found in packages/miew/src/Miew.ts - About 2 hrs to fix

                    Function _onKeyDown has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _onKeyDown(event) {
                        if (!this._running || !this._hotKeysEnabled) {
                          return
                        }
                    
                    
                    Severity: Major
                    Found in packages/miew/src/Miew.ts - About 2 hrs to fix

                      Function screenshot has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        screenshot(width, height) {
                          const gfx = this._gfx
                          const deviceWidth = gfx.renderer.domElement.width
                          const deviceHeight = gfx.renderer.domElement.height
                      
                      
                      Severity: Major
                      Found in packages/miew/src/Miew.ts - About 2 hrs to fix

                        Function _fetchData has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function _fetchData(source, opts, job) {
                          return new Promise((resolve) => {
                            if (job.shouldCancel()) {
                              throw new Error('Operation cancelled')
                            }
                        Severity: Major
                        Found in packages/miew/src/Miew.ts - About 2 hrs to fix

                          Function exportCML has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            exportCML() {
                              const self = this
                          
                              function extractRotation(m) {
                                const xAxis = new Vector3()
                          Severity: Major
                          Found in packages/miew/src/Miew.ts - About 2 hrs to fix

                            Function _renderFrame has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _renderFrame(stereo) {
                                const gfx = this._gfx
                                const { renderer } = gfx
                            
                                renderer.getSize(this._size)
                            Severity: Major
                            Found in packages/miew/src/Miew.ts - About 2 hrs to fix

                              Function _updateInfoPanel has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                _updateInfoPanel() {
                                  const info = this._msgAtomInfo.getElementsByTagName('p')[0]
                                  let atom
                                  let residue
                              
                              
                              Severity: Major
                              Found in packages/miew/src/Miew.ts - About 2 hrs to fix

                                Function getState has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  getState(opts) {
                                    const state = {}
                                
                                    opts = defaults(opts, {
                                      compact: true,
                                Severity: Minor
                                Found in packages/miew/src/Miew.ts - About 2 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

                                Function view has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  view(expression) {
                                    const VIEW_VERSION = '1'
                                    const self = this
                                    const { pivot } = this._gfx
                                    let transform = []
                                Severity: Minor
                                Found in packages/miew/src/Miew.ts - About 2 hrs to fix

                                  Function _renderVolume has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    _renderVolume(volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) {
                                      const volumeBFMat = new VolumeMaterial.BackFacePosMaterial()
                                      const volumeFFMat = new VolumeMaterial.FrontFacePosMaterial()
                                      const cubeOffsetMat = new Matrix4().makeTranslation(0.5, 0.5, 0.5)
                                      const world2colorMat = new Matrix4()
                                  Severity: Minor
                                  Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                    Function resolveSourceShortcut has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function resolveSourceShortcut(source, opts) {
                                      if (!isString(source)) {
                                        return source
                                      }
                                    
                                    
                                    Severity: Minor
                                    Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                      Function updateBinaryMode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function updateBinaryMode(opts) {
                                        let { binary } = opts
                                      
                                        // detect by format
                                        if (opts.fileType !== undefined) {
                                      Severity: Minor
                                      Found in packages/miew/src/Miew.ts - 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 _onPick has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        _onPick(event) {
                                          if (!settings.now.picking) {
                                            // picking is disabled
                                            return
                                          }
                                      Severity: Minor
                                      Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                        Function getState has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          getState(opts) {
                                            const state = {}
                                        
                                            opts = defaults(opts, {
                                              compact: true,
                                        Severity: Minor
                                        Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                          Function screenshot has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            screenshot(width, height) {
                                              const gfx = this._gfx
                                              const deviceWidth = gfx.renderer.domElement.width
                                              const deviceHeight = gfx.renderer.domElement.height
                                          
                                          
                                          Severity: Minor
                                          Found in packages/miew/src/Miew.ts - 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 load has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                            load(source, opts) {
                                              opts = merge({}, opts, {
                                                context: this
                                              })
                                          
                                          
                                          Severity: Minor
                                          Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                            Function updateCMLData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                function updateCMLData(complex) {
                                                  const { root } = self._gfx
                                                  const mat = extractRotation(root.matrixWorld)
                                                  const v4 = new Vector4(0, 0, 0, 0)
                                                  const vCenter = new Vector4(0, 0, 0, 0)
                                            Severity: Minor
                                            Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                              Function _onPick has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                _onPick(event) {
                                                  if (!settings.now.picking) {
                                                    // picking is disabled
                                                    return
                                                  }
                                              Severity: Minor
                                              Found in packages/miew/src/Miew.ts - 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 _extractRepresentation has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                _extractRepresentation() {
                                                  const changed = []
                                              
                                                  this._forEachComplexVisual((visual) => {
                                                    if (visual.getSelectionCount() === 0) {
                                              Severity: Minor
                                              Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                Function _updateInfoPanel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                  _updateInfoPanel() {
                                                    const info = this._msgAtomInfo.getElementsByTagName('p')[0]
                                                    let atom
                                                    let residue
                                                
                                                
                                                Severity: Minor
                                                Found in packages/miew/src/Miew.ts - 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 _getAltObj has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                  _getAltObj() {
                                                    if (this._editors) {
                                                      let altObj = null
                                                      for (let i = 0; i < this._editors.length; ++i) {
                                                        const nextAltObj = this._editors[i].getAltObj()
                                                Severity: Minor
                                                Found in packages/miew/src/Miew.ts - 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 _continueAnimation has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                  _continueAnimation() {
                                                    this._isAnimating = true
                                                    let minFrameTime = 1000 / settings.now.maxfps
                                                    minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime
                                                    const self = this
                                                Severity: Minor
                                                Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                  Function _renderShadowMap has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                    _renderShadowMap() {
                                                      if (!settings.now.shadow.on) {
                                                        return
                                                      }
                                                  
                                                  
                                                  Severity: Minor
                                                  Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                    Function setOptions has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                      setOptions(opts) {
                                                        if (typeof opts === 'string') {
                                                          opts = Miew.options.fromAttr(opts)
                                                        }
                                                        if (opts.reps) {
                                                    Severity: Minor
                                                    Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                      Function _parseData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                      function _parseData(data, opts, job) {
                                                        if (job.shouldCancel()) {
                                                          return Promise.reject(new Error('Operation cancelled'))
                                                        }
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                        Function _enableMRT has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                          _enableMRT(on, renderBuffer, textureBuffer) {
                                                            const gfx = this._gfx
                                                            const gl = gfx.renderer.getContext()
                                                            const ext = gl.getExtension('WEBGL_draw_buffers')
                                                            const { properties } = gfx.renderer
                                                        Severity: Minor
                                                        Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                          Function center has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                            center(selector) {
                                                              // no arguments - center on current selection;
                                                              if (selector === undefined) {
                                                                this.setPivotSubset()
                                                                this._needRender = true
                                                          Severity: Minor
                                                          Found in packages/miew/src/Miew.ts - 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 view has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                            view(expression) {
                                                              const VIEW_VERSION = '1'
                                                              const self = this
                                                              const { pivot } = this._gfx
                                                              let transform = []
                                                          Severity: Minor
                                                          Found in packages/miew/src/Miew.ts - 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 _onKeyDown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                            _onKeyDown(event) {
                                                              if (!this._running || !this._hotKeysEnabled) {
                                                                return
                                                              }
                                                          
                                                          
                                                          Severity: Minor
                                                          Found in packages/miew/src/Miew.ts - 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 rebuild has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                            rebuild() {
                                                              if (this._building) {
                                                                this.logger.warn('Miew.rebuild(): already building!')
                                                                return
                                                              }
                                                          Severity: Minor
                                                          Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                            Function decode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                            Open

                                                                function decode() {
                                                                  // backwards compatible: old non-versioned view is the 0th version
                                                                  if (expression.length === 40) {
                                                                    expression = `0${expression}`
                                                                  }
                                                            Severity: Minor
                                                            Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                              Function _startAnimation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                _startAnimation(fileData) {
                                                                  this._stopAnimation()
                                                                  const self = this
                                                                  const visual = this._getComplexVisual()
                                                                  if (visual === null) {
                                                              Severity: Minor
                                                              Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                                Function getOBB has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                  getOBB(matrix, OBB) {
                                                                    this._bBox.makeEmpty()
                                                                
                                                                    this._forEachVisual((visual) => {
                                                                      this._bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere)
                                                                Severity: Minor
                                                                Found in packages/miew/src/Miew.ts - About 1 hr to fix

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

                                                                    setOptions(opts) {
                                                                      if (typeof opts === 'string') {
                                                                        opts = Miew.options.fromAttr(opts)
                                                                      }
                                                                      if (opts.reps) {
                                                                  Severity: Minor
                                                                  Found in packages/miew/src/Miew.ts - 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 _compareReps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                    _compareReps(complexVisual, compareWithDefaults) {
                                                                      const ans = {}
                                                                      let repCount = 0
                                                                  
                                                                      if (complexVisual) {
                                                                  Severity: Minor
                                                                  Found in packages/miew/src/Miew.ts - 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 _compareReps has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                  Open

                                                                    _compareReps(complexVisual, compareWithDefaults) {
                                                                      const ans = {}
                                                                      let repCount = 0
                                                                  
                                                                      if (complexVisual) {
                                                                  Severity: Minor
                                                                  Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                                    Function center has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                      center(selector) {
                                                                        // no arguments - center on current selection;
                                                                        if (selector === undefined) {
                                                                          this.setPivotSubset()
                                                                          this._needRender = true
                                                                    Severity: Minor
                                                                    Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                                      Function _rebuildObjects has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                      Open

                                                                        _rebuildObjects() {
                                                                          const self = this
                                                                          const gfx = this._gfx
                                                                          let i
                                                                          let n
                                                                      Severity: Minor
                                                                      Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                                        Function _export has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                        Open

                                                                          _export(format) {
                                                                            const TheExporter = head(io.exporters.find({ format }))
                                                                            if (!TheExporter) {
                                                                              this.logger.error('Could not find suitable exporter for this source')
                                                                              return Promise.reject(
                                                                        Severity: Minor
                                                                        Found in packages/miew/src/Miew.ts - About 1 hr to fix

                                                                          Function resolveSourceShortcut has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                          function resolveSourceShortcut(source, opts) {
                                                                            if (!isString(source)) {
                                                                              return source
                                                                            }
                                                                          
                                                                          
                                                                          Severity: Minor
                                                                          Found in packages/miew/src/Miew.ts - About 55 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 _setEditMode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                            _setEditMode(mode) {
                                                                              this._editMode = mode
                                                                          
                                                                              const elem = this._msgMode
                                                                              if (elem) {
                                                                          Severity: Minor
                                                                          Found in packages/miew/src/Miew.ts - About 45 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 changeUnit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                            changeUnit(unitIdx, name) {
                                                                              const visual = this._getComplexVisual(name)
                                                                              if (!visual) {
                                                                                throw new Error('There is no complex to change!')
                                                                              }
                                                                          Severity: Minor
                                                                          Found in packages/miew/src/Miew.ts - About 45 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 init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                            init() {
                                                                              const container = this._container
                                                                              const elem = utils.createElement('div', { class: 'miew-canvas' })
                                                                              _setContainerContents(container, elem)
                                                                              this._container = elem
                                                                          Severity: Minor
                                                                          Found in packages/miew/src/Miew.ts - About 45 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

                                                                          Consider simplifying this complex logical expression.
                                                                          Open

                                                                              if (
                                                                                !srcColorBuffer ||
                                                                                !normalBuffer ||
                                                                                !srcDepthTexture ||
                                                                                !targetBuffer ||
                                                                          Severity: Major
                                                                          Found in packages/miew/src/Miew.ts - About 40 mins to fix

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

                                                                              constructor(opts: MiewOptions) {
                                                                                super()
                                                                                this._opts = merge(
                                                                                  {
                                                                                    settingsCookie: 'settings',
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.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 _refreshTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                              _refreshTitle(appendix) {
                                                                                let title
                                                                                appendix = appendix === undefined ? '' : appendix
                                                                                const visual = this._getComplexVisual()
                                                                                if (visual) {
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.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 _renderShadowMap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                              _renderShadowMap() {
                                                                                if (!settings.now.shadow.on) {
                                                                                  return
                                                                                }
                                                                            
                                                                            
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                              load(source, opts) {
                                                                                opts = merge({}, opts, {
                                                                                  context: this
                                                                                })
                                                                            
                                                                            
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.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 _continueAnimation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                              _continueAnimation() {
                                                                                this._isAnimating = true
                                                                                let minFrameTime = 1000 / settings.now.maxfps
                                                                                minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime
                                                                                const self = this
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.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 _tweakResolution has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                              _tweakResolution() {
                                                                                const maxPerf = [
                                                                                  ['poor', 100],
                                                                                  ['low', 500],
                                                                                  ['medium', 1000],
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts - 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 _initGfx has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                              _initGfx() {
                                                                                const gfx = {
                                                                                  width: this._container.clientWidth,
                                                                                  height: this._container.clientHeight
                                                                                }
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts - 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 _export has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                              _export(format) {
                                                                                const TheExporter = head(io.exporters.find({ format }))
                                                                                if (!TheExporter) {
                                                                                  this.logger.error('Could not find suitable exporter for this source')
                                                                                  return Promise.reject(
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts - 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 _renderFrame has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                              _renderFrame(stereo) {
                                                                                const gfx = this._gfx
                                                                                const { renderer } = gfx
                                                                            
                                                                                renderer.getSize(this._size)
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts - 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 addObject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                              addObject(objData, bThrow) {
                                                                                let Ctor = null
                                                                            
                                                                                if (objData.type === LinesObject.prototype.type) {
                                                                                  Ctor = LinesObject
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts - 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

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                  case 107:
                                                                                    event.preventDefault()
                                                                                    event.stopPropagation()
                                                                                    this._forEachComplexVisual((visual) => {
                                                                                      visual.expandSelection()
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 2 hrs to fix
                                                                            packages/miew/src/Miew.ts on lines 3176..3185

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 83.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                  case 109:
                                                                                    event.preventDefault()
                                                                                    event.stopPropagation()
                                                                                    this._forEachComplexVisual((visual) => {
                                                                                      visual.shrinkSelection()
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 2 hrs to fix
                                                                            packages/miew/src/Miew.ts on lines 3166..3175

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 83.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                  case 'A'.charCodeAt(0):
                                                                                    switch (this._editMode) {
                                                                                      case EDIT_MODE.COMPONENT:
                                                                                        this._applyComponentEdit()
                                                                                        break
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 1 hr to fix
                                                                            packages/miew/src/Miew.ts on lines 3148..3159

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 62.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                  case 'D'.charCodeAt(0):
                                                                                    switch (this._editMode) {
                                                                                      case EDIT_MODE.COMPONENT:
                                                                                        this._discardComponentEdit()
                                                                                        break
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 1 hr to fix
                                                                            packages/miew/src/Miew.ts on lines 3136..3147

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 62.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                              getURL(opts) {
                                                                                return options.toURL(
                                                                                  this.getState(
                                                                                    defaults(opts, {
                                                                                      compact: true,
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 55 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 3747..3757

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 53.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                              getScript(opts) {
                                                                                return options.toScript(
                                                                                  this.getState(
                                                                                    defaults(opts, {
                                                                                      compact: true,
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 55 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 3726..3736

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 53.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                if (secondLine !== '') {
                                                                                  info.appendChild(document.createElement('br'))
                                                                                  info.appendChild(document.createTextNode(secondLine))
                                                                                }
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 40 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 3263..3266

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 49.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                            Open

                                                                                for (let i = 0; i < this._editors.length; ++i) {
                                                                                  this._editors[i].apply()
                                                                                }
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 3 other locations - About 40 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 2957..2959
                                                                            packages/miew/src/Miew.ts on lines 2976..2978
                                                                            packages/miew/src/Miew.ts on lines 3047..3049

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 49.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                            Open

                                                                                for (let i = 0; i < this._editors.length; ++i) {
                                                                                  this._editors[i].discard()
                                                                                }
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 3 other locations - About 40 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 2957..2959
                                                                            packages/miew/src/Miew.ts on lines 2976..2978
                                                                            packages/miew/src/Miew.ts on lines 3027..3029

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 49.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                if (coordLine !== '') {
                                                                                  info.appendChild(document.createElement('br'))
                                                                                  info.appendChild(document.createTextNode(coordLine))
                                                                                }
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 40 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 3258..3261

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 49.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                            Open

                                                                                for (let i = 0; i < this._editors.length; ++i) {
                                                                                  this._editors[i].apply()
                                                                                }
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 3 other locations - About 40 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 2976..2978
                                                                            packages/miew/src/Miew.ts on lines 3027..3029
                                                                            packages/miew/src/Miew.ts on lines 3047..3049

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 49.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                                            Open

                                                                                for (let i = 0; i < this._editors.length; ++i) {
                                                                                  this._editors[i].discard()
                                                                                }
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 3 other locations - About 40 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 2957..2959
                                                                            packages/miew/src/Miew.ts on lines 3027..3029
                                                                            packages/miew/src/Miew.ts on lines 3047..3049

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 49.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                gfx.renderer.setClearColor(
                                                                                  settings.now.bg.color,
                                                                                  Number(!settings.now.bg.transparent)
                                                                                )
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 40 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 2015..2018

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 48.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                gfx.renderer.setClearColor(
                                                                                  settings.now.bg.color,
                                                                                  Number(!settings.now.bg.transparent)
                                                                                )
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 40 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 1624..1627

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 48.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                if (this._opts.view) {
                                                                                  this.view(this._opts.view)
                                                                                  delete this._opts.view
                                                                                }
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 3614..3617

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 47.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                if (this._opts.view) {
                                                                                  this.view(this._opts.view)
                                                                                  delete this._opts.view
                                                                                }
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 2503..2506

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 47.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Identical blocks of code found in 4 locations. Consider refactoring.
                                                                            Open

                                                                                gfx.renderer.setClearColor(
                                                                                  settings.now.bg.color,
                                                                                  Number(!settings.now.bg.transparent)
                                                                                )
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 3 other locations - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 844..847
                                                                            packages/miew/src/Miew.ts on lines 1542..1545
                                                                            packages/miew/src/Miew.ts on lines 4017..4020

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 46.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                    light.shadow.camera.far = this.direction.length() + this.OBB.halfSize.z
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 634..634

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 46.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Identical blocks of code found in 4 locations. Consider refactoring.
                                                                            Open

                                                                                  gfx.renderer.setClearColor(
                                                                                    settings.now.bg.color,
                                                                                    Number(!settings.now.bg.transparent)
                                                                                  )
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 3 other locations - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 844..847
                                                                            packages/miew/src/Miew.ts on lines 1640..1643
                                                                            packages/miew/src/Miew.ts on lines 4017..4020

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 46.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Identical blocks of code found in 4 locations. Consider refactoring.
                                                                            Open

                                                                                    gfx.renderer.setClearColor(
                                                                                      settings.now.bg.color,
                                                                                      Number(!settings.now.bg.transparent)
                                                                                    )
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 3 other locations - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 844..847
                                                                            packages/miew/src/Miew.ts on lines 1542..1545
                                                                            packages/miew/src/Miew.ts on lines 1640..1643

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 46.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                    renderer.setScissor(
                                                                                      this._size.width / 2,
                                                                                      0,
                                                                                      this._size.width / 2,
                                                                                      this._size.height
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 1507..1512

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 46.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                    renderer.setViewport(
                                                                                      this._size.width / 2,
                                                                                      0,
                                                                                      this._size.width / 2,
                                                                                      this._size.height
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 1501..1506

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 46.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Identical blocks of code found in 4 locations. Consider refactoring.
                                                                            Open

                                                                                gfx.renderer.setClearColor(
                                                                                  settings.now.bg.color,
                                                                                  Number(!settings.now.bg.transparent)
                                                                                )
                                                                            Severity: Major
                                                                            Found in packages/miew/src/Miew.ts and 3 other locations - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 1542..1545
                                                                            packages/miew/src/Miew.ts on lines 1640..1643
                                                                            packages/miew/src/Miew.ts on lines 4017..4020

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 46.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                            Open

                                                                                    light.shadow.camera.near = this.direction.length() - this.OBB.halfSize.z
                                                                            Severity: Minor
                                                                            Found in packages/miew/src/Miew.ts and 1 other location - About 35 mins to fix
                                                                            packages/miew/src/Miew.ts on lines 635..635

                                                                            Duplicated Code

                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                            Tuning

                                                                            This issue has a mass of 46.

                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                            Refactorings

                                                                            Further Reading

                                                                            There are no issues that match your filters.

                                                                            Category
                                                                            Status