有点像格雷普,但不太像
not-grep的Python项目详细描述
not-grep有点像grep,但不同。在
哇?在
如果您曾经需要检查文件中的特定模式, 您可能使用了grep。在
grep FooClassName file.py
如果您需要对许多文件执行此操作,则可以将其与find结合使用。在
^{pr2}$这对一次性支票很有效 但如果你需要反复做这些检查, 如果你需要做很多这样的检查, 如果您需要在您无权访问grep的地方执行这些检查, 或者如果您需要做grep不能做的事情。在
不是格雷普吗?在
not-grep是为静态使用而设计的,而不是临时使用。 例如,作为连续集成测试套件的一部分。 这就是为什么它从配置文件而不是CLI获取配置。 因此,not-grepCLI非常简单: 您只能指定配置文件和详细信息。在
not-grep --config config.toml -vv
在配置文件中,事情开始变得有趣起来。在
not-grep是围绕checker插件构建的。 每个插件都将地图作为输入: 要检查的文件的文件全局模式 以及一个值,该值告诉插件如何处理该文件。在
配置文件是TOML表的集合。 表名标识插件 表成员是插件的输入。在
# The "include" checker will error unless the specified value is include.[include]"src/**/*.py"="__all__"# The "exclude" checker will error if the specified value is include.[exclude]"src/**/*.py"="FooClassName"
输出显示,对于每个插件, 每个匹配的文件是否满足插件要求。 在较低的详细级别中,not-grep只显示失败的检查。在
$ not-grep --config config.toml -vv ================Running include checks================ -----------Checking src/**/*.py for pattern----------- __all__ ****************************************************** src/foo/__init__.py.............................. PASS src/foo/bar.py................................... FAIL================Running exclude checks================ -----------Checking src/**/*.py for pattern----------- FooClassName ****************************************************** src/foo/__init__.py.............................. PASS src/foo/bar.py................................... PASS
太棒了!我可以在GitHub操作中使用它吗?在
是的。是的,你可以。在
-uses:mattsb42/not-grep@masterwith:# If you don't set config-file the action uses ".github/not-grep.toml".config-file:./github/config/check-things.toml# If you don't set debug, passing checks will be hidden.debug:true
- 项目
标签: