Unbabel/OpenKiwi

View on GitHub

Showing 78 of 81 total issues

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

    def __init__(self, config: Config, field_encoders: Dict[str, TextEncoder] = None):
        super().__init__()
        self._vocabularies_initialized = False
        self.config = config

Severity: Minor
Found in kiwi/data/encoders/wmt_qe_data_encoder.py - 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 __init__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, config: Config, field_encoders: Dict[str, TextEncoder] = None):
        super().__init__()
        self._vocabularies_initialized = False
        self.config = config

Severity: Minor
Found in kiwi/data/encoders/parallel_data_encoder.py - 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 __init__ has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self, input_dim, config):
        super().__init__()
        self.input_dim = input_dim
        self.config = config

Severity: Minor
Found in kiwi/systems/decoders/nuqe.py - About 1 hr to fix

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

        def __init__(self, input_dim, config):
            super().__init__()
            self.input_dim = input_dim
            self.config = config
    
    
    Severity: Minor
    Found in kiwi/systems/decoders/nuqe.py - About 1 hr to fix

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

          def forward(self, batch_inputs):
              target_emb = self.embeddings[const.TARGET](batch_inputs[const.TARGET])
              source_emb = self.embeddings[const.SOURCE](batch_inputs[const.SOURCE])
      
              if const.TARGET_POS in self.embeddings:
      Severity: Minor
      Found in kiwi/systems/encoders/quetch.py - About 1 hr to fix

        Function make_predictions has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def make_predictions(
        Severity: Major
        Found in kiwi/lib/predict.py - About 1 hr to fix

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

              def __init__(
                  self,
                  config,
                  data_config: WMTQEDataset.Config = None,
                  module_dict: Dict[str, Any] = None,
          Severity: Minor
          Found in kiwi/systems/bert.py - 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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                  self, vocabs: Dict[str, Vocabulary], config: Config, pre_load_model: bool = True
              ):
                  super().__init__(config=config)
          
          
          Severity: Minor
          Found in kiwi/systems/encoders/xlmroberta.py - 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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                  self,
                  config,
                  data_config: WMTQEDataset.Config = None,
                  module_dict: Dict[str, Any] = None,
          Severity: Minor
          Found in kiwi/systems/xlm.py - 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 forward has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def forward(self, features, batch_inputs):
                  output_features = OrderedDict()
          
                  if const.TARGET in features:
                      features_tensor = features[const.TARGET]
          Severity: Minor
          Found in kiwi/systems/decoders/estimator.py - 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 to_numeric_values has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def to_numeric_values(
              predictions: Union[str, List[str], List[List[str]]]
          ) -> Union[int, float, List[int], List[float], List[List[int]], List[List[float]]]:
              """Convert text labels or string probabilities (for BAD) to int or float values,
              respectively."""
          Severity: Minor
          Found in kiwi/lib/evaluate.py - 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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                  self,
                  config,
                  data_config: WMTQEDataset.Config = None,
                  module_dict: Dict[str, Any] = None,
          Severity: Minor
          Found in kiwi/systems/predictor_estimator.py - 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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                  self,
                  config,
                  data_config: WMTQEDataset.Config = None,
                  module_dict: Dict[str, Any] = None,
          Severity: Minor
          Found in kiwi/systems/xlmroberta.py - 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 to_numeric_binary_labels has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def to_numeric_binary_labels(
              predictions: Union[
                  str, float, List[str], List[List[str]], List[float], List[List[float]]
              ],
              threshold: float = 0.5,
          Severity: Minor
          Found in kiwi/lib/evaluate.py - 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 fit_vocab has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def fit_vocab(
          Severity: Major
          Found in kiwi/systems/encoders/xlm.py - About 50 mins to fix

            Function feedforward has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def feedforward(
            Severity: Major
            Found in kiwi/modules/common/feedforward.py - About 50 mins to fix

              Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Major
              Found in kiwi/systems/encoders/predictor.py - About 50 mins to fix

                Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(
                Severity: Minor
                Found in kiwi/modules/word_level_output.py - About 45 mins to fix

                  Function build has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def build(
                  Severity: Minor
                  Found in kiwi/data/datasets/wmt_qe_dataset.py - About 45 mins to fix

                    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(
                    Severity: Minor
                    Found in kiwi/modules/common/scalar_mix.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language