neka-nat/tensorboard-chainer

View on GitHub

Showing 19 of 28 total issues

File summary_pb2.py has 489 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: tb_chainer/src/summary.proto

import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
Severity: Minor
Found in tb_chainer/src/summary_pb2.py - About 7 hrs to fix

    Function make_grid has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def make_grid(tensor, nrow=8, padding=2,
                  normalize=False, range=None, scale_each=False, pad_value=0):
        """Make a grid of images.
    
        Args:
    Severity: Minor
    Found in tb_chainer/utils.py - About 4 hrs 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

    File attr_value_pb2.py has 343 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # Generated by the protocol buffer compiler.  DO NOT EDIT!
    # source: tb_chainer/src/attr_value.proto
    
    import sys
    _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
    Severity: Minor
    Found in tb_chainer/src/attr_value_pb2.py - About 4 hrs to fix

      File event_pb2.py has 343 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Generated by the protocol buffer compiler.  DO NOT EDIT!
      # source: tb_chainer/src/event.proto
      
      import sys
      _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
      Severity: Minor
      Found in tb_chainer/src/event_pb2.py - About 4 hrs to fix

        Function build_computational_graph has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        def build_computational_graph(
                outputs, remove_split=True, variable_style='default',
                function_style='default', rankdir='TB', remove_variable=False,
                show_name=True):
            """Builds a graph of functions and variables backward-reachable from outputs.
        Severity: Minor
        Found in tb_chainer/graph.py - About 3 hrs 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 add_all_variable_images has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_all_variable_images(self, last_var, exclude_params=True, global_step=None, pattern='.*'):
                cp = re.compile(pattern)
                g = build_computational_graph(last_var)
                names = NodeName(g.nodes)
                for n in g.nodes:
        Severity: Minor
        Found in tb_chainer/writer.py - About 2 hrs 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

        File writer.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
        #
        # Licensed under the Apache License, Version 2.0 (the "License");
        # you may not use this file except in compliance with the License.
        # You may obtain a copy of the License at
        Severity: Minor
        Found in tb_chainer/writer.py - About 2 hrs to fix

          Function make_list_of_nodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def make_list_of_nodes(fn):
              list_of_nodes = []
              g = build_computational_graph(fn)
              node_name = NodeName(g.nodes)
              for n in g.nodes:
          Severity: Minor
          Found in tb_chainer/graph.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 save_image has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def save_image(tensor, filename, nrow=8, padding=2,
          Severity: Major
          Found in tb_chainer/utils.py - About 1 hr to fix

            Function base_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def base_name(obj):
                    name_scope = (obj.name_scope + '/') if hasattr(obj, 'name_scope') else ''
                    if hasattr(obj, '_variable') and obj._variable is not None:
                        if isinstance(obj._variable(), chainer.Parameter):
                            return name_scope + (('Parameter_' + obj.name) if obj.name is not None else 'Parameter')
            Severity: Minor
            Found in tb_chainer/graph.py - About 55 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 make_grid has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def make_grid(tensor, nrow=8, padding=2,
            Severity: Major
            Found in tb_chainer/utils.py - About 50 mins to fix

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

              def build_computational_graph(
              Severity: Major
              Found in tb_chainer/graph.py - About 50 mins to fix

                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 convert_dtype has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def convert_dtype(dtype):
                    if dtype == np.float32:
                        return dt.DT_FLOAT
                    elif dtype == np.float64:
                        return dt.DT_DOUBLE
                Severity: Minor
                Found in tb_chainer/graph.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self,
                Severity: Minor
                Found in tb_chainer/writer.py - About 35 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return dt.DT_STRING
                  Severity: Major
                  Found in tb_chainer/graph.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return dt.DT_INT8
                    Severity: Major
                    Found in tb_chainer/graph.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return dt.DT_INT16
                      Severity: Major
                      Found in tb_chainer/graph.py - About 30 mins to fix

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language