locked
CRM 2011: JavaScript - Anyone know how to get code analyzers like ReSharper and JustCode to ignore the Xrm syntax? RRS feed

  • Question

  • It's an annoyance for various code anlayziers like ReSharper and JustCode to show warnings on every line of JavaScript that uses Xrm. So I am wondering if anyone has any suggestions that can be done to make the code analyzers happy and to stop showing these as warnings.

    I think this is really just a JavaScript issue. Is there a way to tell JavaScript that "Xrm" is referencing another JavaScript library? Maybe that will work to make the code analyzers happy. I just don't do enough JavaScript to know if this is possible. But if ReSharper marks just about every line of code as a warning, it sort of hides any of the real issues that ReShaper is suggesting. I could just remove the warning, but I suspect it is a useful warning for other items. So I'd like to leave it if I can.

    Here's an example. When editing JavaScript in .Net, ReSharper marks every Xrm line as a warning, telling me Xrm is an error.

    var appStatus = Xrm.Page.getAttribute("statuscode").getValue();

    For example, I could create a function like Form_Load(Xrm) and that would make ReSharper happy. However, I suspect it would also break the code. Any tricks to get JavaScript to understand a function is actually calling out to another JavaScript file?


    Jon Gregory Rothlander




    Tuesday, July 7, 2015 3:16 PM

All replies

  • Hi Jon,

    have you ever hear custom code validation tool ? Maybe you can use it validate to your jscript codes.

    https://www.microsoft.com/en-us/download/details.aspx?id=30151

    Best,

    Mustafa


    breath is everything for life

    Monday, July 20, 2015 11:29 AM