Skip to content

Fix "similar-code" issue in project/main/same_function_helper.py #98

Description

@SabCampos

The same_function_helper.py file contains multiple functions that are reused all over the API.

CodeClimate has found the following issue:
Similar blocks of code found in 3 locations. Consider refactoring.

The following blocks of code may be replaced with a function that can be called multiple times.

  def getQhawaxOnLoop(qhawax_name):
      if(qhawaxExistBasedOnName(qhawax_name)):
          return session.query(Qhawax.on_loop).filter_by(name=qhawax_name).one()[0]
      return None
  
  def getQhawaxStatus(qhawax_name):
      if(qhawaxExistBasedOnName(qhawax_name)):
          return session.query(Qhawax.state).filter_by(name=qhawax_name).one()[0]
      return None
  
  def queryQhawaxType(name):
      if(qhawaxExistBasedOnName(name)):
          return session.query(Qhawax.qhawax_type).filter_by(name=name).one()[0]
      return None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions