Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm putting together a custom code analyzer to run against Visual Studio 2015 solutions and I would like to add a property to control it by date.

When in place then the rule (or rule set) would only be applied to code modified on or after the set date.

Is this possible and where are the best sources of information?

What I have tried:

Extensive online research that has yielded nothing.

I also added a new variable to the section of the analyzer where the DiagnosticID is set but I was not able to access it anywhere else.

New Idea Forming! What if I try passing it is as an argument?

Update
I tried that idea using a constructor - no joy. Now I will try reading from a config

And for next week...
CodeCracker checks for something like <auto-generated> in a header comment to skip scan on autogenerated files.
seen here

and on stackoverflow

I'm thinking of adding a comment <qa-checked> when the analyser runs. Then add a precompile event to the compiler to remove this from modified code.

The analyzer will be instructed to skip any code marked <qa-checked>
Posted
Updated 7-Sep-18 18:55pm
v5
Comments
Richard MacCutchan 7-Sep-18 8:55am    
What is the problem? Comparing dates should not be difficult.
Ger Hayden 7-Sep-18 9:33am    
True, the date comparison is the easy part. The difficulties lie in supplying a seed date to the analyzer, and getting the last modified date of the source file, say as opposed to the date it was checked out of source control.

Another option I am considering is to only apply the rule if the code has changed since the last run of the rules - if I can come up with an efficient convention for marking a code file as 'Analyzed'.

1 solution

Add "meta data" to the (vs) project for your "seed data", last modified date, etc.

Create a "macro" to add your meta data as a "project item"; then use a "reflection" of sorts to kick off the analyzer; results are added back in to the (vs) project / solution.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900