From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Whitcroft <apw@canonical.com>,
LKML <linux-kernel@vger.kernel.org>,
"kernel-mentors@selenic.com" <kernel-mentors@selenic.com>,
kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: external tool to remove embedded filenames
Date: Thu, 01 Oct 2020 11:47:06 -0700 [thread overview]
Message-ID: <bab3ecae932cb41106834156abbd27159d937e67.camel@perches.com> (raw)
In-Reply-To: <1fd5f9188a14acdca703ca00301ee323de672a8d.camel@perches.com>
[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]
It's rather unnecessary for files to contain their
path/filename in source code comments.
Here's a trivial little script that can remove
embedded filenames in c90 style comments from files.
This requires git.
It does the following types of removals:
remove individual lines like /* filename */ completely
remove filename from /* filename -- comment */, leave /* comment */
remove filename and any trailing ' *\n' from /* filename, leave /*
remove filename from /* filename, leave /*
remove filename from continuation ' * filename -- comment' leave ' * comment'
remove filename and any trailing ' *\n' from continuation ' * filename\n *\n'
It seems to work well enough.
It does not handle c99 comments.
No // filename variants are removed.
Running it on today's -next gives:
$ perl remove_embedded_filenames.pl
$ git diff --shortstat
2310 files changed, 354 insertions(+), 4239 deletions(-)
It's also possible to give any filename or path
as an argument to the script
For instance:
$ perl remove_embedded_filenames.pl drivers/net
[-- Attachment #2: remove_embedded_filenames.pl --]
[-- Type: application/x-perl, Size: 2615 bytes --]
next prev parent reply other threads:[~2020-10-01 18:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 18:28 [PATCH] checkpatch: Emit a warning on " Joe Perches
2020-10-01 18:47 ` Joe Perches [this message]
2020-10-02 14:49 ` external tool to remove " Bhaskar Chowdhury
2020-10-02 15:13 ` Joe Perches
2020-10-02 22:18 ` [PATCH] checkpatch: Emit a warning on " Andrew Morton
2020-10-02 23:35 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bab3ecae932cb41106834156abbd27159d937e67.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=kernel-mentors@selenic.com \
--cc=kernelnewbies@kernelnewbies.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®