The script calls checkpatch.pl on each file, and formats any error messages
to comply with standard compiler error messages:
file_name:line_number:error_message
This is particularly useful when run from within a text editor which can
parse these error messages and show the user a buffer with the file in
question, placing the cursor on the offending line (e.g., Emacs's "M-x
next-error" command, bound by default to C-x `).
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
scripts/check-coding-standards.pl | 59 +++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
create mode 100755 scripts/check-coding-standards.pl
diff --git a/scripts/check-coding-standards.pl b/scripts/check-coding-standards.pl
new file mode 100755
index 0000000..a1ba597
--- /dev/null
+++ b/scripts/check-coding-standards.pl
@@ -0,0 +1,59 @@
+#!/usr/bin/perl -w
+# (c) 2007, Erez Zadok <ezk@cs.sunysb.edu>
+# Licensed under the terms of the GNU GPL License version 2
+#
+# Check one more more files for compliance with coding standards.
+# Outputs standard compiler-error format, one error per line, as follows
+# filename:lineno:errormsg
+# This standard error message can be parsed by various tools, including
+# Emacs's M-x next-error
+#
+# Usage: check-coding-standards.pl file [files...]
+
+
+if (!defined($ARGV[0])) {
+ printf("Usage: $0 file [files...]\n");
+ exit(1);
+}
+
+$msg="";
+$lineno=0;
+foreach $file (@ARGV) {
+ die "$file: $!" unless (-f $file);
+ open(FILE, "diff -u /dev/null $file | perl scripts/checkpatch.pl --no-signoff - |") || die "$file: $!";
+ while (($line = <FILE>)) {
+ chop $line;
+ next if ($line =~ /^$/);
+ if ($line =~ /^ERROR: /) {
+ $msg = $line;
+ next;
+ }
+ if ($line =~ /^WARNING: /) {
+ $msg = $line;
+ next;
+ }
+ if ($line =~ /^CHECK: /) {
+ $msg = $line;
+ next;
+ }
+ if ($line =~ /^#/) {
+ $lineno = (split(/:/, $line))[3];
+ next;
+ }
+ if ($line =~ /^\+/) {
+ if ($lineno > 0) {
+ printf(STDOUT "%s:%d:%s\n", $file, $lineno, $msg);
+ $msg="";
+ $lineno=0;
+ }
+ next;
+ }
+ next if ($line =~ /^\s+\^/);
+ next if ($line =~ /^Your patch has style problems, please review/);
+ next if ($line =~ /^are false positives report them to the/);
+ next if ($line =~ /^CHECKPATCH in MAINTAINERS/);
+ next if ($line =~ /^Your patch has no obvious style problems/);
+ die "unknown output from checkpatch: $line: $.";
+ }
+ close(FILE);
+}
--
1.5.2.2
-
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Riki Oktarianto | [PATCH] Add quirk to set AHCI mode on ICH boards |
| Alex Chiang | [PATCH v5 00/16] PCI: let the core manage slot names |
git: | |
| Sam Song | Fwd: [OT] Re: Git via a proxy server? |
| Toby White | Using Filemerge.app as a git-diff viewer |
| Sam Vilain | [PATCH] git-mergetool: add support for ediff |
| Adrian Bunk | git-revert is a memory hog |
| Marcos Laufer | dmesg IBM x3650 OpenBSD 4.3 |
| Stephan A. Rickauer | Re: New tcp stack attack |
| Richard Stallman | Real men don't attack straw men |
| Ondřej Surý | openbgp not exporing ipv6 to routing tables |
| Michael Chan | [PATCH net-next 2/6] bnx2: Check netif_running() in all ethtool operations. |
| Herbert Xu | Re: xfrm_state locking regression... |
| adobriyan | [PATCH 10/38] netns ct: per-netns expectations |
| Dale Farnsworth | Re: [PATCH 01/39] mv643xx_eth: reverse topological sort of functions |
| How to make my PCIE ATA storage device running in Linux | 8 hours ago | Linux general |
| sata/ide timeout errors on asus server-mb | 11 hours ago | Linux kernel |
| Shared swap partition | 12 hours ago | Linux general |
| usb mic not detected | 16 hours ago | Applications and Utilities |
| Problem in Inserting a module | 17 hours ago | Linux kernel |
| Treason Uncloaked | 22 hours ago | Linux kernel |
| high memory | 3 days ago | Linux kernel |
| semaphore access speed | 3 days ago | Applications and Utilities |
| the kernel how to power off the machine | 3 days ago | Linux kernel |
| Easter Eggs in windows XP | 3 days ago | Windows |
