kjappelbaum/pyepal

View on GitHub
src/pyepal/plotting/__init__.py

Summary

Maintainability
C
1 day
Test Coverage

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert len(indices) > 5, "You need to use at least five points"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(unclassified_points, np.ndarray), "The arguments must be numpy arrays"

Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(y, np.ndarray), "Input array y must be a numpy array"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert y.ndim == 2, "y must be a two-dimensional numpy array"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(y, np.ndarray), "Input array y must be a numpy array"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert len(indices) == len(observations), "The number of indices and observations must be equal"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert (
            len(labels) == num_targets
        ), "If labels are provided the length of the labels list \
            must equal the number of targets"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert (
        len(y) == palinstance.number_design_points
    ), "Length of y must equal the size of the design space"

Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert (
        y.shape[1] == palinstance.ndim
    ), "y needs to be a two-dimensional array which column number \
        equals the number of targets"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert y.ndim == 2, "y must be a two-dimensional numpy array"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert (
        len(y_0) == len(y_1) == len(std_0) == len(std_1) == palinstance.number_design_points
    ), "Make sure that the arrays have the same length"

Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert (
        y.shape[1] == palinstance.ndim
    ), "y needs to be a two-dimensional array which \
        column number equals the number of targets"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(pareto_optimal, np.ndarray), "The arguments must be numpy arrays"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert y.ndim == 1, "Input array y must be one dimensional"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert (
        len(y) == palinstance.number_design_points
    ), "Length of y must equal the size of the design space"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(y, np.ndarray), "Input array y must be a numpy array"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert (
        len(pareto_optimal) == len(non_pareto_points) == len(unclassified_points)
    ), "Make sure that the arrays have the same length"

    # We need numpy arrays as we assume that we can add the arrays
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(non_pareto_points, np.ndarray), "The arguments must be numpy arrays"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert (
        len(y) == palinstance.number_design_points
    ), "Length of y must equal the size of the design space"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert isinstance(array, np.ndarray), "array must be a numpy array"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert len(labels) == num_targets
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

File __init__.py has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Copyright 2020 PyePAL authors
#
# 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 src/pyepal/plotting/__init__.py - About 5 hrs to fix

    Function plot_jointplot has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def plot_jointplot(  # pylint:disable=invalid-name
        y: np.array,
        palinstance: PALBase,
        labels: Union[List[str], None] = None,
        figsize: tuple = (8.0, 6.0),
    Severity: Minor
    Found in src/pyepal/plotting/__init__.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 plot_learning_curve has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def plot_learning_curve(  # pylint:disable=dangerous-default-value, too-many-arguments, too-many-locals
        palinstance,
        observations: np.ndarray,
        indices: np.ndarray = None,
        num_steps: int = 5,
    Severity: Minor
    Found in src/pyepal/plotting/__init__.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 plot_learning_curve has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def plot_learning_curve(  # pylint:disable=dangerous-default-value, too-many-arguments, too-many-locals
    Severity: Major
    Found in src/pyepal/plotting/__init__.py - About 1 hr to fix

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

      def plot_pareto_front_2d(  # pylint:disable=too-many-arguments, invalid-name
      Severity: Major
      Found in src/pyepal/plotting/__init__.py - About 50 mins to fix

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

        def plot_bar_iterations(  # pylint:disable=invalid-name
        Severity: Minor
        Found in src/pyepal/plotting/__init__.py - About 35 mins to fix

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

          def plot_jointplot(  # pylint:disable=invalid-name
          Severity: Minor
          Found in src/pyepal/plotting/__init__.py - About 35 mins to fix

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

            def plot_residuals(  # pylint:disable=invalid-name
            Severity: Minor
            Found in src/pyepal/plotting/__init__.py - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status