neka-nat/tensorboard-chainer

View on GitHub
tb_chainer/summary.py

Summary

Maintainability
A
1 hr
Test Coverage

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

def image(tag, tensor):
    """Outputs a `Summary` protocol buffer with images.
    The summary has up to `max_images` summary values containing images. The
    images are built from `tensor` which must be 3-D with shape `[height, width,
    channels]` and where `channels` can be:
Severity: Minor
Found in tb_chainer/summary.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 video has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def video(tag, tensor, fps):
    tag = _clean_tag(tag)
    assert isinstance(tensor, np.ndarray) or isinstance(tensor, cupy.ndarray), 'input tensor should be one of numpy.ndarray, cupy.ndarray'
    if isinstance(tensor, np.ndarray):
        xp = np
Severity: Minor
Found in tb_chainer/summary.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

There are no issues that match your filters.

Category
Status