private-dreamnet/dreampower

View on GitHub
src/transform/gan/model.py

Summary

Maintainability
A
1 hr
Test Coverage

Function __define_g has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __define_g(
Severity: Major
Found in src/transform/gan/model.py - About 1 hr to fix

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

        def __encode_input(
    Severity: Minor
    Found in src/transform/gan/model.py - About 35 mins to fix

      Method "__define_g" has 11 parameters, which is greater than the 7 authorized.
      Open

                  self,
                  input_nc,
                  output_nc,
                  ngf,
                  net_g,
      Severity: Major
      Found in src/transform/gan/model.py by sonar-python

      A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

      Noncompliant Code Example

      With a maximum number of 4 parameters:

      def do_something(param1, param2, param3, param4, param5):
          ...
      

      Compliant Solution

      def do_something(param1, param2, param3, param4):
          ...
      

      Rename field "dataloader"
      Open

              self.dataloader = FastDataLoader(
      Severity: Major
      Found in src/transform/gan/model.py by sonar-python

      It's confusing to have a class member with the same name (case differences aside) as its enclosing class. This is particularly so when you consider the common practice of naming a class instance for the class itself.

      Best practice dictates that any field or member with the same name as the enclosing class be renamed to be more descriptive of the particular aspect of the class it represents or holds.

      Noncompliant Code Example

      class Foo:
        foo = ''
      
        def getFoo(self):
          ...
      
      foo = Foo()
      foo.getFoo() # what does this return?
      

      Compliant Solution

      class Foo:
        name = ''
      
        def getName(self):
          ...
      
      foo = Foo()
      foo.getName()
      

      There are no issues that match your filters.

      Category
      Status