mildly interesting: treewide frequency of various checkpatch statistics 2014-03 vs 2015-04
From: Joe Perches
Date: Fri Apr 10 2015 - 14:50:16 EST
A year ago, I posted some treewide checkpatch statistics
https://lkml.org/lkml/2014/3/10/517
using
$ git ls-files | grep "\.[ch]$"| \
while read file ; do \
./scripts/checkpatch.pl -f --strict --show-types --no-summary --emacs --terse $file ; \
done | \
tee -a checkpatch.all
Here's a rerun comparison to next-20150409
The then-current version of checkpatch was used for each run,
so the newer output is slightly more verbose in some types
of errors, especially the "CHECK:SPACING" for spacing around
arithmetic and logic and "CHECK:PARENTHEIS_ALIGNMENT" for
multi-line statements.
Even with the growth of the kernel source code, (33M vs 35M LOC
for .[ch] files) there has been a 5 to 10 % reduction in
several checkpatch message types.
The general upshot is that kernel code is slowly becoming
by one measure stylistically a bit more consistent.
Given the same rate of change, the kernel tree should be
checkpatch clean sometime around 2030.
Or more likely, never...
2014-03 2015-04
338739 ERROR:SPACING | 269775 ERROR:SPACING
241524 WARNING:LONG_LINE | 214863 WARNING:LONG_LINE
152039 WARNING:LEADING_SPACE | 140150 CHECK:SPACING
117364 CHECK:CAMELCASE | 130137 WARNING:LEADING_SPACE
67761 CHECK:PARENTHESIS_ALIGNMENT | 128763 CHECK:PARENTHESIS_ALIGNMENT
56088 WARNING:SPACING | 103220 CHECK:CAMELCASE
53673 ERROR:CODE_INDENT | 48791 CHECK:LINE_SPACING
33378 WARNING:NETWORKING_BLOCK_COMMENT_STYLE | 47649 CHECK:BIT_MACRO
30981 ERROR:TRAILING_WHITESPACE | 38713 ERROR:CODE_INDENT
30443 ERROR:C99_COMMENTS | 33239 WARNING:NETWORKING_BLOCK_COMMENT_STYLE
28698 WARNING:PREFER_PR_LEVEL | 32168 WARNING:SPACING
27895 CHECK:BRACES | 30586 WARNING:LINE_SPACING
26928 WARNING:SPACE_BEFORE_TAB | 29186 CHECK:COMPARISON_TO_NULL
25546 CHECK:AVOID_EXTERNS | 28619 ERROR:TRAILING_WHITESPACE
25209 WARNING:SPLIT_STRING | 26648 CHECK:BRACES
21880 CHECK:SPACING | 25588 WARNING:PREFER_PR_LEVEL
17009 ERROR:COMPLEX_MACRO | 24234 WARNING:SPACE_BEFORE_TAB
16811 ERROR:POINTER_LOCATION | 24132 CHECK:AVOID_EXTERNS
13337 ERROR:OPEN_BRACE | 22583 WARNING:SPLIT_STRING
13331 ERROR:TRAILING_STATEMENTS | 19819 ERROR:COMPLEX_MACRO
12605 CHECK:FSF_MAILING_ADDRESS | 19288 ERROR:C99_COMMENTS
9621 WARNING:BRACES | 15039 ERROR:POINTER_LOCATION
9215 WARNING:NEW_TYPEDEFS | 12270 ERROR:TRAILING_STATEMENTS
8138 WARNING:SUSPECT_CODE_INDENT | 11173 CHECK:FSF_MAILING_ADDRESS
8129 WARNING:PRINTK_WITHOUT_KERN_LEVEL | 10805 ERROR:OPEN_BRACE
7339 CHECK:LOGICAL_CONTINUATIONS | 8611 WARNING:BRACES
7247 ERROR:ASSIGN_IN_IF | 8473 WARNING:NEW_TYPEDEFS
6276 CHECK:MULTIPLE_ASSIGNMENTS | 7265 WARNING:PRINTK_WITHOUT_KERN_LEVEL
6204 WARNING:VOLATILE | 7214 WARNING:SUSPECT_CODE_INDENT
5262 WARNING:QUOTED_WHITESPACE_BEFORE_NEWLINE | 6942 ERROR:ASSIGN_IN_IF
4224 WARNING:EXPORT_SYMBOL | 6919 CHECK:LOGICAL_CONTINUATIONS
4164 ERROR:RETURN_PARENTHESES | 6294 CHECK:MULTIPLE_ASSIGNMENTS
3734 CHECK:ALLOC_SIZEOF_STRUCT | 6220 WARNING:VOLATILE
3701 CHECK:UNCOMMENTED_DEFINITION | 5136 CHECK:UNNECESSARY_PARENTHESES
3651 CHECK:USLEEP_RANGE | 5074 WARNING:QUOTED_WHITESPACE_BEFORE_NEWLINE
3623 CHECK:ARCH_INCLUDE_LINUX | 4039 ERROR:RETURN_PARENTHESES
3597 WARNING:AVOID_EXTERNS | 3989 CHECK:TYPO_SPELLING
3241 ERROR:ELSE_AFTER_BRACE | 3957 CHECK:UNCOMMENTED_DEFINITION
2995 WARNING:MEMORY_BARRIER | 3859 WARNING:EXPORT_SYMBOL
2338 WARNING:CONSTANT_CONVERSION | 3704 CHECK:ALLOC_SIZEOF_STRUCT
2298 WARNING:PREFER_PACKED | 3616 CHECK:USLEEP_RANGE
2165 WARNING:INCLUDE_LINUX | 3395 WARNING:AVOID_EXTERNS
2032 CHECK:REDUNDANT_CODE | 2875 WARNING:MEMORY_BARRIER
1898 WARNING:MSLEEP | 2349 WARNING:UNNECESSARY_ELSE
1884 WARNING:MISSING_BREAK | 2208 WARNING:PREFER_PACKED
1855 WARNING:PREFER_ETHER_ADDR_COPY | 2074 ERROR:ELSE_AFTER_BRACE
1839 WARNING:SIZEOF_PARENTHESIS | 2049 WARNING:CONSTANT_CONVERSION
1793 WARNING:STATIC_CONST_CHAR_ARRAY | 1910 CHECK:REDUNDANT_CODE
1773 ERROR:BRACKET_SPACE | 1901 CHECK:ARCH_INCLUDE_LINUX
1664 WARNING:INDENTED_LABEL | 1826 WARNING:STATIC_CONST_CHAR_ARRAY
1509 WARNING:LINE_CONTINUATIONS | 1807 WARNING:RETURN_VOID
1376 WARNING:PREFER_SEQ_PUTS | 1804 WARNING:MSLEEP
1363 WARNING:DEEP_INDENTATION | 1708 ERROR:BRACKET_SPACE
1316 ERROR:INITIALISED_STATIC | 1691 WARNING:OOM_MESSAGE
1235 CHECK:BOOL_COMPARISON | 1677 WARNING:SIZEOF_PARENTHESIS
1181 ERROR:SWITCH_CASE_INDENT_LEVEL | 1622 WARNING:INCLUDE_LINUX
1156 WARNING:CONSIDER_KSTRTO | 1601 WARNING:INDENTED_LABEL
1129 ERROR:MULTISTATEMENT_MACRO_USE_DO_WHILE | 1509 WARNING:PREFER_ETHER_ADDR_COPY
889 WARNING:MISPLACED_INIT | 1491 WARNING:TRAILING_SEMICOLON
759 CHECK:INVALID_UTF8 | 1250 WARNING:LINE_CONTINUATIONS
730 WARNING:INLINE | 1142 ERROR:INITIALISED_STATIC
723 WARNING:SINGLE_STATEMENT_DO_WHILE_MACRO | 1115 ERROR:SWITCH_CASE_INDENT_LEVEL
691 WARNING:CVS_KEYWORD | 1114 ERROR:MULTISTATEMENT_MACRO_USE_DO_WHILE
632 WARNING:PREFER_ALIGNED | 1101 CHECK:CONCATENATED_STRING
465 CHECK:UNDOCUMENTED_SETUP | 1071 WARNING:DEEP_INDENTATION
463 WARNING:CONST_STRUCT | 981 WARNING:CONSIDER_KSTRTO
400 WARNING:MINMAX | 965 WARNING:PREFER_SEQ_PUTS
336 WARNING:GCC_BINARY_CONSTANT | 787 CHECK:BOOL_COMPARISON
311 CHECK:ARCH_DEFINES | 731 WARNING:SINGLE_STATEMENT_DO_WHILE_MACRO
301 ERROR:INIT_ATTRIBUTE | 721 WARNING:UNDOCUMENTED_DT_STRING
298 WARNING:PREFER_DEV_LEVEL | 684 WARNING:ALLOC_WITH_MULTIPLY
286 WARNING:DEFINE_PCI_DEVICE_TABLE | 683 CHECK:INVALID_UTF8
285 WARNING:NR_CPUS | 679 WARNING:INLINE
230 WARNING:PRINTF_L | 668 WARNING:CVS_KEYWORD
222 WARNING:USE_NEGATIVE_ERRNO | 644 WARNING:CONST_STRUCT
208 WARNING:NEEDLESS_IF | 628 WARNING:MISPLACED_INIT
206 WARNING:NAKED_SSCANF | 600 WARNING:PREFER_ALIGNED
200 WARNING:STORAGE_CLASS | 520 WARNING:MISSING_SPACE
173 WARNING:UNNECESSARY_PARENTHESES | 478 CHECK:UNDOCUMENTED_SETUP
172 WARNING:PRINTK_RATELIMITED | 451 WARNING:STRING_FRAGMENTS
147 ERROR:DEFINE_ARCH_HAS | 420 WARNING:GCC_BINARY_CONSTANT
132 WARNING:USE_DEVICE_INITCALL | 382 WARNING:MACRO_WITH_FLOW_CONTROL
128 WARNING:DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON | 360 WARNING:SSCANF_TO_KSTRTO
103 WARNING:LINUX_VERSION_CODE | 356 WARNING:MINMAX
93 WARNING:JIFFIES_COMPARISON | 342 WARNING:UNNECESSARY_BREAK
89 WARNING:USE_FUNC | 319 CHECK:ARCH_DEFINES
> 315 WARNING:PREFER_DEV_LEVEL
> 263 WARNING:NR_CPUS
> 230 ERROR:INIT_ATTRIBUTE
> 192 WARNING:STORAGE_CLASS
> 187 WARNING:PRINTF_L
> 169 WARNING:PRINTK_RATELIMITED
> 165 WARNING:NAKED_SSCANF
> 137 WARNING:MISORDERED_TYPE
> 136 WARNING:ARRAY_SIZE
> 136 ERROR:DEFINE_ARCH_HAS
> 126 WARNING:USE_DEVICE_INITCALL
> 126 WARNING:UNNECESSARY_KERN_LEVEL
> 119 WARNING:NEEDLESS_IF
> 111 WARNING:DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON
> 107 WARNING:USE_NEGATIVE_ERRNO
> 107 WARNING:UNNECESSARY_PARENTHESES
77 WARNING:DEFAULT_NO_BREAK 77 WARNING:DEFAULT_NO_BREAK
74 ERROR:FUNCTION_WITHOUT_ARGS | 66 ERROR:INLINE_LOCATION
68 ERROR:INLINE_LOCATION | 63 ERROR:FUNCTION_WITHOUT_ARGS
55 WARNING:PREFER_PRINTF | 52 WARNING:PREFER_PRINTF
52 ERROR:WHILE_AFTER_BRACE | 49 ERROR:WHILE_AFTER_BRACE
44 WARNING:IN_ATOMIC 44 WARNING:IN_ATOMIC
41 ERROR:GLOBAL_INITIALISERS | 43 WARNING:LINUX_VERSION_CODE
40 WARNING:YIELD | 43 WARNING:JIFFIES_COMPARISON
39 WARNING:LONG_UDELAY | 39 WARNING:YIELD
36 WARNING:__GFP_NOFAIL | 38 ERROR:GLOBAL_INITIALISERS
34 WARNING:MEMSET | 34 WARNING:ONE_SEMICOLON
34 WARNING:CONSIDER_COMPLETION | 32 WARNING:CONSIDER_COMPLETION
31 WARNING:ONE_SEMICOLON | 30 WARNING:LONG_UDELAY
25 WARNING:USLEEP_RANGE | 28 WARNING:MEMSET
20 ERROR:IN_ATOMIC | 27 ERROR:WEAK_DECLARATION
12 WARNING:TRAILING_SEMICOLON | 20 WARNING:USLEEP_RANGE
10 WARNING:UNNECESSARY_CASTS | 18 ERROR:IN_ATOMIC
> 17 WARNING:EXPORTED_WORLD_WRITABLE
> 15 ERROR:EXPORTED_WORLD_WRITABLE
10 ERROR:NON_OCTAL_PERMISSIONS 10 ERROR:NON_OCTAL_PERMISSIONS
8 ERROR:SSYNC 8 ERROR:SSYNC
8 ERROR:CSYNC 8 ERROR:CSYNC
6 WARNING:USE_SPINLOCK_T 6 WARNING:USE_SPINLOCK_T
5 WARNING:KREALLOC_ARG_REUSE | 6 WARNING:UNNECESSARY_CASTS
5 WARNING:FUNCTION_ARGUMENTS | 6 WARNING:KREALLOC_ARG_REUSE
4 ERROR:MISPLACED_INIT | 5 WARNING:CONST_CONST
3 WARNING:HOTPLUG_SECTION | 4 WARNING:MISSING_BREAK
3 ERROR:LOCKDEP | 4 ERROR:LOCKDEP
2 WARNING:EXPORTED_WORLD_WRITABLE | 3 WARNING:SIZEOF_ADDRESS
1 WARNING:SIZEOF_ADDRESS | 3 WARNING:MASK_THEN_SHIFT
1 WARNING:PREFER_SCANF | 3 WARNING:FUNCTION_ARGUMENTS
1 ERROR:UAPI_INCLUDE | 3 WARNING:DEFINE_PCI_DEVICE_TABLE
1 ERROR:MALFORMED_INCLUDE | 2 WARNING:PREFER_SCANF
1 ERROR:DOS_LINE_ENDINGS | 2 ERROR:UAPI_INCLUDE
> 2 ERROR:MISPLACED_INIT
> 2 ERROR:DATE_TIME
> 1 WARNING:LIKELY_MISUSE
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/