durandtibo/gravitorch

View on GitHub

Showing 95 of 134 total issues

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

    def __init__(
Severity: Minor
Found in src/gravitorch/models/vanilla.py - About 35 mins to fix

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

        def __init__(
    Severity: Minor
    Found in src/gravitorch/models/metrics/regression/absolute_relative_error.py - About 35 mins to fix

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

          def __init__(
      Severity: Minor
      Found in src/gravitorch/nn/init/kaiming.py - About 35 mins to fix

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

            def __init__(
        Severity: Minor
        Found in src/gravitorch/utils/meters/tensor.py - About 35 mins to fix

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

              def __init__(
          Severity: Minor
          Found in src/gravitorch/utils/history/comparable.py - About 35 mins to fix

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

                def create_linspace_scale(
            Severity: Minor
            Found in src/gravitorch/nn/scalar_encoding.py - About 35 mins to fix

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

              def is_loss_decreasing_with_sgd(
              Severity: Minor
              Found in src/gravitorch/models/utils/testing.py - About 35 mins to fix

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

                def sync_reduce(variable: Union[Tensor, int, float], op: str) -> Union[Tensor, int, float]:
                    r"""Synchronizes all the processes and then reduce the variable.
                
                    This function is a no-operation function if the distributed mode
                    is not activated. It returns the input. If the distributed mode
                Severity: Minor
                Found in src/gravitorch/distributed/ddp.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 human_byte_size has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def human_byte_size(size: int, unit: str | None = None) -> str:
                    r"""Gets a human-readable representation of the byte size.
                
                    Args:
                    ----
                Severity: Minor
                Found in src/gravitorch/utils/format.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

                Avoid too many return statements within this function.
                Open

                        return get_module_input_size(module.self_attn)
                Severity: Major
                Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return _get_sequential_output_size(module)
                  Severity: Major
                  Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return get_module_output_size(module.self_attn)
                    Severity: Major
                    Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return get_module_input_size(module[0])
                      Severity: Major
                      Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return data.to(device)
                        Severity: Major
                        Found in src/gravitorch/utils/device.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return get_module_input_size(module.layers)
                          Severity: Major
                          Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return module.embedding_dim
                            Severity: Major
                            Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return module.embed_dim
                              Severity: Major
                              Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return get_module_output_size(module[0])
                                Severity: Major
                                Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return module.embed_dim
                                  Severity: Major
                                  Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return get_module_output_size(module.layers)
                                    Severity: Major
                                    Found in src/gravitorch/nn/utils/helpers.py - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language