Showing 158 of 535 total issues

File Miew.js has 3114 lines of code (exceeds 500 allowed). Consider refactoring.
Open

/* global PACKAGE_VERSION:false */
import _ from 'lodash';
import * as THREE from 'three';
import { Spinner } from 'spin.js';
import Stats from './gfx/Stats';
Severity: Major
Found in packages/lib/src/Miew.js - About 1 wk to fix

    File Menu.js has 1972 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    /* eslint-disable quote-props */
    /* eslint-disable prefer-destructuring */
    import $ from 'jquery';
    import _ from 'lodash';
    // waiting for fix https://github.com/benmosher/eslint-plugin-import/issues/1712
    Severity: Major
    Found in packages/lib/demo/scripts/ui/Menu.js - About 4 days to fix

      Function readCIF has a Cognitive Complexity of 142 (exceeds 15 allowed). Consider refactoring.
      Open

      export default function readCIF(source) {
        let i = 0;
        let j = 0;
        const n = source.length;
        let code = NaN;
      Severity: Minor
      Found in packages/lib/src/io/parsers/readCIF.js - About 2 days 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 _buildBetaSheets has a Cognitive Complexity of 135 (exceeds 15 allowed). Consider refactoring.
      Open

        _buildBetaSheets() {
          // find bridges
          // check each chain against each other chain, and against itself
          const bridges = [];
          for (let a = 0; a < this._complex._chains.length; ++a) {
      Severity: Minor
      Found in packages/lib/src/chem/SecondaryStructureMap.js - About 2 days 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 ContactSurface has a Cognitive Complexity of 122 (exceeds 15 allowed). Consider refactoring.
      Open

      function ContactSurface(packedArrays, boundaries, params, _indexList) {
        // Field generation method adapted from AstexViewer (Mike Hartshorn)
        // by Fred Ludlow.
        // Other parts based heavily on NGL (Alexander Rose) EDT Surface class
        //
      Severity: Minor
      Found in packages/lib/src/gfx/geometries/ContactSurface.js - About 2 days 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 ContactSurface has 326 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      function ContactSurface(packedArrays, boundaries, params, _indexList) {
        // Field generation method adapted from AstexViewer (Mike Hartshorn)
        // by Fred Ludlow.
        // Other parts based heavily on NGL (Alexander Rose) EDT Surface class
        //
      Severity: Major
      Found in packages/lib/src/gfx/geometries/ContactSurface.js - About 1 day to fix

        Function _buildAlphaHelices has a Cognitive Complexity of 75 (exceeds 15 allowed). Consider refactoring.
        Open

          _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) {
            // Helix and Turn
            for (let stride = 3; stride <= 5; ++stride) {
              if (inResidues.length < stride) {
                break;
        Severity: Minor
        Found in packages/lib/src/chem/SecondaryStructureMap.js - About 1 day 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

        Complex has 65 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Complex {
          constructor() {
            this._chains = [];
            this._components = [];
            this._helices = [];
        Severity: Major
        Found in packages/lib/src/chem/Complex.js - About 1 day to fix

          Function _addReprListItem has 236 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          Menu.prototype._addReprListItem = function (panel, index, repr) {
            const self = this;
            const reprList = $(`${self._menuId} [data-panel-type=miew-menu-panel-representation] .miew-repr-list`);
            const validReprN = reprList.find('.panel.valid').length;
            const newItem = createElement('div', {
          Severity: Major
          Found in packages/lib/demo/scripts/ui/Menu.js - About 1 day to fix

            Function _parseSet has a Cognitive Complexity of 63 (exceeds 15 allowed). Consider refactoring.
            Open

              _parseSet(varData) {
                const complex = this._complex = new Complex();
                const data = varData;
                const currentLabel = data.curr;
                const { atoms, labels } = data;
            Severity: Minor
            Found in packages/lib/src/io/parsers/CMLParser.js - About 1 day 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 readCIF has 210 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            export default function readCIF(source) {
              let i = 0;
              let j = 0;
              const n = source.length;
              let code = NaN;
            Severity: Major
            Found in packages/lib/src/io/parsers/readCIF.js - About 7 hrs to fix

              File Complex.js has 723 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              import * as THREE from 'three';
              import logger from '../utils/logger';
              import Atom from './Atom';
              import Chain from './Chain';
              import Helix from './Helix';
              Severity: Major
              Found in packages/lib/src/chem/Complex.js - About 7 hrs to fix

                Function _buildBetaSheets has 197 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                  _buildBetaSheets() {
                    // find bridges
                    // check each chain against each other chain, and against itself
                    const bridges = [];
                    for (let a = 0; a < this._complex._chains.length; ++a) {
                Severity: Major
                Found in packages/lib/src/chem/SecondaryStructureMap.js - About 6 hrs to fix

                  Function _updateVertices has a Cognitive Complexity of 54 (exceeds 15 allowed). Consider refactoring.
                  Open

                    _updateVertices() {
                      // Algorithm:
                      // 1. Get plane parameters
                      // 2. Compute culling flags for all vertices
                      // 3. If intersection occurs => compute from 3 to 6 intersection points
                  Severity: Minor
                  Found in packages/lib/src/gfx/VolumeMesh.js - About 6 hrs to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  File ComplexVisual.js has 664 lines of code (exceeds 500 allowed). Consider refactoring.
                  Open

                  import _ from 'lodash';
                  import * as THREE from 'three';
                  import utils from './utils';
                  import logger from './utils/logger';
                  import chem from './chem';
                  Severity: Major
                  Found in packages/lib/src/ComplexVisual.js - About 5 hrs to fix

                    Function _initGfx has 171 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    Miew.prototype._initGfx = function () {
                      const gfx = {
                        width: this._container.clientWidth,
                        height: this._container.clientHeight,
                      };
                    Severity: Major
                    Found in packages/lib/src/Miew.js - About 5 hrs to fix

                      Function _init has 168 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      Menu.prototype._init = function () {
                        const self = this;
                        let selectorHide = null;
                        let selectorShow = null;
                        let newPanelId = null;
                      Severity: Major
                      Found in packages/lib/demo/scripts/ui/Menu.js - About 5 hrs to fix

                        Function _selectComponents has a Cognitive Complexity of 46 (exceeds 15 allowed). Consider refactoring.
                        Open

                          _selectComponents(text) {
                            const parser = new DOMParser();
                            const doc = parser.parseFromString(text, 'application/xml');
                            const traversedData = this._traverseData(doc);
                            let rawData;
                        Severity: Minor
                        Found in packages/lib/src/io/parsers/CMLParser.js - About 5 hrs to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        File ObjectControls.js has 638 lines of code (exceeds 500 allowed). Consider refactoring.
                        Open

                        import * as THREE from 'three';
                        import Timer from '../Timer';
                        import settings from '../settings';
                        import EventDispatcher from '../utils/EventDispatcher';
                        
                        
                        Severity: Major
                        Found in packages/lib/src/ui/ObjectControls.js - About 5 hrs to fix

                          Function _initSelectionPanel has 157 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          Menu.prototype._initSelectionPanel = function () {
                            const self = this;
                            const selectionPanel = $(`${self._menuId} [data-panel-type=miew-menu-panel-selection]`);
                          
                            function fillSingleWords() {
                          Severity: Major
                          Found in packages/lib/demo/scripts/ui/Menu.js - About 5 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language