WeblateOrg / weblate

Function with cyclomatic complexity higher than threshold PY-R1000
Anti-pattern
Minor
4 occurrences in this check
Translation.validate_new_unit_data has a cyclomatic complexity of 20 with "high" risk
1626                skip_existing=True,
1627            )
1628
1629    def validate_new_unit_data(1630        self,
1631        context: str,
1632        source: str | list[str],
Translation.add_unit has a cyclomatic complexity of 45 with "very-high" risk
1370        return result
1371
1372    @transaction.atomic
1373    def add_unit(  # noqa: C9011374        self,
1375        request,
1376        context: str,
Translation.handle_upload has a cyclomatic complexity of 20 with "high" risk
1179        return (0, skipped, accepted, len(store.content_units))
1180
1181    @transaction.atomic
1182    def handle_upload(  # noqa: C9011183        self,
1184        request,
1185        fileobj: BinaryIO,
Translation.check_sync has a cyclomatic complexity of 25 with "high" risk
 318        # Store current unit ID
 319        updated[id_hash] = newunit
 320
 321    def check_sync(self, force=False, request=None, change=None) -> None:  # noqa: C901 322        """Check whether database is in sync with git and possibly updates."""
 323        with sentry_sdk.start_span(op="check_sync", description=self.full_slug):
 324            if change is None: