Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Static code analyzer
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

me76
New Member

Canada
9 Posts

Posted - Aug 13 2024 :  4:56:13 PM  Show Profile  Reply with Quote
Would be awesome to have static code analyzer as part of Visual Assist package. It could be separate executable that would be available in two ways:
1. through a command in Visual Assist menu to analyze the content in current editor;
2. invoking it from command line for a set of source files or for entire project - could be hooked to git commits or used for pre-release code checks.

Give that you guys have already implemented C++ code parser, static code check could be relatively easy implemented on top of that.

Edited by - me76 on Aug 14 2024 4:30:43 PM

feline
Whole Tomato Software

United Kingdom
18934 Posts

Posted - Aug 14 2024 :  08:26:20 AM  Show Profile  Reply with Quote
Have you looked at Code Inspection:

https://www.wholetomato.com/documentation/code-inspection/introduction-to-code-inspection

We are slowly enabling more checks by default, as we get them working well, but you can always enable some of the other checks, which can be shown via the setting:

VA Options -> Code Inspection -> Show Unevaluated Checkers

zen is the art of being at one with the two'ness
Go to Top of Page

me76
New Member

Canada
9 Posts

Posted - Aug 19 2024 :  08:54:55 AM  Show Profile  Reply with Quote
I didn't know about that, that's really nice feature! Can code inspection be applied to entire code base or specific files from command line? I think this would be valuable feature because it would cover old code as well, not just the code that developer is currently editing.

Another request - sometimes developers may be fine with certain code and may want to disable inspection for it - would be nice to have special format in comments or through #pragma directive that would tell Code Inspector to disable specific check(s) for given line of block of code.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18934 Posts

Posted - Aug 19 2024 :  10:40:19 AM  Show Profile  Reply with Quote
We are looking to add the ability to run Code Inspection across an entire project or solution:

case=104537

Obviously this could get slow, but its a popular idea.

As for skipping certain checks, yes, this can be done. I have just realised though that the instructions were lost when our website was updated. So, here are some examples of how to do this:

First, to skip several lines of code:

static void simpleSkippingChecks()
{
	for(int nScan = 1; nScan < 10; ++nScan)
	{
		continue;  // vaCI:skip - skip reporting this line
	}

	int *pTesting = 0;
	// vaCI:skip-2 - skip current line and previous line as well
	// skipping 2 lines in TOTAL, skip line and line above

	// vaCI:skip+3 - skip current line and next lines as well
	// skipping 3 lines in TOTAL, so skip line + 2 more lines
	return;
}


or skipping specific checks:

// vaCI:skip+3:readability-container-size-empty - use the full name of the check to skip, so you know VA will only skip this one check
if (mapPrimeNumbers.size() == 0)
{
	pTesting++;
}


// vaCI:skip+10:null,empty - 10 lines in total, but only skipping checks where the name contains "null" or "empty" #CodeInspectSkip
int *pTesting = 0; // warning here skipped
if (0 == pTesting) // warning here skipped
	return;


zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000