wurmlab/sequenceserver

View on GitHub

Showing 16,957 of 16,957 total issues

Function HSP has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

export default function HSP(props) {
  const hsp = props.hsp;
  const hspRef = createRef();
  const printing = useDetectPrint();
  const [chars, setChars] = useState(0)
Severity: Minor
Found in public/js/hsp.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

Function graphIt has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    graphIt($queryDiv, $graphDiv, index, howMany, opts, inhits) {
    /* barHeight: Height of each hit track.
     * legend: Height reserved for the overview legend.
     * margin: Margin around the svg element.
     */
Severity: Major
Found in public/js/hits_overview.js - About 5 hrs to fix

    Method has too many lines. [43/15]
    Open

        def defaults
          @defaults ||= {
            host: '0.0.0.0',
            port: 4567,
            databases_widget: 'classic',
    Severity: Minor
    Found in lib/sequenceserver/config.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    You can set literals you want to fold with CountAsOne. Available are: 'array', 'hash', and 'heredoc'. Each literal will be counted as one line regardless of its actual size.

    NOTE: The ExcludedMethods configuration is deprecated and only kept for backwards compatibility. Please use IgnoredMethods instead.

    Example: CountAsOne: ['array', 'heredoc']

    def m
      array = [       # +1
        1,
        2
      ]
    
      hash = {        # +3
        key: 'value'
      }
    
      <<~HEREDOC      # +1
        Heredoc
        content.
      HEREDOC
    end               # 5 points

    Function Chord has 123 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    circosJS.Chord = function() {
        circosJS.Track.call(this);
        this.parseData = circosJS.parseChordData;
        this.applyRules = function(rules, data) {
            var datum, l, len, results, rule;
    Severity: Major
    Found in public/js/circosjs.js - About 4 hrs to fix

      Function downloadsPanelJSX has 116 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          downloadsPanelJSX() {
              return (
                  <div className="downloads">
                      <div className="pl-px table mb-0 w-full">
                          <h4 className="text-sm font-bold mb-0 mt-2.5">
      Severity: Major
      Found in public/js/sidebar.js - About 4 hrs to fix

        Function setupTooltip has 115 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            setupTooltip() {
                var selected = {};
                $('.circos-distribution').on(
                    'click',
                    _.bind(function (event) {
        Severity: Major
        Found in public/js/circos.js - About 4 hrs to fix

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

                                      <button className="flex text-sm text-seqblue hover:text-seqorange cloud-Post cursor-pointer py-0.5 px-0.5 w-full" onClick={this.shareCloudInit}>
                                          <div className="relative flex gap-2 items-center group w-full">
                                              <i className="fa fa-cloud"></i>
                                              <div className="flex items-center">
                                                  <span className="w-full">Share to cloud</span>
          Severity: Major
          Found in public/js/sidebar.js and 1 other location - About 4 hrs to fix
          public/js/sidebar.js on lines 428..443

          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 126.

          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

                                      <a id="sendEmail" className="flex text-sm text-seqblue hover:text-seqorange email-URL cursor-pointer py-0.5 px-0.5 w-full"
                                          href={asMailtoHref(this.props.data.querydb, this.props.data.program, this.props.data.queries.length, window.location.href)}
                                          target="_blank" rel="noopener noreferrer">
                                          <div className="relative flex gap-2 items-center group w-full">
                                              <i className="fa fa-envelope"></i>
          Severity: Major
          Found in public/js/sidebar.js and 1 other location - About 4 hrs to fix
          public/js/sidebar.js on lines 448..463

          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 126.

          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

              var colors = d3.scaleLog()
                  .domain([
                      d3.min([1e-5, d3.min(hits.map(function (d) {
                          if (parseFloat(d.evalue) === 0.0) return undefined;
                          return d.evalue;
          Severity: Major
          Found in public/js/visualisation_helpers.js and 1 other location - About 4 hrs to fix
          public/js/hits_overview.js on lines 290..301

          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 124.

          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

                  var gradScale = d3.scaleLog()
                      .domain([
                          d3.min([1e-5, d3.min(hits.map(function (d) {
                              if (parseFloat(d.hitEvalue) === 0.0) return undefined;
                              return d.hitEvalue;
          Severity: Major
          Found in public/js/hits_overview.js and 1 other location - About 4 hrs to fix
          public/js/visualisation_helpers.js on lines 4..14

          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 124.

          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

          Function Grapher has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function Grapher(Graph) {
              return function Component(props) {
                  const alwaysShowName = Graph.alwaysShowName === undefined ? false : Graph.alwaysShowName();
                  const printing = useDetectPrint();
                  const name = Graph.name(props);
          Severity: Major
          Found in public/js/grapher.js - About 4 hrs to fix

            Function Component has 99 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                return function Component(props) {
                    const alwaysShowName = Graph.alwaysShowName === undefined ? false : Graph.alwaysShowName();
                    const printing = useDetectPrint();
                    const name = Graph.name(props);
                    const [width, setWidth] = useState(window.innerWidth);
            Severity: Major
            Found in public/js/grapher.js - About 3 hrs to fix

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

              var get_styles = function () {
                  var styles = '';
              
                  for (var i = 0; i < document.styleSheets.length; i++) {
                      (function process_ss(ss) {
              Severity: Minor
              Found in public/js/svgExporter.js - 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 Grapher has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function Grapher(Graph) {
                  return function Component(props) {
                      const alwaysShowName = Graph.alwaysShowName === undefined ? false : Graph.alwaysShowName();
                      const printing = useDetectPrint();
                      const name = Graph.name(props);
              Severity: Minor
              Found in public/js/grapher.js - 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 sharingPanelJSX has 79 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  sharingPanelJSX() {
                      return (
                          <div className="sharing-panel">
                              <div className="pl-px table mb-0 w-full">
                                  <h4 className="text-sm font-bold mb-0 mt-2.5">
              Severity: Major
              Found in public/js/sidebar.js - About 3 hrs to fix

                Function graphControls has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    graphControls($queryDiv, $graphDiv, isInit, opts, hits) {
                        var MIN_HITS_TO_SHOW = 20;
                
                        var totalHits, shownHits, lessButton, moreButton;
                
                
                Severity: Major
                Found in public/js/hits_overview.js - About 3 hrs to fix

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

                  circosJS.renderLayoutTicks = function(conf, layout, d3, instance) {
                      var blockTicks, displayLabel, ticks;
                      blockTicks = function(d) {
                          var k,space;
                          k = (d.end - d.start) / d.len;
                  Severity: Major
                  Found in public/js/circosjs.js - About 2 hrs to fix

                    Function componentDidMount has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        componentDidMount() {
                            var self = this;
                            var FASTA_FORMAT = /^>/;
                    
                            $(document).ready(function () {
                    Severity: Major
                    Found in public/js/dnd.js - About 2 hrs to fix

                      Method has too many lines. [25/15]
                      Open

                          def _make_blast_database(file, type, title, taxonomy)
                            cmd = "makeblastdb -parse_seqids -hash_index -in '#{file}'" \
                                  " -dbtype #{type.to_s.slice(0, 4)} -title '#{title}'" \
                                  " #{taxonomy}"
                      
                      
                      Severity: Minor
                      Found in lib/sequenceserver/makeblastdb.rb by rubocop

                      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                      You can set literals you want to fold with CountAsOne. Available are: 'array', 'hash', and 'heredoc'. Each literal will be counted as one line regardless of its actual size.

                      NOTE: The ExcludedMethods configuration is deprecated and only kept for backwards compatibility. Please use IgnoredMethods instead.

                      Example: CountAsOne: ['array', 'heredoc']

                      def m
                        array = [       # +1
                          1,
                          2
                        ]
                      
                        hash = {        # +3
                          key: 'value'
                        }
                      
                        <<~HEREDOC      # +1
                          Heredoc
                          content.
                        HEREDOC
                      end               # 5 points

                      Method has too many lines. [25/15]
                      Open

                        def self.sys(command, options = {})
                          # Available output channels
                          channels = %i[stdout stderr]
                      
                          # Make temporary files to store output from stdout and stderr.
                      Severity: Minor
                      Found in lib/sequenceserver/sys.rb by rubocop

                      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                      You can set literals you want to fold with CountAsOne. Available are: 'array', 'hash', and 'heredoc'. Each literal will be counted as one line regardless of its actual size.

                      NOTE: The ExcludedMethods configuration is deprecated and only kept for backwards compatibility. Please use IgnoredMethods instead.

                      Example: CountAsOne: ['array', 'heredoc']

                      def m
                        array = [       # +1
                          1,
                          2
                        ]
                      
                        hash = {        # +3
                          key: 'value'
                        }
                      
                        <<~HEREDOC      # +1
                          Heredoc
                          content.
                        HEREDOC
                      end               # 5 points
                      Severity
                      Category
                      Status
                      Source
                      Language