From nobody Wed Jan 15 10:49:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693816323; cv=none; d=zohomail.com; s=zohoarc; b=QhfoN06B2iDOFzShtrLYwclxZdIWMGXD1SmdDMkFnZ7ncJ74ruMa7kP3BOd+gzf46YhXgu3evr4mFvhdltK/Q/6tcCBZM6CL//wbC2dqXl9SUNk2Gd7U1kgICbio5C5gvM1WniEDOgZnavbh8w8iz8/rmBKjv2/OT1IiSpf2toU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693816323; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hBX9zIZfUkEwosRD+AeFDhquzvjP4NAOjvw5OqZWE7Q=; b=ZecTHSPrVRElp2DGvere6oPM3sUTMZX9b4A2hZNPGtNp/3CIY14DRyvqdDihC0unNNXpPaaUG0kGk6awqt+zchQTTKOpN7/264K+YNmHIXDOzGoOqTyhmRAwE704fCQAqK6Vgse1M/C0D0N46a0oY7JQFMRmIAdTC0JbAvHw2VY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1693816323888927.880676987306; Mon, 4 Sep 2023 01:32:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-270-OoJ60GR-MIOXMw9ondpxtA-1; Mon, 04 Sep 2023 04:31:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AAB0038008C3; Mon, 4 Sep 2023 08:31:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84C0840CF8F0; Mon, 4 Sep 2023 08:31:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E522C19465B7; Mon, 4 Sep 2023 08:31:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8D3101946A5E for ; Mon, 4 Sep 2023 08:31:51 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 608D8400D277; Mon, 4 Sep 2023 08:31:51 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0829B40C6CCC for ; Mon, 4 Sep 2023 08:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693816322; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hBX9zIZfUkEwosRD+AeFDhquzvjP4NAOjvw5OqZWE7Q=; b=OLj6pk+c1edAvGetbaTgKCrEPw2Nzrv3wH9/AmQqOCYDMDPGOm4OMLY26rN7c9KqdFnrDg ZMxT+VTnNlbVZXjb5QDaaJnnsPbW28wcx65NX0sKu4ruef5JwGTJHNaGHdwsSehuZUVGro eyBwWw2OwtoP7/VQFrDkZJGF1TXFWVA= X-MC-Unique: OoJ60GR-MIOXMw9ondpxtA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] syntax-check: Introduce a rule for one line error messages Date: Mon, 4 Sep 2023 10:31:48 +0200 Message-ID: <5ccbf7332b65c824c859a29b61364603492434e7.1693816204.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693816326449100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Okay, this is a shortcut. Our coding style says that error messages are exempt from '80 chars long lines' rule. But in the very same paragraph it is said that all error messages need to be marked for translation (as they might be presented to user). Therefore, the syntax-check rule can check if _("...") is formatted on one line. With exception of _("...\n" ...) (e.g. various outputs from helper binaries like leaseshelper, sshhelper, or daemons like lockd, logd). I believe nobody would chose a substring that contains '\n' for git grep-ping the error message. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- build-aux/syntax-check.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 64c1e2773e..618c0546aa 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -440,6 +440,11 @@ sc_prohibit_newline_at_end_of_diagnostic: && { echo 'newline at end of message(s)' 1>&2; \ exit 1; } || : =20 +sc_prohibit_error_message_on_multiple_lines: + @prohibit=3D'[^N]_\(".*[^\\n]"$$' \ + halt=3D'found error message on multiple lines' \ + $(_sc_search_regexp) + # Look for diagnostics that lack a % in the format string, except that we # allow VIR_ERROR to do this, and ignore functions that take a single # string rather than a format argument. @@ -1386,6 +1391,9 @@ exclude_file_name_regexp--sc_prohibit_raw_virclassnew= =3D \ exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic =3D \ ^src/rpc/gendispatch\.pl$$ =20 +exclude_file_name_regexp--sc_prohibit_error_message_on_multiple_lines =3D \ + ^(build-aux/syntax-check\.mk|docs/coding-style.rst) + exclude_file_name_regexp--sc_prohibit_nonreentrant =3D \ ^((po|tests|examples)/|docs/.*(py|js|html\.in|.rst)|run.in$$|tools/wires= hark/util/genxdrstub\.pl|tools/virt-login-shell\.c$$) =20 --=20 2.41.0