From nobody Fri Nov 14 21:03:05 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1760191715; cv=none; d=zohomail.com; s=zohoarc; b=Jgv8EOmuXpj0gkKYARcd0srGtQj+hephajv94eFoymJ6rqKA52917NCb82VLNj0PCSoAHKRzMOxyZceBdLKAI6DH1Ua976iqFKOOW2B8+SVEbhBKv3YYHNLiHcuM/u1oIVgg6ZrbUiFqorI+r2ek4YhB1e0uDJP53105MZPTGFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760191715; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sM4YrvUNO+2zghtH3aLu00wsMr94BOpnclkexE7YIug=; b=f5e7a7IxF0sp7YJQVin+43p/zFfkOaW2ATYDiqBagIHeYs5Pj06OoVVHv5mjOrjb54l0G2rJuRDA3W89piZTKfDpganiu6q61r07JP6cX6ZPupJk6hjJJOETQznBHdBDlZAIYrjkxtiLOOyDvF1HiJAN1xihk5iZ6MZa7WdvAxs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1760191715723785.8063853867689; Sat, 11 Oct 2025 07:08:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v7a70-00061A-UC; Sat, 11 Oct 2025 09:58:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v7a6x-00060w-W5 for qemu-devel@nongnu.org; Sat, 11 Oct 2025 09:58:16 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v7a6r-0004cN-Cs for qemu-devel@nongnu.org; Sat, 11 Oct 2025 09:58:15 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1f:3a87:0:640:845c:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 666D4C0193; Sat, 11 Oct 2025 16:57:57 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:a4b::1:3c]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id uvMPBZ1FEOs0-V3WhyNtC; Sat, 11 Oct 2025 16:57:57 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1760191077; bh=sM4YrvUNO+2zghtH3aLu00wsMr94BOpnclkexE7YIug=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=hAw6yIMPaMEPLtOYm+bIhh+ZtNH2iwUkeRmw+iEQ/9+s8JRYkYhdVdvd8rxG7IZVn hiheKZStbSbjqYrBGlbmfJTG3eQTafOsn0bMWY1XEDtiX4zyco8qt1W8DHgGXDOZRu VGgatDdKiKJBMGCD0HSUDhj7r1U0jhWE01EuKDQg= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: armbru@redhat.com Cc: qemu-devel@nongnu.org, vsementsov@yandex-team.ru, eblake@redhat.com, Michael Roth Subject: [PATCH 01/33] qapi: Add documentation format validation Date: Sat, 11 Oct 2025 16:56:42 +0300 Message-ID: <20251011135754.294521-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251011135754.294521-1-vsementsov@yandex-team.ru> References: <20251011135754.294521-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1760191717550154100 Content-Type: text/plain; charset="utf-8" Add explicit validation for QAPI documentation formatting rules: 1. Lines must not exceed 70 columns in width (including '# ' prefix) 2. Sentences must be separated by two spaces Signed-off-by: Vladimir Sementsov-Ogievskiy --- scripts/qapi/parser.py | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 9fbf80a541..2c76686fc4 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -428,7 +428,44 @@ def get_doc_line(self) -> Optional[str]: return '' if self.val[1] !=3D ' ': raise QAPIParseError(self, "missing space after #") - return self.val[2:].rstrip() + + line =3D self.val[2:].rstrip() + + self._validate_doc_line_format(line) + + return line + + def _validate_doc_line_format(self, line: str) -> None: + """ + Validate documentation format rules for a single line: + 1. Lines should not exceed 70 columns + 2. Sentences should be separated by two spaces + """ + # Check 70-column width rule + full_line_length =3D len(line) + 2 # "# " =3D 2 characters + if full_line_length > 70: + # Skip URL lines - they can't be broken + stripped_line =3D line.strip() + if (stripped_line.startswith(('http://', 'https://', 'ftp://')= ) and + ' ' not in stripped_line): + pass + else: + raise QAPIParseError( + self, f"documentation line exceeds 70 columns " + f"({full_line_length} columns): {line[:50]}..." + ) + + single_space_pattern =3D r'[.!?] [A-Z0-9]' + for m in list(re.finditer(single_space_pattern, line)): + left =3D line[0:m.start() + 1] + # Ignore abbreviations and numbered lists + if left.endswith('e.g.') or re.fullmatch(r' *\d\.', left): + continue + raise QAPIParseError( + self, f"documentation has single space after sentence " + f"ending. Use two spaces between sentences: " + f"...{line[m.start()-5:m.end()+5]}..." + ) =20 @staticmethod def _match_at_name_colon(string: str) -> Optional[Match[str]]: --=20 2.48.1