Skip to main content
Filter by
Sorted by
Tagged with
832 votes
16 answers
419k views

Is there an official C# guideline for the order of items in terms of class structure? Does it go: Public Fields Private Fields Properties Constructors Methods ? I'm curious if there is a hard and ...
mmcdole's user avatar
  • 93.2k
423 votes
3 answers
189k views

A bunch of CSS files were pulled in and now I'm trying to clean things up a bit. How can I efficiently identify unused CSS definitions in a whole project?
jswanson's user avatar
  • 16.6k
130 votes
9 answers
106k views

I'm aware that branches don't really store creator information - and they're just a pointer to a commit. My goal is to be able to clean out my old branches that have been merged back to the main ...
hawkeye's user avatar
  • 36k
122 votes
5 answers
127k views

I know that Sublime Text 2 can delete the trailing white space on files upon saving. When working in a team and commiting a change to a file this tends to produce huge diffs which make peer code ...
José Luis's user avatar
  • 1,856
78 votes
7 answers
29k views

I've seen How can you find unused functions in Python code? but that's really old, and doesn't really answer my question. I have a large python project with multiple libraries that are shared by ...
Brian Postow's user avatar
  • 12.3k
73 votes
12 answers
195k views

How to clean react native project? Is there any way to clean react native project as we can clean xcode project? Any help will be appreciated!
Jagdeep Singh's user avatar
66 votes
5 answers
37k views

Having a bit of an issue with JShint and the following line of code. $location.path('map-' + map.id + '/venue-' + map.attributes.default_venue.value); I'm getting the error, Identifier 'default_venue'...
Sam Beckham's user avatar
  • 1,218
51 votes
5 answers
19k views

I am working on a c++ project where I am using a lot of #pragma omp. I use the wonderful clang-format for tidiness but it always deletes the indentation for all preprocessor directives. Is there a way ...
dawirstejeck's user avatar
40 votes
3 answers
119k views

I am new in Android Studio so I face some problem with it. I am looking for a way how to project clean. In Eclipse I would do Project -> Clean -> OK but I don't know how it is done with Android ...
Mansukh Ahir's user avatar
  • 3,563
39 votes
6 answers
81k views

I wonder if there is a simple way to call a function from a string. I know a simple way, using 'if' and 'else'. int function_1(int i, int j) { return i*j; } int function_2(int i, int j) { ...
Alan Valejo's user avatar
  • 1,315
35 votes
6 answers
25k views

In my application, I have to instantiate many different types of objects. Each type contains some fields and needs to be added to a containing type. How can I do this in an elegant way? My current ...
Patrick's user avatar
  • 12.8k
32 votes
11 answers
11k views

I'm writing some SQL queries with several subqueries and lots of joins everywhere, both inside the subquery and the resulting table from the subquery. We're not using views so that's out of the ...
MxLDevs's user avatar
  • 19.7k
32 votes
3 answers
54k views

In relation to this question: "Remove unused references (!= "using")", I would like to know if there is a tool for removing unused classes, structs, delegates, etc from a Visual Studio ...
Matthew Layton's user avatar
28 votes
4 answers
19k views

I am doing some JavaScript cleanup work on a legacy project, and trying to get rid of redundant JS libraries. I have done all the obvious ones (those that are not references from anywhere at all). But ...
Ashkan Aryan's user avatar
  • 3,534
27 votes
2 answers
33k views

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 ...
Saajid Ismail's user avatar
26 votes
5 answers
35k views

How to setup ReSharper to call "Sort usings" in class?
szkra's user avatar
  • 1,453
25 votes
11 answers
58k views

In short; i have many empty lines generated in an XML file, and i am looking for a way to remove them as a way of leaning the file. How can i do that ? For detailed explanation; I currently have this ...
Brad's user avatar
  • 4,567
21 votes
9 answers
25k views

I find stuff like this rather annoying and ugly in equals methods: if (field == null) { if (other.field != null) return false; } else if ( ! field.equals(other.field)) return false; ...
Svish's user avatar
  • 159k
21 votes
3 answers
22k views

I had to customize some projects which have been written for some other purpose but some core functionality is same for my project and works as it is. But There are lots of variables, macros,functions ...
Sreekar's user avatar
  • 1,035
20 votes
5 answers
17k views

I've accidentally put some whitespace in my initial commit. It shows up red in git diff --color. How do I get rid of the existing whitespace and how can I avoid this from happening again?
Zaz's user avatar
  • 49.1k
20 votes
1 answer
18k views

In Android Studio v2.2.2, Code Cleanup feature available under Analyze option. Analyze >> Code Cleanup What this option exactly do with code ? Please explain in details.
Priyank Patel's user avatar
19 votes
2 answers
7k views

Our team want to enforce styling rules in our C# project. I read somewhere some time that Microsoft said that ".editorconfig is the future" so we want to use this. NOTE: We don't want to use ReSharper....
Totty's user avatar
  • 277
18 votes
5 answers
1k views

Is there any way to find unused CSS in a website? I'm trying to clean up a project I just inherited.
leora's user avatar
  • 198k
17 votes
1 answer
17k views

I don't always write make files but when I do I like to try and write them well. Trying to make the interface consistent with what other developers might expect is always a struggle. What I am ...
TafT's user avatar
  • 3,215
16 votes
3 answers
6k views

I often want to perform an action on an array X times then return a result other than that number. The code I usually write is the following: def other_participants output =[] ...
Jack Kinsella's user avatar
15 votes
3 answers
2k views

Hi I am using Visual Studio 2022. I want to share code cleanup on save setting with my team. How can i do it? I tried to export settings and import it but without success.
really's user avatar
  • 302
14 votes
1 answer
5k views

In a Makefile I have: images/schematic.pdf: images/schematic.svg inkscape -D -z --file=$^ --export-pdf=$@ --export-latex sed -i "s:schematic:images/schematic:g" $@_tex What this ...
Gabriel Devillers's user avatar
14 votes
3 answers
5k views

So I just finished up writing my first script to assemble a Weibull Analysis from a text file. In all of my tinkering I suspect I may have loaded some libraries that aren't used in the final script. ...
Brian Riggs's user avatar
12 votes
4 answers
12k views

I've just fired up PHPMD for the first time and, predictably, I've got an error I can't figure out. The error is Avoid using static access to class 'InvalidArgumentException' in method 'setLang'. ...
Ben's user avatar
  • 57.6k
12 votes
1 answer
4k views

I imagine that this may be a bit of a divisive post, but it's something I've been struggling to articulate for a while, and I'd like to put it to the wider development community. I work in a role ...
Tristan Rhodes's user avatar
12 votes
1 answer
1k views

I'm doing clean up on django code - my IDE can easily detect unused variables etc in Python code, but I haven't found a way to find unused template variables - it would be much easier to clean up the ...
Kimvais's user avatar
  • 39.9k
11 votes
5 answers
2k views

Is it alright to define a lambda function to be used only locally, that is in the current block (function/method)? Consider the situation when some code is going to be executed several times (so it'd ...
Martin Heralecký's user avatar
10 votes
8 answers
9k views

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 ...
amit's user avatar
  • 10.9k
10 votes
4 answers
9k views

On a generated project I get 100s of warnings caused by unused imports and such things. Can I bulk cleanup those imports for all files?
usr's user avatar
  • 172k
10 votes
3 answers
7k views

CodeRush has this nifty plugin called cr_ClassCleaner that allows me to sort the elements in the class (e.g. methods, private variables, etc...). Can Resharper 5.x do this, either via the product ...
AngryHacker's user avatar
  • 62.1k
10 votes
3 answers
988 views

I need to do refactoring in a big legacy Python code base. Often I think "these lines don't get executed in production any more". But I am unsure. There are some tests which touch these lines. But ...
guettli's user avatar
  • 27.7k
10 votes
1 answer
2k views

I have the following settings regarding my Tab sizing in Visual Studio 17.4.1: When I use Edit->Advanced->Format Document, I get this result: I configured Code Cleanup which allegedly contains ...
Nestor's user avatar
  • 8,444
9 votes
2 answers
6k views

I've been reading Clean Code by Robert C. Martin, and came across the infamous statement: Avoid words like Manager, Processor, Data, or Info in the name of a class. So, naturally, I've tried to ...
crush's user avatar
  • 17.1k
8 votes
7 answers
4k views

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; ...
Macha's user avatar
  • 14.7k
8 votes
5 answers
6k views

I have a java code in which there are multiple return statements in a single method. But for code cleaning purpose, I can have only one return statement per method. What can be done to overcome this. ...
userch's user avatar
  • 137
8 votes
2 answers
2k views

I have code that looks like this: for(int i=0; i < a; i++){ List<Integer> list = elementA.get(i); SomeClass rg = new SomeClass(list, a, methodA(i)); int result = ...
bartektartanus's user avatar
8 votes
1 answer
3k views

Newer versions of Visual Studio Support EditorConfig within the IDE which is useful, however it would be best if I could run it from the command line (and therefore in automation). Is there any stand ...
aolszowka's user avatar
  • 1,410
8 votes
1 answer
654 views

I'm using Visual Studios Code Cleanup on Save to automatically clean my code when i save. It also removes unused namespaces. But now i noticed that it even removes namespaces when they are actually in ...
Tim Schmelter's user avatar
8 votes
3 answers
3k views

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?
UnkwnTech's user avatar
  • 91.4k
7 votes
1 answer
19k views

I have a python script that contains a class. This class has a __del__ method for usual cleanup. If I delete the class during the normal execution of the script, I want some cleanup to be done. I ...
mayk93's user avatar
  • 1,547
7 votes
2 answers
2k views

I was wondering if there is a "cleaner" solution to using dependency injection with binding to classes with a lot of arguments, since according to Robert C.Martin's Clean Code, it's better not to use ...
RubenHerman's user avatar
  • 1,884
7 votes
2 answers
2k views

I 've searched on google some online unused css removers that you have to pay. I also checked here on stackoverflow for programs that might do that. I only found an easy way via google chrome. ...
Datacrawler's user avatar
  • 2,904
7 votes
3 answers
10k views

I have just been through the following paper and I found it extremely useful: http://www.objectmentor.com/resources/articles/Clean_Code_Args.pdf I am looking for similar papers/books/tutorials/etc. ...
kms333's user avatar
  • 3,307
7 votes
3 answers
11k views

I have a service which uses @angular/http to load data from an API. I want to create a projection of the retrieved data for my Components using this data. Therefore I wrote the following code: ...
Gregor Woiwode's user avatar
7 votes
3 answers
2k views

I am little confuse in the efficient way to use connect() from react-redux library. I have the blow component class SignUp extends React.Component { //some functions render(){ return ( <...
The Coder's user avatar
  • 4,137

1
2 3 4 5
13