holgern/beem

View on GitHub
beemgraphenebase/prefix.py

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Rename field "prefix"
Open

    prefix = "STM"
Severity: Major
Found in beemgraphenebase/prefix.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