code-metrics

How to use IntelliJ IDEA to find all unused code?

Deadly 提交于 2019-11-27 05:56:25
When I am in a .java file the unused code is usually grayed out or has a green underline saying this code will probably (probably because of some weird JNI/Reflection corner cases) be unused. But I have this project with thousands of Java files and I want to find ALL INSTANCES of such probable-unused codes. How can I do that in IntelliJ IDEA? CrazyCoder Just use Analyze | Inspect Code with appropriate inspection enabled ( Unused declaration under Declaration redundancy group). Using IntelliJ 11 CE you can now "Analyze | Run Inspection by Name ... | Unused declaration" In latest IntelliJ

How to find out how many lines of code there are in an Xcode project?

跟風遠走 提交于 2019-11-27 05:45:29
Is there a way to determine how many lines of code an Xcode project contains? I promise not to use such information for managerial measurement or employee benchmarking purposes. ;) Nathan Kinsinger Check out CLOC . cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. ( Legacy builds are archived on SourceForge .) Joshua Nozzi I see this floating around and use it myself: find . "(" -name "*.m" -or -name "*.mm" -or -name "*.cpp" -or -name "*.swift" ")" -print0 | xargs -0 wc -l tiguero I have been using CLOC as mentioned by Nathan Kinsinger and

What is the fascination with code metrics? [closed]

烂漫一生 提交于 2019-11-26 19:19:24
I've seen a number of 'code metrics' related questions on SO lately, and have to wonder what the fascination is? Here are some recent examples: what code metrics convince you that provided code is crappy when if ever is number of lines of code a useful metric writing quality tests In my mind, no metric can substitute for a code review, though: some metrics sometimes may indicate places that need to be reviewed, and radical changes in metrics over short time frames may indicate places that need to be reviewed But I cannot think of a single metric that by itself always indicates 'good' or 'bad'

How to find out how many lines of code there are in an Xcode project?

喜欢而已 提交于 2019-11-26 11:44:11
问题 Is there a way to determine how many lines of code an Xcode project contains? I promise not to use such information for managerial measurement or employee benchmarking purposes. ;) 回答1: Check out CLOC. cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. (Legacy builds are archived on SourceForge.) 回答2: I see this floating around and use it myself: find . "(" -name "*.m" -or -name "*.mm" -or -name "*.cpp" -or -name "*.swift" ")" -print0 |

What is the fascination with code metrics? [closed]

假如想象 提交于 2019-11-26 06:55:29
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I\'ve seen a number of \'code metrics\' related questions on SO lately, and have to wonder what the fascination is? Here are some

What is a reasonable code coverage % for unit tests (and why)? [closed]

空扰寡人 提交于 2019-11-26 02:22:41
If you were to mandate a minimum percentage code-coverage for unit tests, perhaps even as a requirement for committing to a repository, what would it be? Please explain how you arrived at your answer (since if all you did was pick a number, then I could have done that all by myself ;) Jon Limjap This prose by Alberto Savoia answers precisely that question (in a nicely entertaining manner at that!): http://www.artima.com/forums/flat.jsp?forum=106&thread=204677 Testivus On Test Coverage Early one morning, a programmer asked the great master: “I am ready to write some unit tests. What code

What is a reasonable code coverage % for unit tests (and why)? [closed]

你。 提交于 2019-11-26 01:51:01
问题 If you were to mandate a minimum percentage code-coverage for unit tests, perhaps even as a requirement for committing to a repository, what would it be? Please explain how you arrived at your answer (since if all you did was pick a number, then I could have done that all by myself ;) 回答1: This prose by Alberto Savoia answers precisely that question (in a nicely entertaining manner at that!): http://www.artima.com/forums/flat.jsp?forum=106&thread=204677 Testivus On Test Coverage Early one