Some regex for detecting code smell or bad code style
Using "Find in path" (cmd + shift + f) and those below can detect code smell or bad code style.
Comments are welcome : )
1. [\n]{4,} | check redundant blank lines.
2. \{[\n]{2,} or [\n]{2,}} | check blank lines around braces
3. [ \t]+$ | line-end white space
4. (=@|=[a-zA-Z0-9]|[a-zA-Z0-9]=) | needs white space around "="
5. ^(?=.{121})(.*[^0-9a-zA-Z].*)$ | code line length check
6. (if|while|for|switch|@property)\( | need white space after those words
7. \][a-zA-Z0-9] | method chain call should contain white space
8. ^(-|\+).*\n\{\n(\n|[^}\n][^\n]*\n){100,}\}\n | the lines count of method, good for big methods
9. \}\n(-|\+) \( | needs blank line between methods
10. ^\s+self\.[A-Z]+ or ^\s+_[A-Z]+ or \*[A-Z]+ | pascal case for variables
Please sign in to leave a comment.