php的代码度量-记事本++

发布于 2024-09-07 05:15:57 字数 120 浏览 1 评论 0原文

我特别想知道有多少行代码,但这跨越了许多文件。

我一直在使用记事本++编写代码,对于每个文件,它确实显示行号,但当然我有空返回以使代码更具可读性。

有谁知道我可以准确获取实际代码行的插件或工具?

In particular, I am interested to know how many lines of codes there are, but this spans across many files.

I have been using notepad++ to author the code and for each file it does display line numbers but of course I have empty returns to make the code more readable.

Does anyone know of a plugin or tool that I can accurately get the actual lines of code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

拒绝两难 2024-09-14 05:15:57
  1. 转到搜索 ->在文件中查找...或使用 Ctrl+Shift+F

    https://i.sstatic.net/V5MKW.png

  2. 查找内容:\S+\s\r\n*

    过滤器:*.php

    搜索模式正则表达式

    点击查找全部

    https://i.sstatic.net/YRXUX.png

  3. 查看下部窗格中的“查找结果”

    https://i.sstatic.net/UpuAQ.png

它并不完美根本没有,但它开箱即用。当然,您也可以更改正则表达式,例如仅计算行数:

  • 仅空白:^\s\r\n*
  • 至少一个字母或数字: \w+.*\r\n
  • 仅用于花括号:^(\s[{}]\s)+ \r\n**
  • 类关键字:class .*\r\n
  • 函数关键字:function .*\r\n
  1. Go to Search -> Find in Files... or use Ctrl+Shift+F

    https://i.sstatic.net/V5MKW.png

  2. Find what: \S+\s\r\n*

    Filters: *.php

    Search Mode Regular expression

    Click Find All

    https://i.sstatic.net/YRXUX.png

  3. See the 'Find result' in the lower pane

    https://i.sstatic.net/UpuAQ.png

It's not perfect at all, but it works out of the box. Of course you can also make changes to the regular expression, like only counting lines with:

  • White space only: ^\s\r\n*
  • At least one letter or number: \w+.*\r\n
  • Which are used solely for curly braces: ^(\s[{}]\s)+\r\n**
  • A class keyword: class .*\r\n
  • A function keyword: function .*\r\n
混浊又暗下来 2024-09-14 05:15:57

谷歌搜索“php sloc 计数器”。有很多工具可以做到这一点,例如:

http: //thecodecentral.com/2007/12/26/source-line-of-code-counter

但是,这种测量绝对没有用,所以我不确定你为什么要这样做。

Google for "php sloc counter". There are plenty of tools to do that, for example:

http://thecodecentral.com/2007/12/26/source-line-of-code-counter

However, this kind of measuring is absolutely useless, so I'm not sure why you would want to do this.

╭ゆ眷念 2024-09-14 05:15:57

Linux:

find -name '*.php' | xargs grep -av '\r' | wc -l

Windows(PowerShell):

(dir -include *.php -recurse | select-string "(?!^$)").count

Linux:

find -name '*.php' | xargs grep -av '\r' | wc -l

Windows (PowerShell):

(dir -include *.php -recurse | select-string "(?!^$)").count
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文