ReSharper - Is there any way to save code quality recommendations to a file? - resharper

I'm probably using the wrong terminology but basically I would like to dump the findings from the panel to the right of the scrollbar to a file for later review. See the screenshot below for what I mean. It's the part of the screen with the orange and green lines on. Does anyone know if this is possible?
If anyone is interested I have filed a feature request for this with JetBrains here.

As far as I know it's not possible, at least with the built in features. Maybe it's possible by writing a plugin.
The only thing which I know to get something like this:
Goto the 'Code Issues' Inspector: Resharper->Code Issues in Current Solution or any other of these options
On the window which shows the issues is a 'Export' button. With that button you can export the issues of the project/solution/file.
The report format is pretty simple list of issues as text. Like this:
5 issues found
Common Practices and Code Improvements (1 issue)
<DemoApp>\Program.cs (1 issue)
Property 'Title' can be made private
Potential Code Quality Issues (4 issues)
<DemoApp>\Program.cs (4 issues)
Auto-implemented property accessor is never used
Auto-implemented property accessor is never used
Class 'Comment' is never instantiated
Class 'Program' is never instantiated

It's now possible to use Resharper's Command Line to produce a xml with the issues on a given solution.
It's not exactly the 'export' functionality you wanted, but it might be useful still.
You just have to run the tool and pass the file where it will save the issues. For example:
inspectcode /o="D:\Resharper\MyIssues.xml" [PathToSolutionFile]
I've noticed this produces more issues than the plugin inside Visual Studio does, for some reason. I really think the Resharper's team should concentrate on using the same code to analyze the files instead of different implementations like it seems to be now.

Related

Android Studio: StringBuilder content not shown in preview of debugger

I'm implementing an app, which uses (kotlin.text.)StringBuilder instances at various points. Since today, I have to double-click the variable name and, after that, double-click 'value' to see the content shown as one character per line (next to 'value', it also says e.g. char[20]). Until yesterday, I was able to see their contents in the variables view of the debugger right after double-clicking the variable name and - what is even more important - in one single string line. I have to compare the content of several instances and therefore cannot work efficiently with this view.
Is there some kind of setting, which needs to be reset? Has anyone else experienced this? Is this an intended behavior or am I the only one having this bug/behavior?
After getting this, I already tried restarting android studio, as well as upgrading all components to the latest version. I also tried creating an entirely new project with only one StringBuilder to rule out any problems in my current project - but, no luck so far.
Any hint would be much appreciated!
You need to add a .toString() call to your string builder to get the value of the string.
I finally figured out the solution to the problem. It was indeed a setting I had to reset. As I did not actively change it, this solution might be useful to others, too.
Via 'Setting > Build, Execution, Deployment > Debugger > Data Views > Java', I found the option 'Enable 'toString()' object view:'. After selecting this option, everything worked again as before.
Thanks to everyone, who tried to figure out the solution!

Office-js doesn't display the properties

I was trying to repro a tutorial about the creation of an Excel Add-in when something get wrong with the IntelliSense of Visual Studio. I was writing this code:
function updateStocks() {
Excel.run(function (ctx) {
var **range** = ctx.workbook.names.getItem("Stocks")
At this step, everything was fine, but after the getItem, I have tried to add .getRange() at which point the IntelliSense was not able to understand anything related to my variable range.
Screenshot
What is really "funny" is the fact that even if the properties are not displayed, when I write the code of the tutorial manually, the code is executed without mistake.
Why does this behavior occur and how can I correct it?
Are you able to see IntelliSense for other types within that .run? I.e., do you have everything up to the point where you get a Range from a named item? If you were to obtain the range differently (e.g., context.workbook.getSelectedRange()), do you get IntelliSense then?
This might be related to an issue (now fixed) where the CDN accidentally had the namedItem.getRange method removed (it was the only one that was affected, and we've put in measures to ensure we catch those in the future). See "Can't get range from a defined name". The CDN has been patched a couple weeks ago, but the JS IntelliSense file ("VSDOC") probably hadn't. If that's the case, it's a point-in-time issue that should resolve itself very very soon, as new deployments of the CDN will have the getRange method both in the VSDOC and everywhere else.
FWIW, you may still run into limitations of the JS IntelliSense engine (there are plenty, unfortunately: for example, trying to pass values across Promises, or passing in API objects as parameters to functions). The only true good workaround for this is using TypeScript, which allows you to declaratively assert to the compiler/IntelliSense-engine that "I know this type is an Excel.Range!") -- and offers a number of other goodies, async/await being a very major one. I personally believe that if you really want a "premier" Office.js-coding experience, TypeScript is the way to go. To that end, I describe how to use TypeScript in my book, "Building Office Add-ins using Office.js" (full disclosure, I am the author; but I've had many readers comment on how helpful of a resource it's been to them). The book is very much TypeScript-oriented, IntelliSense being one of the reasons (and async/await and let being the primary others) -- though I also offer an Appendix where I describe the JavaScript-only way of accomplishing the same Office.js tasks. It takes only a small amount of effort to get started with using TypeScript, and once you do, I don't think you'll look back.

ExtLibUtil documentation - where do you find what the available functions are?

As I have asked questions in this form - thanks for your many helpful answers - i have found many really neat things that one can do using ExtLibUtil.???? however, other than a bit here and a bit there I have not found anything that gives a listing on the various functions. I one post I read that it is all in the source of the extension Library, and it might be if you really understand where in the source to look. Sure would appreciate a pointer and starting point.
I've been unable to find a JavaDoc for it. The library slipped passed us when we wrote the book - certainly I was not as au fait with Java to be aware of it and all the strength within it. So the best option currently is to look at the source code in Eclipse. Many of the methods are helper methods to easily access things like viewScope etc, which is easy from SSJS but less easy from Java. Most are pretty self-explanatory.
Content assist doesn't seem to work from SSJS, but will from any Java class or, alternatively, open up one of the Java classes created for XPages / Custom Controls under the "local" package in Package Explorer, type "ExtLibUtil." in any method and you'll see the list.

VBA enums give occasional "Constant Expression Required" errors

I'm using an enum defined in a class module in Excel VBA. This has been working fine, but I've started getting a compile error on every time I do a comparison on enum variables:
In class CExample:
Enum MyEnum
Foo
Bar
End Enum
Elsewhere:
If someValue = myEnum.Foo Then
The text .Foo will be highlighted, and a "Compile error: Constant expression required" message pops up.
A search on Google suggests that this can randomly happen, and fixes such as restarting the IDE or adding a space after the enum declaration can make it start working again.
http://www.tek-tips.com/viewthread.cfm?qid=1355882
http://www.vbforums.com/showthread.php?405564-RESOLVED-Constant-Expression-Required-Error-when-checking-Enum
Is this really a known bug in VBA? Is there anything I can do to avoid it happening, or reliably get VBA working again if it does crop up?
In my case, closing and reopening Excel hasn't helped. Excuse me while I reboot my PC.
Update after reboot:
The problem persisted after rebooting my machine, which is surprising. I tried adding Public in front of the enum definition (they're meant to be public by default but I thought I'd give it a try), and the error disappeared. I've removed the Public keyword (so we're back to my original code) and it still compiles and runs fine.
It does look like this is a random bug in VBA. I'd be interested to know if experienced developers have found this comes up often - would you advise not using enums? Or does it pop up once in a blue moon and I was just unlucky?
Update after 6 weeks of further development:
The problem didn't recur during the rest of my time developing this project, so it looks like it is a rare problem.
As noted in the question, I got rid of the error by editing and saving the enum definition, then undoing the edit and saving again. Having recently done some more work on the project, I found a different but similar issue - one line of code would give a "Type mismatch" error, where there was no type mismatch and where the same function, unchanged, had been working fine with the same inputs.
Some of the intermittent errors I'm seeing might be due to a buildup of code artefacts in the Excel file - having done some reading, I've found that VBA code gets compiled and saved into the file. There's no "clean" or "rebuild all" option - VBA tries to work out for itself what incremental changes are needed. This can lead to all kinds of odd runtime behaviour in projects where you've made lots of code changes. This is likely the cause of the enum errors I was finding during initial development of this workbook. The section "What It Means to Decompile and Compact in VBA" in this article gives a good overview.
Most mentions of this problem recommend using VBA CodeCleaner: http://www.appspro.com/Utilities/CodeCleaner.htm. Chip Pearson, a well-known and respected VBA expert, says " I very strongly recommend this add-in". I'm surprised I haven't come across this before!
Seems to be a bug.
Copy the same module's code to a new one, and recompile. That seems to solve it for some.
A similar fix exists, which involves editing and undoing on the enum definition's line.
Consider switching to numeric constants if this is a frequent problem.
An old question but just experienced this. Removed Public definer on the Enum and it compiled just fine. Didn't restart IDE. Surprising this is still here.
I ran into this issue today and found another possible solution. I'm posting in case this may help someone else.
None of the following worked for me:
Restarting Excel
Restarting Windows
Removing "Public" from my enum
Adding "Public" back to my enum
I could not try using VBA cleaner add-in since this is a work computer and I don't have admin access.
I did not try creating a new module, so I don't know if that would have worked.
However, closing Excel and starting a new instance of Excel and using "Open and Repair" option worked for me. To do that:
Close all Excel windows
Open Excel from the Start Menu
Go to "Open" on the left hand side
Select "Browse" under "Other Locations"
Navigate to the file you had a problem with
Click the drop down arrow on "Open" in the lower right and select "Open and Repair..."
This ocurred to me today and for some reason the cause was the accidentally deleted "Option Explicit" statement at the top of the module with the Enum declarations. When I re-added it, it immediately started working.
This error does now and then, when no changes were made to the enum or its use or any code related. What worked for me is to make the move the enum from the Class to a Module I have called 'Common' and make the enum Public instead of Private.
I had the same issue with my Enum, I added Public Enum to the declaration and the problem stopped. No need to reboot.

Codedui object map/properties recording settings

Can anyone help me with this here codedui? I can't seem to find the option to choose when doing a recording on what properties for the object map to use. like for example,
when I do a recording for a calculator or "Something" and do an action/a click on "button 1" It just directly gets all the properties like, ID, name, classname etc. for that single object.
So, my question would be is there any possible settings when recording that I could tick like just use a couple of the properties not all? (ie. ID)
BTW, I'm using VS2010 ultimate.
Cheers,
Kerwin
UIMap editor that comes with feature pack 2 is the best solution for editing seacrh/filter properties of the control.
I have been working on something similar but haven't come up with a really good solution there are a few options but none of them are particularly user friendly or intuitive. You can hook the UIMap save function and prevent it from recording unwanted properties, note that this can make your tests brittle less properties generally means more failed searches. The UIMap is made by an XML file and you can parse and edit it directly. If you only have a few properties to get rid of you can use the UIMap editor that comes with feature pack 2.

Resources