Category Archives: Uncategorized

Preventing Items from being analyzed in ReSharper

With the imminent release of ReSharper 6, and support for JavaScript as well as CSS, we’ve had a few people ask us how to prevent ReSharper 6 from detecting issues in certain files that are not supported, for instance .less. Although many operations are available for these types of files, including “Move To Folder” (and consequent reference updates), analysis is not currently available.

Eliminating Items from Analysis

ReSharper allows us to completely exclude specific files and folders from Analysis. Currently, it does not support file masks, so we cannot tell it to ignore all *.less files. What we can do however is place all files of a certain type into a folder and add that folder to be excluded. To do this, we first move the specific files by using the “Move To Folder” refactoring and create a new folder called less for instance (which can be created using the same dialogue box).

In order to now exclude this folder, we need to go to ReSharper | Options | Code Inspection |Settings

SNAGHTML2c0fc9

and click on the Edit Items to Skip button.  This now provides us the ability to add specific files and/or folders to list of items to skip.

SNAGHTML2d02ce

We then click on Add Folder and select the newly created folder (less).  Once we do that, all analysis on the skipped items will stop. Obviously this is available for any kind of file so you can add anything there.

Note: You can also add/remove files and folders quickly by pressing the shortcut key Ctrl+Shift+Alt+8.

In the case of CSS/.less, if you still see squiggles under certain elements, that is Visual Studio error highlighting, not ReSharper. You can turn that off using Tools | Options | Text Editor | CSS | Miscellaneous.

Generated Code

Below the previous menu option, there is another entry Generated Code:

image

How is this different from the above? The entries on this page, which do allow masks (as well as regions), do get analyzed, yet no hints, warnings, suggestions or quick fixes are offered since it does not make much sense. However, and this is important, files still do get analysed to provide error information and completion. This is what makes Generated Code different from Items to Skip.

Note: In ReSharper 6 and below, Generated File Masks and Generated Code Regions are GLOBAL and not Solution based. However, they can only be edited when a solution is open. This will be solved in a future release along with other improvements in the area of settings across solutions/projects.

YouTrackSharp: A .NET Client for YouTrack

On and off I’ve been working on a .NET library that is a wrapper around YouTrack ReST API’s.  If you’re not familiar with YouTrack, it’s our Web-Based Issue Management system, which is currently at version 3 and recently we announced the availability of a free version. If you like keyboard-centric tools (like for instance ReSharper), you’ll love YouTrack.

YouTrack offers quite a lot of possibilities when it comes to interacting with it. I’ve previously blogged about how we can easily create some HTML 5 graphs using nothing but the ReST API and some jQuery. Of course, we could also take advantage of this API from .NET using merely an HTTP client.

YouTrackSharp

What YouTrackSharp brings to the table is a compact interface to work with YouTrack without worrying about things like cookies, URL’s and other HTTP concerns. It abstracts all that away to provide a simple series of classes to work with YouTrack.

Here’s a sample of a command line app I just wrote to make feature logging easier for ReSharper:

var connection = new Connection(“youtrack.jetbrains.net”);connection.Authenticate(“username”, “password”);

var issueManagement = new IssueManagement(connection);

var issue = new Issue
{
Assignee = “ReSharperProjectManager”,
Summary = summary,
Description = description,
ProjectShortName = “RSRP”,
Type = “Feature”
};

issueManagement.CreateIssue(issue);

Console.WriteLine(“Feature request logged”);

Currently it allows you to Create Issues, Upload Attachments, Get Issues, Apply Commands to issues as well as a bunch of tasks on Projects. I’m adding features as and when I can, so if there’s something you’d like, log it here.

How to use it

YouTrackSharp is available as a NuGet package and source code is available on GitHub. To use it, just do:

install-package YouTrackSharp

You first need to create a Connection object (providing host) and then either a IssueManagement or ProjectManagement  based on what you need to do. The classes are simple and the methods should be self explanatory. The project also comes with tests using MSpec which describe many scenarios. If you have any questions, shout!

Ruby

If you are a Ruby developer, know that Anna Zhdan, a colleague at JetBrains, has also started working on a Ruby library for YouTrack, which is available on GitHub

ReSharper 6 enhances the JavaScript experience

We already mentioned some of the benefits that ReSharper brings to the table when it comes to JavaScript development previously. In this post we are going to have a more in-depth look at some of the features.

Pimping jQuery

In addition to support for JavaScript, ReSharper 6 also provides certain functionality specific to jQuery.

Code Completion for Selectors

When working with jQuery selectors we often need to lookup certain DOM elements or CSS classes in order to operate with them. This can result in a back-and-forth between the code we are working on and looking up of a specific element. ReSharper 6 facilitates these cumbersome operations by providing code completion for selectors:

image

This completion is invoked by typing # between the quotes, where as if we were to type ., we’d get:

image

This completion is available anywhere we a selector is required.  Of course if we merely want to select a specific type of element, we also have completion:

image

Extending jQuery extensions

One of the benefits of jQuery is the ease by which we can extend it to add our own functions and methods. ReSharper enhances this experience by providing completion also for custom extensions. For instance, if we were to write a new extension:

image

we now have myFoo available as a method of jQuery:

image

Much in the same way, if we want to extend an object:

image

we have:

image

Importing File References

Out of the box, Visual Studio requires a special comment to be added to script files to provide support for IntelliSense:

image

With ReSharper this is not required. If however, it is included, ReSharper will then limit the scope of Intellisense to the reference added. This reference can be provided by directly typing it in, in which case ReSharper offer completion:

image

as well as providing quick-fixes when errors are detected in paths:

image

Creating from Usage

Similar to C# and VB.NET, we can now also create JavaScript code based on usage. For instance, let’s say we write some code that calls a specific function named getInterval that does not yet exist. ReSharper prompts us to create a local function:

image

generating the code for us, providing us the same ability we have in C# to iterate through parameter names etc. The same applies to variables:

image

as it does to creating parameters and properties; once again, making the whole development experience a bit smoother.

Last but not least, ReSharper also provides the ability to create jQuery extension methods from usage:

image

Refactoring

Certain refactoring operations are now available in JavaScript. Firstly, in combination with Create from Usage, we can now easily add an extra parameter to a function call and have ReSharper offer to create it for us:

image

Introduce Variable is another refactoring option available:

image

And last but not least, Renaming:

image

ReSharper is smart enough to handle the scope of the renaming outside of the current local scope, prompting you always with the option to fine-tune certain renaming’s.

Code Clean-up and Rearranging.

In a previous blog post we mentioned briefly the code formatting options for JavaScript. These have now been extended and better organized. We can fine tune Lines Breaks, Braces Layout as well as Space via ReSharper | Options | JavaScript | Formatting Style. Below are the options for the newly added Spaces:

image

Running code-cleanup on JavaScript files is of course now also possible:

image

Also, out of the box, we provide certain filters, both in clean-up and analysis, such as those with min.* extensions. These can be changed in the options dialog, albeit it’s not highly recommended.

image

Rearranging Code

You can now rearrange code which includes moving parameters around, moving members up/down as well as arguments and object literals and arrays. All this is done using the same key combination as used in C# and VB.NET (Ctrl+Alt+Shift + Cursor Keys).

Code Inspections

JavaScript is a dynamic language. It has great advantages but can prove to be not the easiest language to work with, specially for novices. We’ve tried to ease some of that pain by providing code inspections, where possible. Among the many code inspections that currently are available are:

Syntax errors

image

Unused symbols

image

Dead code

image

Duplicate switch statements

image

Misuse of “this”

image

Accessing undefined global symbols

image

And this is just a few of the over 25 inspections that ReSharper supports along with their corresponding quick fixes. We believe that this will help remove some of the issues encountered at runtime, specially by newcomers.

Miscellaneous

Some of the other features provided for JavaScript are:

  • Configurable Naming Conventions: Much like C# and VB.NET you can define your own naming conventions.

image

  • Comments: Ability to comment and uncomment blocks of code as well as support for XML Documents.
  • Context Actions Settings: You can fine-tune which of context actions you want enabled.

image

  • Live Templates:  Support for Live Templates
  • Navigation and Find Usages: Navigation support as well as Find Usages for JavaScript members, some of which was already covered in a previous post.
  • Coding Assistance: Also covered in previous post.

All in all, we hope that some of these features allow JavaScript to become a language to that easier to learn, use and enjoyable.

ReSharper 6 is currently in EAP. Download it today and start playing with it. We’d love to hear your feedback.

Did you just take a dump on standard versioning practices?

image

Original source: http://blogs.msdn.com/b/endpoint/archive/2011/04/18/microsoft-net-framework-4-platform-update-1.aspx

Who was the genius that thought calling a 4.x update a “Platform Update 1” and referencing the knowledgebase would ever be a good idea? Does that person actually understand what he/she is doing?

WTF happened to calling things by Major/Minor version? As if the Client Profile wasn’t already a really stupid idea, now you come out with this crap.

Why are you messing people around like this? You realize some of us actually write software and deal with deployments?

Session at DevDays in The Netherlands

My talk at DevDays in The Netherlands on Real World Architectures with MVC is now available on Channel 9. It was my first TechDays Belgium / DevDays The Netherlands and I was quite impressed with organization. Kudos to Katrien, Helen, and everyone else involved. I’m guessing the videos from TechDays will be online at some point too, on Channel 9.

Also, if you’re interested in more hands-on-in-depth coverage of MVC and are located in Europe, I’ll be doing a 4 day masterclass with Informator in September

Crazy Monologue in the shower….

We sell Windows licenses. We sell SQL Server. We sell Office.

And now we’re going cloud. It’s all about Azure.

Think about it. What are we offering here with Azure? It’s not only hosting and scalability, we’re offering a series of value-added services.

What’s the cost of a Windows license to us? Nada…

Right now we don’t care what developers use. They can use .NET or PHP and still run it on Azure. We don’t care!

So, why do we care about the platform?

I mean, we could even run Linux machines. Still provide the value-added services….

Yes but a lot of things we can’t do, cause we don’t really control .NET on Linux. That’s kind of Novell and the Mono project

If only……

….the rumors, the silence from key figures in the community…will it all fall into place?…..only time will tell…

/crazy_mode_off

Getting things done daily

For over a decade now, except for one year, I’ve been working from home. Home is kind of metaphorical considering the amount of travelling I do. However, to all effects, it means working alone, physically isolated and with no real 9-5 schedule.

Personally, I love it. I find it much more productive than working in an office, since I rarely am able to concentrate when surrounded by other people or noise. Sure, it’s probably out of  habit. I know when I first started, I missed the office buzz,  so it’s all just a matter of getting used to things. But having worked in both an office and at home, I’d stick to what I have now.

One of the greatest struggles of working from home, is adhering to a schedule. You need to have discipline in order to be productive. It’s far too tempting to get out of bed a bit late, watch a bit too much TV while making a coffee, or chat on the phone a bit too long. Today of course, we don’t need any of that, as Twitter and Facebook are here for our procrastination pleasures.

On top of sticking to a schedule, if you’re somewhat responsible for defining your own, the feeling can be overwhelming. Often you feel lost. You feel you’ve got way too many things going on and certain days can end up resembling the most unproductive days of your life. It happens. Even if you run a tight shift. Sometimes there are just those days. The best thing to do is just get over and, well, call it a day.

Organizing your daily tasks

What I have found fundamental is organizing a list of tasks you need to do on a daily basis. Now over the years, I have tried everything. I’ve gone through all the ToDo list applications that were available on downloads.com. I’ve tried different flavors of Outlook, The Bat! (great mail client, really bad PIM), to the more recent Remember the Milk and a bunch of other apps. And of course, none of them worked just right. And being a developer, what did I do? Write my own, which of course also failed miserably.

The problems I encountered with them all were always similar, but you know what? I could never pinpoint it. Some where to simple, others too complex, ultimately having me spending more time on managing the tasks than getting them done. My last resort was just an empty text file with a list of tasks. That didn’t work either. So what did work?

This:

image

Yep. A piece of paper and a pencil (or pen as Dino rightly mentioned). It seems silly doesn’t it? Having all this technology at the tip of our hands and yet the best thing I’ve found that allows me to concentrate on getting the job done and knowing what I have to do each day would be a piece of paper and a pencil.

Some of the reasons for this I think can be attributed to:

  • It can’t go wrong (well it can but you have an eraser).
  • It’s simple. It won’t distract you in trying to re-organize or finding a better way to handle the tool.
  • It allows you to focus. It removes the overwhelming lists of tasks you have pending.
  • It’s staring you in the face.
  • You know exactly what you need to get done. It’s the list.
  • As you cross things off of the list, you see that you’re getting things done. It somehow entices you to even be more productive. It gives you a good feeling.

Now I’m not an expert in human psychology but I do believe that many of the previous points are actually psychological effects at play.

This is a daily Workflow

This works well on a daily basis. I still manage tasks using software. I use YouTrack for certain things, Thunderbird /Google Calendar for appointments and Checkvist for managing list that I collaborate on with others. However, when it comes down to what I need to do on a daily basis, I select items from all these sources and write them out on the sheet of paper, and I try and adhere to what’s on the paper, not deviating. So it’s important to realize that this is something I do on a daily basis. It doesn’t scale well for multiple days, weeks, months or even across teams. It’s a personal tracker for my daily routine.

It all boils down to one thing…a goal

There have been many techniques, tips and tricks that try and allow people to concentrate on a task. There’s even been certification programs for some, which I’ll refrain from making any comments on. Some tips which I’m sure you’re well aware of are things like closing down Email, Twitter, Facebook and other tools that decrease potential productivity (unless of course you’re a “Social Media Expert”). On the whole however, I think the main root of the problem here is not having a clear objective, not having a goal to reach. If we have that, you won’t procrastinate. This technique, I find, helps focus and reach that goal, daily.

If you’re having issues with getting things done, I recommend you try this simple approach ,which is by far my invention and I’m sure many already use.

Pluralsight Webcast: Agile Environments

On the 5th May, in collaboration with our partners Pluralsight, we will be doing a webcast on Agile environments:

– What exactly is an Agile environment

- Best practices for setting up environments with TeamCity, YouTrack and an OSS stack

This webcast is completely free and open to all. Please check out Pluralsight’s website for more information and registration information.

TechDays Belgium and The Netherlands

We’ve only just come back from Mix 11 and are already preparing things for the next great .NET events taking place in Europe: TechDays Belgium and DevDays The Netherlands.

 image image

With over 3.000 delegates registered, it’s cut out to be a blast. JetBrains will be at both events, which slightly overlap.

We will be giving away our Dead Code T-Shirts as well as some other surprise swag we have to give away. Please make sure you stop by our booths to chat.

I’ll be doing a session at each event, a Deep Dive into MVC 3 at TechDays Belgium and Real World Architectures with MVC at DevDays in The Netherlands. I’ll also be giving a short 30 minute talk at the Speaker Corner in the Expo area on the 27th of April at 12:30 on using ReSharper to be more productive with Web Development.

See you there!

Using dotCover to Cover Applications, with or without ReSharper

One of the main benefits of Code Coverage is that it allows us to detect certain areas, branches or lines of code that are not covered during a test run, which could lead to potential issues in production. We often write some code to find to our surprise that certain parts are never actually executed.

dotCover’s integration with ReSharper’s test runners, allows us to easily monitor what parts of our code are covered with tests. What happens though if we do not have tests? Whether we like it or not, there is a reality out there, and it’s mostly composed of legacy applications that have little to no knowledge of what a test is, let alone a unit test.

Although the ideal solution is to gradually add tests to existing code until we build up a good percentage of coverage, this is a process that takes time and is not accomplished overnight.

Covering Execution Paths

What dotCover allows us to do, independently of whether we have tests or not, is to execute an application and run an analysis report on what code paths of the application have actually been hit during the run. This often helps us track down not only potential issues (“I really thought that code was being executed”) but also resolve bugs (“Ah. So that’s why it’s not working”). Running Coverage of applications is a very simple process and does not even require ReSharper to be installed.

dotCover allows us to cover either an application that is currently open in a Visual Studio Project and selected as the Startup Application

 

image 

 

or alternatively launch a non-executing Application:

 

SNAGHTMLb0d87fd

 

And as we can see, it covers a wide variety of application types.

Covering an MVC Application

The example below outlines an execution path of the MVC Music Store application. We open the project and select Cover Startup Application from the dotCover menu. This immediately launches the application allowing us to execute a certain scenario. In our case, we will select some items and drop them in the cart.

 

image

 

When starting coverage, dotCover also launches the Controller Panel, which allows us to grab a snapshot of the execution at any point we are happy with it.

 

SNAGHTMLb47486f

 

On clicking on Get Snapshot, the execution ends and we are returned to Visual Studio, were dotCover analyses the results and displays the Coverage Results Browser window

 

SNAGHTMLb49c05c

 

From here on, the possibilities of what we can do with these results are pretty much inline with that of running Code Coverage on our tests. We can examine coverage of projects, namespaces, classes and members. Navigate to a specific member as well as see in-place code coverage in the editor:

 

image

 

Exporting Results

New to dotCover 1.1 is the ability to export results to different formats, including XML, HTML, JSON and XML for NDepend. To export to HTML for instance, we select the Export icon from the Coverage Browser Window

SNAGHTMLb4f1afa

 

and select a destination to save the output too.

image

 

Summary

Although the more common usage of dotCover and in general all coverage tools are examining coverage of our code by tests, it is also useful at time to be able to run coverage of an application during a specific scenario, for testing or diagnosis reasons. Whether or not we have ReSharper, dotCover allows us to do that easily. Also remember that dotCover ships with a Console application which does permit you to run coverage of your Unit Tests from the command line and open up the results in Visual Studio.