查找完整评论的文件 [英] Find completely commented files
问题描述
在包含大量文件和项目的解决方案中,您将如何查找所有完全注释的文件?我假设此类文件中的每一行代码都以//(或为空)开头.
In a solution with lots of files and projects - how would you find all completely commented files? I assume that every line of code starts with // ( or is empty) in such files.
我正在使用VS 2008,C#,ReSharper.
我知道,通常这样的文件不应该存在-这就是安全的来源...
I am using VS 2008, C#, ReSharper is available.
I know, normally such files should not exist - that's what a source safe is for ...
推荐答案
要查找当前目录中及其下所有文件均以'//'开头的所有文件:
To find all files in and under the current directory in which all lines begin with '//':
find . -type f -exec sh -c 'grep -vq "^//" {} || echo {}' \;
请注意,这将报告空文件.
Note that this will report empty files.
grep的参数可以轻松扩展以解决空格,也可以泛化以匹配任意正则表达式.
The argument to grep can easily be expanded to account for whitespace, or generalized to match an arbitrary regex.
这篇关于查找完整评论的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!