Unbabel/OpenKiwi

View on GitHub

Showing 81 of 81 total issues

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

    def predict(
Severity: Minor
Found in kiwi/runner.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/scorer.py - About 35 mins to fix

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

          def concat_input(batch_a, batch_b, pad_id, lang_a=None, lang_b=None):
      Severity: Minor
      Found in kiwi/systems/encoders/xlm.py - About 35 mins to fix

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

            def __init__(
        Severity: Minor
        Found in kiwi/systems/outputs/translation_language_model.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/sentence_level_output.py - About 35 mins to fix

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

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

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

                  def __init__(self, num_embeddings: int, pad_idx: int, config: Config, vectors=None):
              Severity: Minor
              Found in kiwi/modules/token_embeddings.py - About 35 mins to fix

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

                    def encode_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/systems/encoders/predictor.py - About 35 mins to fix

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

                        def interleave_input(batch_a, batch_b, pad_id, lang_a=None, lang_b=None):
                    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/xlm.py - About 35 mins to fix

                        Function parse_base_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def parse_base_config(cls, v):
                                if isinstance(v, dict):
                                    try:
                                        return train.Configuration(**v)
                                    except pydantic.error_wrappers.ValidationError as e:
                        Severity: Minor
                        Found in kiwi/lib/search.py - About 35 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 configure_logging has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def configure_logging(
                            output_dir: Path = None, verbose: bool = False, quiet: bool = False
                        ):
                            """Configure the output logger.
                        
                        
                        Severity: Minor
                        Found in kiwi/lib/utils.py - About 35 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_torch_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def load_torch_file(file_path, map_location=None):
                            file_path = Path(file_path)
                            if not file_path.exists():
                                raise ValueError(f'Torch file not found: {file_path}')
                        
                        
                        Severity: Minor
                        Found in kiwi/utils/io.py - About 35 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 7 (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/bert.py - About 35 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 6 (exceeds 5 allowed). Consider refactoring.
                        Open

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

                            def encode(self, example):
                                tokens = self.tokenize(example)
                                number_of_tokens = len(tokens)
                                bounds = None
                                if self.subtokenize is not None:
                        Severity: Minor
                        Found in kiwi/data/encoders/field_encoders.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def __init__(self, inputs_dims, config):
                                super().__init__(config=config)
                        
                                self.features_dims = inputs_dims
                        
                        
                        Severity: Minor
                        Found in kiwi/systems/decoders/linear.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def __init__(self, num_embeddings: int, pad_idx: int, config: Config, vectors=None):
                                """A model for embedding a single type of tokens."""
                                super().__init__()
                                self.pad_idx = pad_idx
                        
                        
                        Severity: Minor
                        Found in kiwi/modules/token_embeddings.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def forward(
                                self,
                                batch_inputs,
                                *args,
                                include_target_logits=False,
                        Severity: Minor
                        Found in kiwi/systems/encoders/bert.py - About 25 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

                        Severity
                        Category
                        Status
                        Source
                        Language