Must-share information:
- which versions are you using (SonarQube: 9.8 Enterprise, Scanner :latest)
- how is SonarQube deployed: Helm
- what are you trying to achieve: reduce the reported number of duplicated lines
- what have you tried so far to achieve this read the docs
We have a somewhat standard flask application which uses flask-smorest + blueprint.
In smorest, one makes heavy use of decorators for things like schema definitions, standard responses, query parameters, inline documentation etc.
It’s a very declarative form of structuring a flask web app and this of course leads to duplicated blocks of code:
@bp.response(
schema=ServiceResponseSchema(),
status_code=401,
description="Not Authorized.",
example={"success": False, "errors": ["Not Authorized."]},
)
@bp.response(
schema=ServiceResponseSchema(),
status_code=403,
description="The client is not authorized to perform this operation",
)
@bp.response(
schema=ServiceResponseSchema(),
status_code=404,
description="Event not found.",
example={"success": False, "errors": ["The selected event was not found."]},
)
def something()
these decorators can be found in a lot of places in our code.
How can we configure sonarqube to ignore these types of duplications? They serve a purpose and are required by flask-smorest.