【问题标题】:Running cpplint on all .cpp files在所有 .cpp 文件上运行 cpplint
【发布时间】:2021-05-18 19:02:04
【问题描述】:

我想对 Windows CMD 文件夹中的所有 .cpp 文件运行 cpplint.py。

py .\cpplint.py *.cpp

这在某种程度上是行不通的。我得到错误:

Skipping input '*.cpp': Can't open for reading
Total errors found: 0

我以为* 会是全选运算符,我错了吗?

P.S.:有一个类似的 post,但它并没有真正帮助。

【问题讨论】:

  • 你在哪里输入这个命令?
  • 在 Windows 的 CMD 上。

标签: python windows command-line cpplint


【解决方案1】:

您可以在批处理文件或命令行中执行以下操作:

for %%f in (*.cpp) do py .\cpplint.py %%f

【讨论】:

    【解决方案2】:

    Windows 的 CMD 不做通配符扩展:https://superuser.com/questions/460598/is-there-any-way-to-get-the-windows-cmd-shell-to-expand-wildcard-paths

    在 Windows 上将* 扩展为路径取决于应用程序,这与由 shell 本身处理的 Linux 形成鲜明对比。所以你将字符串文字 * 传递给 cpplint.py,它不是一个文件。

    【讨论】:

      猜你喜欢
      • 2015-09-27
      • 2014-02-20
      • 1970-01-01
      • 2012-02-17
      • 2014-03-22
      • 1970-01-01
      • 2021-03-24
      • 1970-01-01
      • 2020-07-04
      相关资源
      最近更新 更多