static-analysis

Is there a static analysis tool like Lint or Perl::Critic for shell scripts?

给你一囗甜甜゛ 提交于 2019-11-27 11:01:55
Are there any shell (specifically bash or ksh) checkers that test shell scripts for style, best practices, naming conventions, etc? (Something like Lint for C, or Perl::Critic for Perl.) I know with ksh you can do syntax checking by running ksh -n script.ksh but I was hoping for something more than just sytax checking - something that parses/analyzes the actual code? I'm probably out of luck, but I guess it doesn't hurt to ask. Brian Campbell The Debian and Ubuntu projects use a script checkbashisms , that looks for particular patterns that might indicate that someone is relying on /bin/sh

How to determine maximum stack usage in embedded system with gcc?

烂漫一生 提交于 2019-11-27 10:56:39
I'm writing the startup code for an embedded system -- the code that loads the initial stack pointer before jumping to the main() function -- and I need to tell it how many bytes of stack my application will use (or some larger, conservative estimate). I've been told the gcc compiler now has a -fstack-usage option and -fcallgraph-info option that can somehow be used to statically calculates the exact "Maximum Stack Usage" for me. ( "Compile-time stack requirements analysis with GCC" by Botcazou, Comar, and Hainque ). Nigel Jones says that recursion is a really bad idea in embedded systems (

How to search for Java API methods by type signature?

牧云@^-^@ 提交于 2019-11-27 10:20:42
问题 Are there any open-source tools available which support searching for Java methods by the set of parameter types and return type? As an example, say I'm looking for a method to generate a hash code for an array of ints. I search for a method which takes an int[] parameter and returns an int: int[] -> int yielding java.util.Arrays#hashCode(int[]) ... Or I may want to find a method which takes a String, and character to replace, and the character to replace it with. So I search for a matching

Are C++ static code analyis tools worth it?

試著忘記壹切 提交于 2019-11-27 09:51:47
问题 Our management has recently been talking to some people selling C++ static analysis tools. Of course the sales people say they will find tons of bugs, but I'm skeptical. How do such tools work in the real world? Do they find real bugs? Do they help more junior programmers learn? Are they worth the trouble? 回答1: Static code analysis is almost always worth it. The issue with an existing code base is that it will probably report far too many errors to make it useful out of the box. I once worked

Can Resharper be set to warn if IDisposable not handled correctly?

一曲冷凌霜 提交于 2019-11-27 09:00:47
Is there a setting in Resharper 4 (or even Visual Studio itself...) that forces a warning if I forget to wrap code in a using block, or ommit the proper Dispose call in a finally block? Correct automatic Dispose analysis requires DFA (Data Flow Analysis) in a global way. It is unlikely that you create an IDisposable object and doesn't call any method on it and do not pass it around as an argument. If disposable object is passed to other methods (including calling its members, when "this" is implicitly passed), the tool should analyse if Dispose is not called within, or that object is not

Should useless type qualifiers on return types be used, for clarity?

走远了吗. 提交于 2019-11-27 08:56:54
Our static analysis tool complains about a "useless type qualifier on return type" when we have prototypes in header files such as: const int foo(); We defined it this way because the function is returning a constant that will never change, thinking that the API seemed clearer with const in place. I feel like this is similar to explicitly initializing global variables to zero for clarity, even though the C standard already states that all globals will be initialized to zero if not explicitly initialized. At the end of the day, it really doesn't matter. (But the static analysis tool doesn't

Static Analysis tool recommendation for Java? [closed]

一个人想着一个人 提交于 2019-11-27 06:16:07
Being vaguely familiar with the Java world I was googling for a static analysis tool that would also was intelligent enough to fix the issues it finds. I ran at CodePro tool but, again, I'm new to the Java community and don't know the vendors. What tool can you recommend based on the criteria above? FindBugs, PMD and Checkstyle are all excellent choices especially if you integrate them into your build process. At my last company we also used Fortify to check for potential security problems. We were fortunate to have an enterprise license so I don't know the cost involved. Eduard Wirch Findbugs

Using Contract.ForAll in Code Contracts

狂风中的少年 提交于 2019-11-27 05:54:29
问题 Okay, I have yet another Code Contracts question. I have a contract on an interface method that looks like this (other methods omitted for clarity): [ContractClassFor(typeof(IUnboundTagGroup))] public abstract class ContractForIUnboundTagGroup : IUnboundTagGroup { public IUnboundTagGroup[] GetAllGroups() { Contract.Ensures(Contract.Result<IUnboundTagGroup[]>() != null); Contract.Ensures(Contract.ForAll(Contract.Result<IUnboundTagGroup[]>(), g => g != null)); return null; } } I have code

Are there any JavaScript static analysis tools? [closed]

那年仲夏 提交于 2019-11-27 05:53:17
I'm used to having my compiler complain when I do something stupid like a typo on a variable name but JavaScript has a habit of letting this pass. Are there any static analysis tools for JavaScript? Flash Sheridan I agree that JSLint is the best place to start. Note that JavaScript Lint is distinct from JSLint . I’d also suggest checking out JSure , which in my limited testing did better than either of them, though with some rough edges in the implementation—the Intel Mac version crashed on startup for me, though the PowerPC version ran fine even on Intel, and the Linux version ran fine as

What code analysis tools do you use for your Java projects? [closed]

自作多情 提交于 2019-11-27 04:56:26
问题 What code analysis tools do you use on your Java projects? I am interested in all kinds static code analysis tools (FindBugs, PMD, and any others) code coverage tools (Cobertura, Emma, and any others) any other instrumentation-based tools anything else, if I'm missing something If applicable, also state what build tools you use and how well these tools integrate with both your IDEs and build tools. If a tool is only available a specific way (as an IDE plugin, or, say, a build tool plugin)