[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sc_prohibit_magic_number_exit false positive on string
From: |
Jim Meyering |
Subject: |
Re: sc_prohibit_magic_number_exit false positive on string |
Date: |
Sun, 8 Sep 2019 08:19:16 -0700 |
On Sun, Sep 8, 2019 at 6:06 AM Darshit Shah <address@hidden> wrote:
> I just realized that the syntax check rule sc_prohibit_magic_number_exit will
> cause a false positive when it finds the relevant tokens within a string as
> well.
>
> For example, in Wget, we have the following snippet in our tests which trips
> this rule:
>
> > WGET_TEST_EXPECTED_FILES, &(wget_test_file_t []) {
> > { "exit-status.txt", "exit(8)\n" },
> > { NULL } },
>
> I made a very tiny change to the rule in maint.mk(L408) to account for this:
>
> -exclude='exit \(77\)|error ?\(((0|77),|[^,]*)' \
> +exclude='exit \(77\)|error ?\(((0|77),|[^,]*)|"(usage|exit|error).*"'
> \
Hi Darshit, that feels a little too specific.
Did you consider exempting that file from this one check?
You can do that by adding a line like the following to cfg.mk:
exclude_file_name_regexp--sc_prohibit_magic_number_exit =
offending-file-regexp\.c$$