How to count lines of Java code using IntelliJ IDEA?

前端 未结 9 476
慢半拍i
慢半拍i 2020-12-07 09:25

How to count lines of Java code using IntelliJ IDEA?

相关标签:
9条回答
  • 2020-12-07 09:36

    Quick and dirty way is to do a global search for '\n'. You can filter it any way you like on file extensions etc.

    Ctrl-Shift-F -> Text to find = '\n' -> Find.

    Edit: And 'regular expression' has to be checked.

    0 讨论(0)
  • 2020-12-07 09:36

    Just like Neil said:

    Ctrl-Shift-F -> Text to find = '\n' -> Find.

    With only one improvement, if you enter "\n+", you can search for non-empty lines

    If lines with only whitespace can be considered empty too, then you can use the regex "(\s*\n\s*)+" to not count them.

    0 讨论(0)
  • 2020-12-07 09:38

    The Statistic plugin worked for me.

    To install it from Intellij:

    File - Settings - Plugins - Browse repositories... Find it on the list and double-click on it.

    Open statistics window from:

    View -> Tool Windows -> Statistic

    0 讨论(0)
  • 2020-12-07 09:39

    Although it is not an IntelliJ option, you could use a simple Bash command (if your operating system is Linux/Unix). Go to your source directory and type:

    find . -type f -name '*.java' | xargs cat | wc -l
    
    0 讨论(0)
  • 2020-12-07 09:41

    Statistic plugins works fine!

    Here is a quick case:

    1. Ctrl+Shift+A and serach for "Statistic" to open the panel.
    2. You will see panel as the screenshot and then click Refresh for whole project or select your project or file and Refresh on selection for only selection.

    0 讨论(0)
  • 2020-12-07 09:43

    now 2 versions of metricsreloaded available. One supported on v9 and v10 isavailable here http://plugins.intellij.net/plugin/?idea&id=93

    0 讨论(0)
提交回复
热议问题