median-research-group/LibMTL

View on GitHub

Showing 353 of 412 total issues

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

    def __init__(self, encoder_list, task_name, device):
        super(_transform_resnet_cross, self).__init__()
        
        self.task_name = task_name
        self.task_num = len(task_name)
Severity: Major
Found in LibMTL/architecture/Cross_stitch.py and 1 other location - About 2 days to fix
LibMTL/architecture/LTB.py on lines 10..25

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

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

    def __init__(self, encoder_list, task_name, device):
        super(_transform_resnet_ltb, self).__init__()
        
        self.task_name = task_name
        self.task_num = len(task_name)
Severity: Major
Found in LibMTL/architecture/LTB.py and 1 other location - About 2 days to fix
LibMTL/architecture/Cross_stitch.py on lines 9..23

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

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 udpos_preprocess has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring.
Open

def udpos_preprocess(args):
    def _read_one_file(file):
        data = []
        sent, tag, lines = [], [], []
        for line in open(file, 'r'):
Severity: Minor
Found in examples/xtreme/propocess_data/utils_preprocess.py - 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 Stemmer has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

var Stemmer = function() {

  var step2list = {
    ational: 'ate',
    tional: 'tion',
Severity: Minor
Found in docs/_build/html/_static/language_data.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 query has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

  query : function(query) {
    var i;

    // stem the searchterms and add them to the correct list
    var stemmer = new Stemmer();
Severity: Minor
Found in docs/_build/html/_static/searchtools.js - About 7 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 Deferred has 178 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Deferred: function( func ) {
        var tuples = [

                // action, add listener, callbacks,
                // ... .then handlers, argument index, [final state]
Severity: Major
Found in docs/_build/html/_static/jquery-3.5.1.js - About 7 hrs to fix

    File utils_preprocess.py has 463 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # coding=utf-8
    # Copyright 2020 Google and DeepMind.
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    Severity: Minor
    Found in examples/xtreme/propocess_data/utils_preprocess.py - About 7 hrs to fix

      Function performObjectSearch has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

        performObjectSearch : function(object, otherterms) {
          var filenames = this._index.filenames;
          var docnames = this._index.docnames;
          var objects = this._index.objects;
          var objnames = this._index.objnames;
      Severity: Minor
      Found in docs/_build/html/_static/searchtools.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

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

      def parse_args(parser):
          parser.add_argument('--aug', action='store_true', default=False, help='data augmentation')
          parser.add_argument('--train_bs', default=8, type=int, help='batch size for training')
          parser.add_argument('--test_bs', default=8, type=int, help='batch size for test')
          parser.add_argument('--epochs', default=200, type=int, help='training epochs')
      Severity: Major
      Found in examples/nyu/main.py and 1 other location - About 6 hrs to fix
      examples/nyu/main_segnet.py on lines 14..20

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

      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

      def parse_args(parser):
          parser.add_argument('--aug', action='store_true', default=False, help='data augmentation')
          parser.add_argument('--train_bs', default=2, type=int, help='batch size for training')
          parser.add_argument('--test_bs', default=2, type=int, help='batch size for test')
          parser.add_argument('--epochs', default=200, type=int, help='training epochs')
      Severity: Major
      Found in examples/nyu/main_segnet.py and 1 other location - About 6 hrs to fix
      examples/nyu/main.py on lines 14..20

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

      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 panx_tokenize_preprocess has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

      def panx_tokenize_preprocess(args):
          def _preprocess_one_file(infile, outfile, idxfile, tokenizer, max_len):
              if not os.path.exists(infile):
                  print(f'{infile} not exists')
                  return 0
      Severity: Minor
      Found in examples/xtreme/propocess_data/utils_preprocess.py - 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

      Function Stemmer has 151 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Stemmer = function() {
      
        var step2list = {
          ational: 'ate',
          tional: 'tion',
      Severity: Major
      Found in docs/_build/html/_static/language_data.js - About 6 hrs to fix

        Function udpos_tokenize_preprocess has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

        def udpos_tokenize_preprocess(args):
            def _preprocess_one_file(infile, outfile, idxfile, tokenizer, max_len):
                if not os.path.exists(infile):
                    print(f'{infile} does not exist')
                    return
        Severity: Minor
        Found in examples/xtreme/propocess_data/utils_preprocess.py - 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

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

                for tn, task in enumerate(self.task_name):
                    if task_name is not None and task != task_name:
                        continue
                    ss_rep = s_rep[tn] if isinstance(s_rep, list) else s_rep
                    ss_rep = self._prepare_rep(ss_rep, task, same_rep)
        Severity: Major
        Found in LibMTL/architecture/LTB.py and 1 other location - About 5 hrs to fix
        LibMTL/architecture/abstract_arch.py on lines 49..54

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

        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

                for tn, task in enumerate(self.task_name):
                    if task_name is not None and task != task_name:
                        continue
                    ss_rep = s_rep[tn] if isinstance(s_rep, list) else s_rep
                    ss_rep = self._prepare_rep(ss_rep, task, same_rep)
        Severity: Major
        Found in LibMTL/architecture/abstract_arch.py and 1 other location - About 5 hrs to fix
        LibMTL/architecture/LTB.py on lines 75..80

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

        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

            def __init__(self, task_name, encoder_class, decoders, rep_grad, multi_input, device, **kwargs):
                super(LTB, self).__init__(task_name, encoder_class, decoders, rep_grad, multi_input, device, **kwargs)
        
                if self.multi_input:
                    raise ValueError('No support LTB for multiple inputs MTL problem')
        Severity: Major
        Found in LibMTL/architecture/LTB.py and 1 other location - About 5 hrs to fix
        LibMTL/architecture/Cross_stitch.py on lines 49..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 92.

        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

            def __init__(self, task_name, encoder_class, decoders, rep_grad, multi_input, device, **kwargs):
                super(Cross_stitch, self).__init__(task_name, encoder_class, decoders, rep_grad, multi_input, device, **kwargs)
                
                if self.multi_input:
                    raise ValueError('No support Cross Stitch for multiple inputs MTL problem')
        Severity: Major
        Found in LibMTL/architecture/Cross_stitch.py and 1 other location - About 5 hrs to fix
        LibMTL/architecture/LTB.py on lines 54..61

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

        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 performTermsSearch has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

          performTermsSearch : function(searchterms, excluded, terms, titleterms) {
            var docnames = this._index.docnames;
            var filenames = this._index.filenames;
            var titles = this._index.titles;
        
        
        Severity: Minor
        Found in docs/_build/html/_static/searchtools.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

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

        def parse_args(parser):
            parser.add_argument('--dataset', default='office-31', type=str, help='office-31, office-home')
            parser.add_argument('--bs', default=64, type=int, help='batch size')
            parser.add_argument('--epochs', default=100, type=int, help='training epochs')
            parser.add_argument('--dataset_path', default='/', type=str, help='dataset path')
        Severity: Major
        Found in examples/office/main.py and 1 other location - About 5 hrs to fix
        examples/xtreme/main.py on lines 16..21

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

        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

        def parse_args(parser):
            parser.add_argument('--dataset', default='pawsx', type=str, help='pawsx')
            parser.add_argument('--bs', default=32, type=int, help='batch size')
            parser.add_argument('--epochs', default=100, type=int, help='training epochs')
            parser.add_argument('--dataset_path', default='/', type=str, help='dataset path')
        Severity: Major
        Found in examples/xtreme/main.py and 1 other location - About 5 hrs to fix
        examples/office/main.py on lines 14..19

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

        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