Skip to main content
Filter by
Sorted by
Tagged with
46 votes
1 answer
8k views

Is there a way to transform automatically this static method invocation (Arrays.asList): import java.util.Arrays; import java.util.List; public class StaticImport { public static void main(...
gontard's user avatar
  • 29.7k
34 votes
6 answers
14k views

I am having trouble finding the correct refactor option for the following scenario: I have code like this (in Outer.java): public class Outer { // ... class stuff public static class Inner ...
Grundlefleck's user avatar
30 votes
3 answers
3k views

Recently I've found myself working with R code that is all over the map in terms of coding style - multiple authors and individual authors who aren't rigorous about sticking to a single structure. ...
geoffjentry's user avatar
  • 4,764
27 votes
2 answers
11k views

I am in the middle of a big refactoring. I have dozens of methods, which are called via positional parameters. Now I would like to have them called via named parameters. The methods exist in several, ...
Dio F's user avatar
  • 2,548
23 votes
12 answers
2k views

I need to change the signature of a method used all over the codebase. Specifically, the method void log(String) will take two additional arguments (Class c, String methodName), which need to be ...
Hayati Guvence's user avatar
21 votes
6 answers
8k views

I am about to starting to work on a project which involves refactoring and modifying existing code which is in c & c++. The code is a bloated one and is in huge volume. Of course since the code ...
Alok Save's user avatar
  • 208k
20 votes
5 answers
6k views

I use vim as my editor but I would like to get some of the same power of the IDE's for java when it comes to refactoring. Are there any commandline tools for refactoring java? I could probably hack ...
Jeremy Wall's user avatar
  • 25.6k
19 votes
3 answers
10k views

There are two major refactoring tools which can be installed for Visual Studio that provide C++ support. The full versions of both tools are $250, and they seem to offer similar functionality. They ...
18 votes
5 answers
4k views

I have interface public interface ObjectBuilder<E> { E buildObject(); } Also, the project has a lot of classes that implement non-generic version of the interface. class MyClassBuilder ...
turbanoff's user avatar
  • 2,509
18 votes
5 answers
22k views

I and my team are working on an angular application from more than a year now. As part of our code refactoring process we want to delete unused or dead code from our repo. Is there any technique or ...
Abdus Sattar's user avatar
17 votes
1 answer
2k views

This question is a follow-up for this. Say I have some class Foo. class Foo { protected String x = "x"; public String getX() { return x; } } I have a program that uses ...
michaelsnowden's user avatar
17 votes
2 answers
5k views

Is Xcode 5 able to change method's signature? As far as I can tell no, but I'd like to be shown wrong. If I either try to add (or remove) a method's parameter, I am welcomed by the Needs 1 fewer (...
Blaz's user avatar
  • 3,618
16 votes
3 answers
30k views

I'm in the process of moving a project currently compiling with gcc to clang, and have a bunch of warnings that gcc didn't generate (-Winconsistent-missing-override). clang-tidy works for fixing these ...
nishantjr's user avatar
  • 1,830
16 votes
4 answers
5k views

When writing C++ code, I often start by writing full 'implementation' code in my header files, then later need to refactor the implementation into a .cpp file. This is great, but I find this process ...
aaaidan's user avatar
  • 7,386
15 votes
3 answers
7k views

When I'm working on Android project I would like to use some magic shortcut that would extract my string to strings.xml and also allow me to change the key. Is there any? If there isn't, is there a ...
Michal Chudy's user avatar
  • 1,903
15 votes
3 answers
10k views

Recently I've been making some improvements to a lot of the controls we use, for example give properties default values and making buttons private instead of protected. By making this kind of ...
Sander's user avatar
  • 266
14 votes
1 answer
5k views

Using pycharm, I wish to refactor methods into a class. (Staticmethod would do) Current: import math class Solver(object): def __init__(self, a, b, c): self.a = a self.b = b ...
oria general's user avatar
13 votes
4 answers
19k views

For example I have many classes than implement my interface. After adding new method definition in the interface, how can I fast-add blank interface implementations for all that classes?
Jack's user avatar
  • 455
13 votes
5 answers
9k views

I'm working on a big Python code base that grows and grows and grows. It's not a single application - more of a bunch of experiments that share some common code. Every so often, I want to make a ...
Peter's user avatar
  • 13.8k
13 votes
3 answers
18k views

I switched to Visual Studio Code for Python programming recently. Below is my Python configuration in Visual Studio Code settings: "python.pythonPath": "/Users/hzhang/.virtualenvs/env-2.7/bin/python",...
Haifeng Zhang's user avatar
13 votes
4 answers
4k views

The source code of our application is hundreds of thousands of line, thousands of files, and in places very old - the app was first written in 1995 or 1996. Over the past few years my team has ...
David's user avatar
  • 13.7k
12 votes
3 answers
7k views

I believe my source code files feature many imports that are not used in the code (as I have a bad habit of copying them from existing to new files). When coding C# in Visual Studio (or, maybe, it's a ...
Ivan's user avatar
  • 64.5k
12 votes
3 answers
2k views

In our product, we have things called "services" which are the basic means of communication between different parts of the product (and especially between languages—an in-house language, C, Python and ...
Chris Morgan's user avatar
  • 91.6k
12 votes
1 answer
706 views

This has implications on code portability of C++11 code in general. I am talking about having a new code generation stage akin to the C/C++ preprocessor stage wherein we can make the generated C++ ...
Steven Lu's user avatar
  • 44k
11 votes
2 answers
5k views

I'm looking for a tool that will automate the process of optimizing the imports on a code base. This tool is available in most IDEs (IntelliJ for instance) which removes unused imports and expands ...
lucidquiet's user avatar
  • 6,658
11 votes
1 answer
2k views

I have the following class: class Dogs(object): def __init__(self): self.names = [] self.breeds = set() def number(self): return len(self.names) I want to change ...
Seanny123's user avatar
  • 9,446
11 votes
2 answers
1k views

I have to modify around 1 000 of typescript files in a specific way: I need to replace all StringLiteral and JsxText tokens with a CallExpression to a translation function for internationalization ...
Tim Rudnevsky's user avatar
10 votes
10 answers
7k views

I want to delete unused local variables from C file. Example: int fun(int a , int b) { int c,sum=0; sum=a + b; return sum; } Here the unused variable is 'c'. I will externally have a list of ...
user65514's user avatar
  • 111
10 votes
1 answer
23k views

Recently I started to use Black code formatter for my projects and sometimes it can be hard to track did I formatted all my changed files or not. Let's assume that my project contains 20 different ...
user avatar
10 votes
1 answer
15k views

Is there an option to remove and sort usings automatically on save for the current document? This used to be provided by the Power Commands for Visual Studio extension. Is this available somewhere in ...
dodekja's user avatar
  • 595
10 votes
6 answers
19k views

I am trying to re factor some code by breaking a class into several other classes. to do so i want to move some methods already existing in my old class to new class. But these methods are being ...
Shruti Rawat's user avatar
10 votes
1 answer
2k views

VS Code has a 'Convert namespace import to named imports' refactoring. As far as I understand, the refactoring is defined in the Typescript codebase itself, so it's not specific to VS Code. I need to ...
Maksym's user avatar
  • 508
10 votes
6 answers
5k views

EDIT : I submitted an Eclipse enhancement request for this refactoring. Is there a way to move a private field from one class to its helper class? The below chicken-scratch UML shows what I'm doing ...
Jeff Axelrod's user avatar
  • 28.3k
10 votes
3 answers
2k views

We have a sanity check method void IsNotNull<T>(T obj){...} invocation IsNotNull(obj); I want to replace this to invoke the other overload that takes a second param of type string (message) ...
Nasmi Sabeer's user avatar
  • 1,380
10 votes
1 answer
1k views

It is possible to define custom snippets of code that VS Code can auto complete. These can even use place-holders so that one can fill in the blanks as required. /* Before */ //= /* After (for ...
Maddy Guthridge's user avatar
9 votes
1 answer
13k views

Is there a way to do all the lightbulb-action for a whole Solution and with a button or a shortcut? Or to add a using for a term which could be simplyfied but is not shown through a lightbulb? I have ...
Gadawadara's user avatar
  • 1,025
9 votes
3 answers
2k views

How to refactor this class programmatically via Java code/Groovy plugin? Let's say, I need to: Rename foo.method2 to foo.method3 Rename myMethod to yourMethod Change the imported package org.you.core....
Garruk The Wildspeaker's user avatar
9 votes
1 answer
1k views

Does anyone know if it's possible to configure VSCode to have the following occur after moving a file to another locations? Update the namespace of the class/trait. Update the imports of all other ...
pickle's user avatar
  • 1,047
9 votes
1 answer
626 views

Is there a way to get clang-format to turn this: function_name("a very very " | <-- column limit "very very " | "long string"); ...
iPherian's user avatar
  • 968
9 votes
1 answer
1k views

It used to be that when I renamed a class file (maybe also others) in VS2012, it prompted me to renamed everything, then did a nice refactor after renaming the class to the new file name. It suddenly ...
ProfK's user avatar
  • 51.4k
8 votes
8 answers
10k views

I have a foreach loop in Java (simplified version here) List<String> names = getNames(); for(String name:names) { doSomething(name); } Is there an automated way to refactor this to a ...
Thomas Weller's user avatar
8 votes
3 answers
3k views

I'm looking for a tool to find duplicate or similar code of Java/Javascript. I can't tell the exact definition of "similar", but I wish the tool is smart enough and give me advices to refactor the ...
Leon's user avatar
  • 3,252
8 votes
1 answer
2k views

Why I cannot (?) move a method from one Dart file to another using Android Studio and Flutter Plugin? My file is getting big and I decided to refactor it by separated some Widget build methods to ...
alexpfx's user avatar
  • 6,720
8 votes
1 answer
1k views

IntelliJ provides Extract Property refactoring which can be used to extract maven artifact versions to properties in pom.xml. Extract Property refactoring creates a new property definition in the ...
Chacko's user avatar
  • 1,576
7 votes
7 answers
2k views

What are common traits/properties of programming languages that facilitate (simplify) the development of widely automated source code analysis and re-engineering (transformation) tools? I am mostly ...
none's user avatar
  • 5,775
7 votes
3 answers
2k views

I want to make order of functions in header .h to be consistent with the order of functions in source file .cpp. Example B.h class B{ void f2(); //<--- wrong order void f1(); }; B.cpp ...
javaLover's user avatar
  • 6,455
7 votes
3 answers
8k views

I've been stuck with the unpleasant task of "unminifying" a minified JavaScript code file. Using JSBeautifier, the resulting file is about 6000 lines long. Ordinarily, the variable and parameter ...
Vivian River's user avatar
  • 32.6k
7 votes
2 answers
2k views

Is there a way to perform the opposite of the "Extract Method" refactor in Visual Studio? I have a legacy codebase that has ~50 very short, private functions that are only used once each, and I have ...
Nick Udell's user avatar
  • 2,502
7 votes
2 answers
5k views

Often after refactoring throws sections become unnecessary. IntelliJ highlights them with grey showing that they can be removed, but I'd like to remove them automatically (just like unused imports get ...
Sasha Shpota's user avatar
  • 10.5k
7 votes
4 answers
3k views

I have lots of header files with long method implementation inside. Is there An automatic way of doing that? One-by-one can take a lot of time... Thanks.
Tsury's user avatar
  • 739

1
2 3 4 5
8