How should I start with SonarLint for C# Projects - sonarlint-vs

I am learning SonarLint plugin but finding very difficult and not able to understand how it works.
I have installed SonarLint for VS2015 Community Edition and then as per instructions i was trying to bind any random project from Team Connect. But then I am not able to see those fancy block which will tell me something like "Null reference exception will occur.."
Please guide me what are the steps need to perform while working with SonarLint for C# projects to perform code analysis.
Thank You

SonarLint gets installed outside of any particular project. You install the extension either through VS Extensions or by downloading it from here - https://www.sonarlint.org/visualstudio/index.html. Once it's installed, restart VS and you should be good to go. I'd create a sample project outside of any existing projects to play around with the features, that way you're not fighting any kind of technology stack weirdness. One way to verify the linter is working (shown to me by a coworker) is to put in an if statement like the following:
var testVar = false;
if (testVar) {
testVr = true;
}
You should get a warning in the if-block. Good luck!

Related

Using Visual Studio Code for Grails development

IntelliJ IDEA is pretty amazing for Grails development work. It is rather demanding on resources (particularly memory), though, and takes a long while to start up, so occasionally I like to use Visual Studio Code instead for light editing. I'm trying to tune it most effectively for Grails development. Any tips would be most welcome. One thing I'd particularly like to know is if there is some way of setting up a beautifier/formatter for .gsp files.
First of all, you'll have to setup VS Code for java. You can follow this page https://code.visualstudio.com/docs/languages/java
Then, you'll have to install of the groovy language extension. Currently there are three such extensions in the library. code-groovy has more active users than the others and it provides good gsp support. I do use VS code for quick editing or just viewing source code occasionally but its still not the replacement of Intellij. I can't use VS Code for hardcore java/grails development yet.

Code Definition Window not working in VS2015

Just upgraded to Visual Studio 2015 and the Code Definition Window is not working.It just says "No definition selected" no matter what I select. Project is Windows Forms written in C#.
Go to Definition and Peek Definition are working fine
Went back to VS2013 to try it out and it's still working there
Tried to make a brand new project in VS2015 to see if it was project related, but it was not
Checked with a couple of colleagues and it wasn't working for them either
I have a feeling this is either a bug in VS2015 or some sort of configuration change.
Anyone found a way to configure it, or any sort of work around to get it up and running again?
I got a reply from Microsoft on my Bug report. Turns out it's not implemented and possibly never will be:
Hi,
Based on the fact that Peek Definition was introduced in VS2013,
combined with telemetry data that shows that only a tiny percentage of
users ever display the Code Definition Window, we decided not to
implement support for it as part of Roslyn. I've filed an issue on our
GitHub project to consider resurrecting it.
Thanks for the report!
-- Kevin Pilch-Bisson Visual Studio Managed Languages
HereĀ“s the github issue Kevin created in response to my bug report in July: https://github.com/dotnet/roslyn/issues/4224
Looks like they just merged a fix for this into Roslyn:
https://github.com/dotnet/roslyn/pull/56102

Visual Studio LESS: Compile main file upon save of imported file

I have this less structure:
parent.less
child1.less
child2.less
Is it possible to compile parent.less any time child1 or child2 are saved? I would prefer not to have to build the project for LESS compilation to occur. At the moment I have to trigger a save from parent.less.
I'm using the latest Web Essentials with LESS support, is it possible to do what I want with this?
Many thanks
According to "SLaks" comment on the Uservoice request for this feature. "Press Alt+Shift+Y (Build, Web Essentials, Recompile all LESS Files) to do this without rebuilding."
I agree, it would be a great feature for it to do it automatically without the shortcut.
Just a quick comment in case anyone else stumbles across this while searching, this has been added to WE2013, but if you are still in VS2012 and using WE2012, this still doesn't work, and it doesn't sound like it will be added to 2012.

Importing a project into Visual Studio. Why so many errors?

This isn't really coding specific, but we currently have a project that is live and working fine. I am tasked with making a few changes to it. I imported the ALL files of the project to Visual Studio 2010. I can't get any work done, because of all the errors!
Do you have any suggestions for me? The project doesn't have a source file, so I created a project and made one myself.
I tried another version of Visual Studio, and the errors continue. How in the world is this project even working?
Also, I have no way to speak with the creator.
Thanks for the help!
Josh
Without seeing the specific errors you're running into, I'm guessing that you are hitting one of two scenarios:
The source code references .NET assemblies that you do not have installed on your development machine. The only way to correct this is to get your hands on a copy of those assemblies to install them. The assembly names should be in the error messages, which would give you a good starting point to look from.
It's also possible that differences in the .NET framework versions that it was originally developed in and what you are trying to use now are accounting for a large number of errors. If the errors specifically reference the version number, this is most likely what you're experiencing. If this is the case, there are ways you can upgrade the individual file versions that your program references, but I honestly haven't done that in about 8 years, so I'm drawing a blank at the moment as to how to do it.
I don't understand ?
you have a "project" (what kind of project?) that you want to start working with with VS2010 ?
You add the files to a new VS2010 project and start building it and many errors occur ?
What kind of errors ? Language (C++/C#) errors ? missing include missing ? missing libraries ?
Can you show a some of the errors you get ?

What's wrong with Aptana RadRails Eclipse update site?

I'm trying to install Aptana Studio as Eclipse plugin in Eclipse 3.3 (Europa), and I'm following instructions on this link. However, the recommended update address for Eclipse 3.3 http://update.aptana.com/install/studio/3.2/ returns the following error message:
"Unable to access site: "http://update.aptana.com/install/studio/3.2/" [Server returned HTTP response code: "403 Forbidden" for URL: http://update.aptana.com/install/studio/3.2/.]"
The latest version does install on Eclipse 3.4 (Ganymede), however I'm trying to add a bit of Ruby to existing Java-based projects and 3.3 environment my team currently uses.
Questions:
Is this only a temporary error, am I doing something wrong?
Did someone get Aptana Studio to work with Eclipse 3.3?
Is there a way to install only RadRails plugin without complete Aptana Studio? It seems to include a bunch of stuff I don't really need.
Idea here is to integrate a bit of Ruby into existing Java project, but so far Ruby has been pain in the buttocks to get working. Switching to NetBeans or installing Aptana as standalone are not really options I'd like to consider, and I'll switch to Eclipse 3.4 if I have to, but to be honest I'm currently at the point where I'm seriously considering ditching Ruby as "not mature enough" and considering other options (like Groovy for example).
There was a ticket 3913 mentioning this workaround:
manually modify the following line in the feature.xml file under C:\Program Files\Aptana\Aptana Studio 1.2\features\com.aptana.ide.feature.framework.air_1.2.5.*:
<update label="%updateSiteName" url="http://update.aptana.com/update/air/3.2/"/>
to
<update label="%updateSiteName" url="http://update.aptana.com/update/air/1.5/3.2/"/>
But in your case, both
http://update.aptana.com/install/studio/3.2
http://update.aptana.com/install/studio/1.5/3.2
redirect to:
http://update15.aptana.org/studio/26124/3.2
http://update15.aptana.org/studio/26124/1.5/3.2
So... may be a new ticket to Aptana support is in order.
I ended up using Ruby Developer Tools as described here, which were enough for my needs at this point.

Resources