Code Inspection API?
Hello,
I'm trying to figure out how to access the code inspection API. I would like to create a Team System Checkin policy that prevents a developer from
checking in code that Resharper has tagged with Inspection errors. I need to pass a file to the resharper code inspection API and retrieve a list of inspection errors.
Can someone point me in the right direction?
Please sign in to leave a comment.
You'd like to run code analysis agains given file, and then collect all
analysis results?
--
Eugene Pasynkov
ReSharper Technical Lead
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"
"Shane Faulkner" <no_reply@jetbrains.com> wrote in message
news:12662919.11541233248337717.JavaMail.clearspace@app4.labs.intellij.net...
>
>
>
This is exactly what I want to do.
1) First of all, you need to override highlighting engine to get access to
analysis result:
public class HighlightingDumper : DaemonProcessBase
{
private readonly List myHighlighters = new List(); public HighlightingDumper(IProjectFile projectFile) : base(projectFile, DaemonStageManager.Instance.VisibleDocumentStages) { } public IList Highlighters { get { return myHighlighters; } } public override void CommitHighlighters(DaemonCommitContext context) { myHighlighters.AddRange(context.HighlightingsToAdd.Where(h => myHighlightingPredicate(h.Highlighting))); foreach (HighlightingInfo highlighting in context.HighlightingsToRemove) { if (myHighlighters.Contains(highlighting)) myHighlighters.Remove(highlighting); } } } 2) Then invoke it: var process = new HighlightingDumper(projectFile); process.DoHighlighting(DaemonProcessKind.VISIBLE_DOCUMENT); -- Eugene Pasynkov ReSharper Technical Lead JetBrains, Inc. http://www.jetbrains.com "Develop with pleasure!" "Shane Faulkner" ]]> wrote in message
news:12256926.16631233334228297.JavaMail.clearspace@app4.labs.intellij.net...
>
Hello Shane,
Try to use ReSharper plugin ".NET Code Inspector" - http://safedevelop.com/Products/CodeInspector/default.aspx
Best regards,
Alexander Nesterenko
Safe Develop Team