automated-refactoring

Visual Studio : hotkey/way to automatically sort functions in .h to be consistent with .cpp

和自甴很熟 提交于 2019-12-05 07:42:30
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 #include "B.h" void B::f1(){} void B::f2(){} Expected Result (B.h) class B{ void f1(); //<---- nice void f2(); }; Question Primary Question: Is there any (semi) automatic way to do ( .cpp -> .h ) in Visual Studio? Hotkey? Script? Plugin? Visual AssistX / Resharper? There is a similar question but it asks the opposite way (it has no solution). Secondary question: How to do the opposite way (semi) automatically? (

IntelliJ Refactor to use LoD

萝らか妹 提交于 2019-12-05 06:07:50
问题 Say I have some class Foo class Foo { protected String x = "x"; public String getX() { return x; } } I have a program that uses Foo and violates LoD class Bar { protected Foo foo; public Bar() { this.foo = new Foo(); } public Foo getFoo() { return foo; } } public static void main(String [] args) { Bar bar = new Bar(); String x = bar.getFoo().getX(); } Refactoring to use LoD looks like this: class Bar { protected Foo foo; public Bar() { this.foo = new Foo() } public String getFooX { return foo

Automated-refactoring tool to find similar duplicate source code for Java/Javascript?

二次信任 提交于 2019-12-05 05:55:05
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 code, e.g., (1) class A and class B have imilar methods (e.g., there 5 methods have same method name, arguments and similar implementation appearing in both classes), then it should advise to move these similar methods into a base class. (2) class A has similar code lines at different places multiple times, the tool should advise to move these similar code lines into a single method. I tried PMD

Automatically simplifying/refactoring Python code (e.g. for loops -> list comprehension)? [closed]

烂漫一生 提交于 2019-12-05 01:52:02
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . In Python, I really enjoy how concise an implementation can be when using list comprehension. I love to do concise list comprehensions this: myList = [1, 5, 11, 20, 30, 35] #input data bigNumbers = [x for x in myList if x > 10] However, I often encounter more verbose implementations like this: myList = [1, 5, 11

Getting clang-tidy to fix header files

非 Y 不嫁゛ 提交于 2019-12-05 00:44:48
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 errors in the *.cpp files, however it doesn't touch the hpp files because a compile command wasn't found in the database (as I would expect). I'm using ninja to build the project and ninja -t compdb cc cxx > .build/compile_commands.json to generate the compilation database. I've tried running: clang-tidy-3.6 -p .build/ \ $(find src/ -name *.cpp) \ $(find src/ -name *.hpp) \ --checks=misc-use

C++ Refactoring - Move method to implementation file

牧云@^-^@ 提交于 2019-12-04 06:23:23
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. If you are using Visual Studio, there's an add-in called Visual Assist that can help you to do this. I'm using it at work and it is really helpful. Unfortunately this add-in is not free but you can install the trial to do your stuff and test it. KDevelop has such ability too: Right click to the method -> Refactoring -> Move to cpp In Eclipse CDT its combination is Alt+Shift+T There's a free version of DevExpress Refactor! for C++ that has two

Is there a tool for Scala to clean all the unused imports from all the code files? [closed]

£可爱£侵袭症+ 提交于 2019-12-04 01:34:49
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 feature of an add-on of it) one can wipe out all the unused imports in just a click. Is there an analogous tool for Scala? Would be cool if I could just point it to my sources directory and it would clean all the files inside it and all its subdirs and subdirs of them (etc). IntelliJ can automatically clean up imports, not just highlight them, and for the whole directory. The shortcut is Ctrl +

R language aware code reformatting/refactoring tools?

醉酒当歌 提交于 2019-12-03 22:10:43
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. There are certain tasks that I'd like to automate better than I currently do. I'm looking for a tool (or tools) that manage the following tasks - listed in increasing order of desire but also somewhat in increasing order of skepticism of existence. Basic formatting. Things like converting "if( foo )" to "if (foo)" and achieving uniformity in terms of brace location and that sort of thing. Converting

C / C++ packages to understand code for refactoring

懵懂的女人 提交于 2019-12-03 18:28:13
问题 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 needs to be modified, an understanding of the code has to be developed and in a very short span of time since we have some pretty time pressed project schedule. Can anyone please suggest any open source tools which will help in achieving the above. In short what I am looking for is tool which can:

Automatic regenerate designer files

南笙酒味 提交于 2019-12-03 16:27:10
问题 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 adjustments you need to regenerate the designer files of the forms which have this control on it or controls which inherit from the control. In the past this wasn't really a problem because we only had 20-30 forms. At the moment we've got more than 300 forms which would mean opening the same amount of