q-optimize/c3

View on GitHub
c3/utils/tf_utils.py

Summary

Maintainability
B
6 hrs
Test Coverage

File tf_utils.py has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Various utility functions to speed up tensorflow coding."""

import numpy as np
import tensorflow as tf
from tensorflow.python.client import device_lib
Severity: Minor
Found in c3/utils/tf_utils.py - About 6 hrs to fix

    Remove this commented out code.
    Open

    #
    Severity: Major
    Found in c3/utils/tf_utils.py by sonar-python

    Programmers should not comment out code as it bloats programs and reduces readability.

    Unused code should be deleted and can be retrieved from source control history if required.

    See

    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

    Rename function "Id_like" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
    Invalid

    def Id_like(A):
    Severity: Major
    Found in c3/utils/tf_utils.py by sonar-python

    Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

    Noncompliant Code Example

    With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

    def MyFunction(a,b):
        ...
    

    Compliant Solution

    def my_function(a,b):
        ...
    

    There are no issues that match your filters.

    Category
    Status