Questions tagged [code-cleanup]

Code cleanup refers to the act of writing code so that it cleans up leftover data structures and other unwanted materials from memory and the filesystem. It is not the same as refactoring code, which involves making the source code itself easier to understand, maintain, and modify.

Code cleanup can also refer to the removal of all comments from source code, or the act of removing temporary files after a program has finished executing.

626 questions
798
votes
16 answers

Order of items in classes: Fields, Properties, Constructors, Methods

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 fast rule about the order of items? I'm kind of all…
mmcdole
  • 91,488
  • 60
  • 186
  • 222
423
votes
3 answers

How to identify unused CSS definitions from multiple CSS files in a project

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
  • 16,244
  • 6
  • 20
  • 15
117
votes
5 answers

Sublime Text 2: Trim trailing white space on demand

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 review more cumbersome. For that reason I prefer to…
José Luis
  • 1,816
  • 8
  • 24
  • 26
104
votes
8 answers

Is there a script to list git branches created by me?

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 branch, and list branches where this hasn't been done…
hawkeye
  • 34,745
  • 30
  • 150
  • 304
77
votes
7 answers

Finding dead code in large python project

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 multiple entry point scripts. This project has been…
Brian Postow
  • 11,709
  • 17
  • 81
  • 125
66
votes
5 answers

Ignore camelcase variable in JSHint

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' is not in camel case. This wouldn't be a…
Sam Beckham
  • 1,218
  • 2
  • 12
  • 23
65
votes
12 answers

Clean react native project

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
  • 2,556
  • 3
  • 18
  • 28
44
votes
5 answers

Indenting preprocessor directives with clang-format

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 to change that behavior? Or is there another…
dawirstejeck
  • 470
  • 1
  • 5
  • 12
39
votes
2 answers

How to project clean in Android Studio?

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 Studio.
Mansukh Ahir
  • 3,373
  • 5
  • 40
  • 66
38
votes
5 answers

How to call a function by its name (std::string) in C++?

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) { return i/j; } ... ... ... int function_N(int i,…
Alan Valejo
  • 1,305
  • 3
  • 24
  • 44
34
votes
6 answers

How do I initialize classes with lots of fields in an elegant way?

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 initialization step looks something like…
Patrick
  • 12,336
  • 15
  • 73
  • 115
32
votes
3 answers

Removing unused code in Visual Studio

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 solution. Scenario: I have an unorganised Visual Studio Solution…
Matthew Layton
  • 39,871
  • 52
  • 185
  • 313
30
votes
11 answers

Formatting Clear and readable SQL queries

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 question. After writing it I'm looking at it and…
MxLDevs
  • 19,048
  • 36
  • 123
  • 194
27
votes
4 answers

How to find out if certain javascript code is actually used?

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 there are a number of JS files that are included…
Ashkan Aryan
  • 3,504
  • 4
  • 30
  • 44
26
votes
2 answers

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…
Saajid Ismail
  • 8,029
  • 11
  • 48
  • 56
1
2 3
41 42