dead-code

Finding unused (aka “dead”) code in Delphi

拥有回忆 提交于 2019-11-30 11:49:44
Are there any tools that can determine if a function/procedure/method/entire class is used? I've seen tools that can help a knowledgeable developer track down unused fragments of code (most are for languages other than Delphi) but most have a steep learning curve and/or require considerable digging to determine if a code fragment is used or not. Delphi's smart linker purportedly does this to reduce the size of the final executable. Unfortunately what little information is given on the smart linker doesn't indicate a way to retrieve what was culled from the hurd. Admittedly, even if it is

How to remove dead code from Javascript [duplicate]

霸气de小男生 提交于 2019-11-30 08:38:07
This question already has an answer here: find dead JavaScript code? 7 answers I am trying to remove unused functions from my project. Since it has thousands of lines, this takes forever. Code coverage tools may suggest functions that are not used in a given test case, but it may be dangerous to rely only on this. Is there another tool which can help with this? You can try Google Closure compiler. It has different settings and you can also remove dead code automatically. You can try it here: http://closure-compiler.appspot.com/home For more info read here: http://code.google.com/closure

Using GCC to find unreachable functions (“dead code”)

懵懂的女人 提交于 2019-11-30 02:42:10
问题 Hey guys, I was looking for a way of finding statically unreachable functions in a (very) big C++ project. I had tried using doxygen and other static analysis tools suggested here but it seemed that the project is too complicated for them to handle. Finally i decided that using GCC tools (g++, gprof, gcov, etc.) is the safest option, although i couldn't figure out how to do it. I think the g++ optimizations eliminate statically unreachable functions but I'm not sure how to get the names of

How to find dead code in a large react project?

≡放荡痞女 提交于 2019-11-29 19:19:58
问题 In order to refactor a client-side project, i'm looking for a safe way to find (and delete) unused code. What tools do you use to find unused/dead code in large react projects? Our product has been in development for some years, and it is getting very hard to manually detect code that is no longer in use. We do however try to delete as much unused code as possible. Suggestions for general strategies/techniques (other than specific tools) are also appreciated. Thank you 回答1: First of all, very

Finding unused (aka “dead”) code in Delphi

偶尔善良 提交于 2019-11-29 17:43:23
问题 Are there any tools that can determine if a function/procedure/method/entire class is used? I've seen tools that can help a knowledgeable developer track down unused fragments of code (most are for languages other than Delphi) but most have a steep learning curve and/or require considerable digging to determine if a code fragment is used or not. Delphi's smart linker purportedly does this to reduce the size of the final executable. Unfortunately what little information is given on the smart

static variable initialisation code never gets called

风流意气都作罢 提交于 2019-11-29 16:28:35
I've got an application that's using a static library I made. One .cpp file in the library has a static variable declaration, whose ctor calls a function on a singleton that does something- e.g. adds a string. Now when I use that library from the application, my singleton doesn't seem to contain any traces of the string that was supposed to be added. I'm definitely missing something but I don't know what.. If you have an object in a static library that is not EXPLICITLY used in the application. Then the linker will not pull that object from the lib into the application. There is a big

How to remove dead code from Javascript [duplicate]

人走茶凉 提交于 2019-11-29 11:39:05
问题 This question already has an answer here: find dead JavaScript code? 8 answers I am trying to remove unused functions from my project. Since it has thousands of lines, this takes forever. Code coverage tools may suggest functions that are not used in a given test case, but it may be dangerous to rely only on this. Is there another tool which can help with this? 回答1: You can try Google Closure compiler. It has different settings and you can also remove dead code automatically. You can try it

javac code elimination capabilities

佐手、 提交于 2019-11-29 10:32:47
I'm having a hard time finding information about javac 's code elimination capabilities: I read that if you have something like the following, the if -statement will be eliminated: static final boolean DEBUG = false; if (DEBUG) System.out.println("Hello World!"); // will be removed But how about this, for example: static final int VALUE = 3; if (VALUE > 9) System.out.println("VALUE > 9 ???"); // will this be removed? Or this: static final SomeEnum VALUE = SomeEnum.FOO; if (VALUE==SomeEnum.BAR) System.out.println("Bar???"); // will this be removed? Since it's very difficult/impossible to

How find all unused classes in Intellij Idea?

谁说我不能喝 提交于 2019-11-27 17:04:14
There is an inspection "Unused declaration" which can find all unused code in Intellij Idea. (see this question ) But I want to find all unused classes, not methods, variables etc. Only classes. (it is difficult to find only classes in 3000 result list). How I can do that? BlondCode Press Ctrl + Shift + A (in Mac Command + Shift + A ) Enter "unused declar" Double-click on "Unused declaration" Settings will pop up Click on Java/Declaration redundancy/Unused declaration on the right bottom select "On the fly editor settings" untick check fields, ..., check parameters. Only Check Classes should

How can you tell if a PL/SQL Package, Procedure, or Function is being used?

℡╲_俬逩灬. 提交于 2019-11-27 12:59:32
问题 How can you tell if a PL/SQL Package, Procedure, or Function is being used? Is there an Oracle table or view that contains statistics on PL/SQL Package, Procedure, or Function usage? 回答1: You can also try querying USER/ALL_source: SELECT * FROM all_source where UPPER(TEXT) like UPPER('%procedure_name%') or SELECT * FROM all_source where UPPER(TEXT) like UPPER('%package.function_name%') You'll have to ignore self references, but that should be easy to spot. You'll also need to check "view"