median-research-group/LibMTL

View on GitHub

Showing 353 of 412 total issues

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

                    atten_decoder[i][j][1] = self.decoder_att[i][-j - 1](torch.cat((g_upsampl[j], atten_decoder[i][j][0]), dim=1))
Severity: Major
Found in examples/nyu/segnet_mtan.py and 1 other location - About 5 hrs to fix
examples/nyu/segnet_mtan.py on lines 145..145

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

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

                    atten_decoder[i][j][1] = self.decoder_att[i][-j - 1](torch.cat((g_upsampl[j], atten_decoder[i][j][0]), dim=1))
Severity: Major
Found in examples/nyu/segnet_mtan.py and 1 other location - About 5 hrs to fix
examples/nyu/segnet_mtan.py on lines 140..140

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

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

File searchtools.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * searchtools.js
 * ~~~~~~~~~~~~~~~~
 *
 * Sphinx JavaScript utilities for the full-text search.
Severity: Minor
Found in docs/_build/html/_static/searchtools.js - About 5 hrs to fix

    Function defaultPrefilter has 122 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function defaultPrefilter( elem, props, opts ) {
        var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
            isBox = "width" in props || "height" in props,
            anim = this,
            orig = {},
    Severity: Major
    Found in docs/_build/html/_static/jquery-3.5.1.js - About 4 hrs to fix

      Function query has 121 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        query : function(query) {
          var i;
      
          // stem the searchterms and add them to the correct list
          var stemmer = new Stemmer();
      Severity: Major
      Found in docs/_build/html/_static/searchtools.js - About 4 hrs to fix

        Function Callbacks has 121 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        jQuery.Callbacks = function( options ) {
        
            // Convert options from String-formatted to Object-formatted if needed
            // (we check in cache first)
            options = typeof options === "string" ?
        Severity: Major
        Found in docs/_build/html/_static/jquery-3.5.1.js - About 4 hrs to fix

          Function DataloaderSC has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

          def DataloaderSC(lang_list,
                          model_name_or_path,
                          model_type,
                          mode_list,
                          data_dir,
          Severity: Minor
          Found in examples/xtreme/create_dataset.py - 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 _keep_fused_form has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              def _keep_fused_form(self,posPreferenceDicts):
                  # For a span A,B  and external tokens C, such as  A > B > C, we have to
                  # Make A the head of the span
                  # Attach C-level tokens to A
                  #Remove B-level tokens, which are the subtokens of the fused form della: de la
          Severity: Minor
          Found in examples/xtreme/propocess_data/conll.py - 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

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

              task_dict = {'segmentation': {'metrics':['mIoU', 'pixAcc'], 
                                        'metrics_fn': SegMetric(),
                                        'loss_fn': SegLoss(),
                                        'weight': [1, 1]}, 
                           'depth': {'metrics':['abs_err', 'rel_err'], 
          Severity: Major
          Found in examples/nyu/main.py and 1 other location - About 4 hrs to fix
          examples/nyu/main_segnet.py on lines 45..56

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

          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

              task_dict = {'segmentation': {'metrics':['mIoU', 'pixAcc'], 
                                        'metrics_fn': SegMetric(),
                                        'loss_fn': SegLoss(),
                                        'weight': [1, 1]}, 
                           'depth': {'metrics':['abs_err', 'rel_err'], 
          Severity: Major
          Found in examples/nyu/main_segnet.py and 1 other location - About 4 hrs to fix
          examples/nyu/main.py on lines 45..56

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

          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 stemWord has 109 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            this.stemWord = function (w) {
              var stem;
              var suffix;
              var firstch;
              var origword = w;
          Severity: Major
          Found in docs/_build/html/_static/language_data.js - About 4 hrs to fix

            Function then has 102 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            then: function( onFulfilled, onRejected, onProgress ) {
                                var maxDepth = 0;
                                function resolve( depth, deferred, handler, special ) {
                                    return function() {
                                        var that = this,
            Severity: Major
            Found in docs/_build/html/_static/jquery-3.5.1.js - About 4 hrs to fix

              Function read_conll_u has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  def read_conll_u(self,filename,keepFusedForm=False, lang=None, posPreferenceDict=None):
                      sentences = []
                      sent = DependencyTree()
                      multi_tokens = {}
              
              
              Severity: Minor
              Found in examples/xtreme/propocess_data/conll.py - 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 Animation has 96 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function Animation( elem, properties, options ) {
                  var result,
                      stopped,
                      index = 0,
                      length = Animation.prefilters.length,
              Severity: Major
              Found in docs/_build/html/_static/jquery-3.5.1.js - About 3 hrs to fix

                Function trigger has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    trigger: function( event, data, elem, onlyHandlers ) {
                
                        var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
                            eventPath = [ elem || document ],
                            type = hasOwn.call( event, "type" ) ? event.type : event,
                Severity: Major
                Found in docs/_build/html/_static/jquery-3.5.1.js - About 3 hrs to fix

                  Function forward has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def forward(self, x):
                          g_encoder, g_decoder, g_maxpool, g_upsampl, indices = ([0] * 5 for _ in range(5))
                          for i in range(5):
                              g_encoder[i], g_decoder[-i - 1] = ([0] * 2 for _ in range(2))
                  
                  
                  Severity: Minor
                  Found in examples/nyu/segnet_mtan.py - 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 convert_examples_to_features_sc has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def convert_examples_to_features_sc(
                    examples,
                    tokenizer,
                    max_length=512,
                    label_list=None,
                  Severity: Minor
                  Found in examples/xtreme/processors/utils_sc.py - 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 xnli_preprocess has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def xnli_preprocess(args):
                      def _preprocess_file(infile, output_dir, split):
                          all_langs = defaultdict(list)
                          for i, line in enumerate(open(infile, 'r')):
                              if i == 0:
                  Severity: Minor
                  Found in examples/xtreme/propocess_data/utils_preprocess.py - 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 CHILD has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          "CHILD": function( type, what, _argument, first, last ) {
                              var simple = type.slice( 0, 3 ) !== "nth",
                                  forward = type.slice( -4 ) !== "last",
                                  ofType = what === "of-type";
                  
                  
                  Severity: Major
                  Found in docs/_build/html/_static/jquery-3.5.1.js - About 3 hrs to fix

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

                                        atten_decoder[i][j][0] = self.decoder_block_att[-j - 1](atten_decoder[i][j][0])
                    Severity: Major
                    Found in examples/nyu/segnet_mtan.py and 1 other location - About 3 hrs to fix
                    examples/nyu/segnet_mtan.py on lines 144..144

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language