code-cleanup

Best way to get rid of hungarian notation?

Let's say you've inherited a C# codebase that uses one class with 200 static methods to provide core functionality (such as database lookups). Of the many nightmares in that class, there's copious use of Hungarian notation (the bad kind). Would you refactor the variable names to remove the Hungarian notation, or would you leave them alo...

How to remove System.out.println's from codebase

We have a huge (old legacy java) code-base, where many files (around 5k) have System.out.println's. We are planning to remove them for cleanup/performance reasons. How can we write a script that will replace them without introducing any issues in the code? The script cannot blindly delete them as following case can be an issue: if () ...

Tool to remove hanging code.

This question is in continuation to http://stackoverflow.com/questions/979129/. It would be great if there is some tool that would allow to remove the hanging code (code not being used). Examples would be unused variables,references,functions or even class (old code or code only written for experimentation). ...

What is a good HTMLcleanup tool?

I am working on a HTML file that is a total mess right now and wanted to clean it up. What good tool is there out there to clean up HTML files making them nice and readable with good formatting? I just want the file much much cleaner and readable. ...

Code Formatter: cleaning up horribly formatted jsp code

So I am working on a jsp/servlet that came to me and I'm looking at the jsp file and it is just a jungle of jstl tags, java code and html thrown together. At first it looked like someone ran the standard eclipse formatter on it and had the page width set to 40 so alot of stuff is broken up, I tried to format it with a larger page width b...

is there anyway to find unused css in a website.

trying to clean up a project i just inherited ...

How to bulk cleanup imports in Java with eclipse?

On a generated project i 100s of warnings caused by unused imports and the like. Can i bulk cleanup those imports for all files? ...

Determining which PHP source files are not used.

I have a large web app, and I think there are a bunch of old files that are no longer being used, is there an app which can tell me what these files are? ...

.NET Refactoring Tools - String to StringBuilder

Is Refactor Pro the only .NET Refactoring tool that supports the String to StringBuilder refactor? I'm looking for one that has a trial version of this feature to see if I like it enough to purchase. The overall goal is to tidy up another developer's VB.NET code. ...

How to recognize that short code blocks can be refactored into something cleaner?

i have a bit of code that i wrote a few weeks ago (the code's purpose isn't so much important as its structure): if (_image.Empty) { //Use the true image size if they haven't specified a custom size if (_glyphSize.Width > 0) imageSize.Width = _glyphSize.Width //override else imageSize.Width = _image.GetWidth; if...

Resharper Tip/Trick... is this possible?

How can I have Resharper convert code file like using Stuff; using Stuff.MoreStuff; using Stuff.MoreStuff.EvenMoreStuff; namespace CoolStuff { // src code } To namespace CoolStuff { #region Using Statements using Stuff; using Stuff.MoreStuff; using Stuff.MoreStuff.EvenMoreStuff; #endregion // src code } I just like it...

How to make this C++ code more DRY?

I have these two methods on a class that differ only in one method call. Obviously, this is very un-DRY, especially as both use the same formula. int PlayerCharacter::getAttack() { int attack; attack = 1 + this->level; for(int i = 0; i < this->current_equipment; i++) { attack += this->equipment[i].getAttack(); } ...

Using ReSharper 5.0 in VS 2010 web application project with Telerik controls

When using "Cleanup Code" function in ReSharper 5.0, code cleanup removes the aspx page line: <%@ Register Assembly="Telerik.Web.UI" TagPrefix="telerik" Namespace="Telerik.Web.UI" %> Seems like an issue within ReSharper 5.0. Anyone else having the same issue. Thanks ...

Cleanup Perl code: my $export = $doc; $export =~ s:\.odt:\.pdf:;

Perl code fragment: my $export = $doc; $export =~ s:\.odt:\.pdf:; How would this be written cleaner? Not simply what are 900 other ways to write it, TMTOWTDI. ...

What are VSSVER.SCC files, and can I delete them?

I've inherited a ASP.Net 2.0 (File System) Web Project from a client, where a few different companies have worked on this project in recent years. The project has been handed from one company to the next, before finally ending up with me. So now, as you can imagine, the code base and file and folder structure has become pretty messy and...

git - trim whitespace

I've accidentally put some whitespace in my initial commit - it shows up red in git diff --color. What's the best way to get rid of the existing whitespace and how can I avoid this happening again? I am not necessarily looking for a built-in git command. Any external program available for free on Ubuntu would also be welcome. ...

source code cleanup

I have working on a web app for almost 2 years now and a lot unnecessary code(c#, html, js, css ) has accumulated in it. I have been trying to clean it up for a while now but with not great success. Can you guys sugest ways(tools) by which i speed up this process. ...

What R# setting is reformatting this line?

VS2010 / R#5.1 I have this "line" of code: With.Mocks(_mocks).Expecting(() => { _fooServiceMock.Expect(x => x.FooMethod()).Return(fooMockData); }).Verify(() => { }); I perform a R# code cleanup, which changes the code as follows: With.Mocks(_mocks).Expecting(() => { _fooServiceMock.Expect(x => x.FooMethod()).Return(fooMockData)...

Does anyone know how to write this SQL If statement better?

I have this IF statement in my Stored Procedure: if ((@someParam = 'C') OR (@someParam = 'I' AND @SomeOtherParam <> 2 AND @SomeOtherParam <> 4 AND @SomeOtherParam <> 5)) My question is can I check @SomeOtherParam in one shot, instead of having to check it 3 separate times? ...

How can I better structure this code?

I have an lxml.objectify data structure I get from a RESTful web service. I need to change a setting if it exists and create it if it doesn't. Right now I have something along the lines of the following, but I feel like it's ugly. The structure I'm looking in has a list of subelements which all have the same structure, so I can't just lo...