Unbabel/OpenKiwi

View on GitHub

Showing 81 of 81 total issues

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

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

            def fit_vocab(
        Severity: Minor
        Found in kiwi/systems/encoders/xlmroberta.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if selection not in metrics:
                                      raise KeyError(
                                          f'Main metric {selection} is not a configured metric; '
                                          f'available options are: {metrics.keys()}'
                                      )
          Severity: Major
          Found in kiwi/systems/tlm_system.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/parallel_dataset.py - About 45 mins to fix

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

                  def load_from_checkpoint(
              Severity: Minor
              Found in kiwi/systems/qe_system.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if selection not in metrics:
                                            raise KeyError(
                                                f'Main metric {selection} is not a configured metric; '
                                                f'available options are: {list(metrics.keys())}'
                                            )
                Severity: Major
                Found in kiwi/systems/qe_system.py - About 45 mins to fix

                  Function predict has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def predict(
                          self,
                          source: List[str],
                          target: List[str],
                          alignments: List[str] = None,
                  Severity: Minor
                  Found in kiwi/runner.py - About 45 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

                  Avoid deeply nested control flow statements.
                  Open

                                          if word in v.stoi:
                                              self.itos.append(word)
                                  else:
                  Severity: Major
                  Found in kiwi/data/vocabulary.py - About 45 mins to fix

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

                        def forward(self, batch_inputs, include_target_logits=False):
                            target_embeddings = self.embeddings[const.TARGET](batch_inputs[const.TARGET])
                            source_embeddings = self.embeddings[const.SOURCE](batch_inputs[const.SOURCE])
                    
                            target_lengths = batch_inputs[const.TARGET].lengths
                    Severity: Minor
                    Found in kiwi/systems/encoders/predictor.py - About 45 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 load_from_checkpoint has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def load_from_checkpoint(
                    Severity: Minor
                    Found in kiwi/systems/tlm_system.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/word_level_output.py - About 45 mins to fix

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

                            def fit_vocab(
                        Severity: Minor
                        Found in kiwi/data/encoders/field_encoders.py - About 45 mins to fix

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

                              def fit_vocab(
                          Severity: Minor
                          Found in kiwi/systems/encoders/bert.py - About 45 mins to fix

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

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

                              Function forward has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def forward(self, embeddings_a, lengths_a, mask_a, embeddings_b, lengths_b):
                              Severity: Minor
                              Found in kiwi/systems/encoders/predictor.py - About 35 mins to fix

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

                                    def __init__(
                                Severity: Minor
                                Found in kiwi/modules/common/distributions.py - About 35 mins to fix

                                  Function split_outputs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      def split_outputs(
                                  Severity: Minor
                                  Found in kiwi/systems/encoders/xlm.py - About 35 mins to fix

                                    Function forward has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        def forward(
                                    Severity: Minor
                                    Found in kiwi/systems/encoders/bert.py - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language