automated-refactoring

Is there a command line tool to Optimize Imports on Java project?

馋奶兔 提交于 2019-12-10 16:26:44
问题 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 any .* imports into the those specifically used by the code. I'd like to add this as a MVN goal, or Ant Task, or just something I can run before my commit/push. Perhaps there is a way run IntelliJ at the command line to specifically execute this feature, but I haven't found such a command. 回答1: If

why doesn't eclipse-python have magic refactor?

我怕爱的太早我们不能终老 提交于 2019-12-10 15:16:42
问题 Eclipse is able to utilize compiled bytecode to enable "magic refactor" functionality--renaming methods, tracing up and down class hierarchies and tracing through method calls. What technical barriers exist that make this harder to do for languages like Python and Javascript? 回答1: Because of dynamic binding. Python is a dynamic language in a way that you can do almost everything with your variables. You can even access the globals-dict and introduce new variables composed of runtime values.

Programming Language Properties that facilitate refactoring?

混江龙づ霸主 提交于 2019-12-09 17:09:06
问题 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 thinking in terms of programming language features that make it easier to develop static analysis and refactoring tools (i.e. compare Java vs. C++, the former of which has better support for refactoring). In other words, a programming language that would be explicitly designed to provide support

Eclipse - record and apply move and rename refactorings to another workspace

北慕城南 提交于 2019-12-07 10:42:12
问题 I'm currently working in a big java project with quite a few submodules that are worked on by different teams. Some of these teams are building the "framework", others are building the "application" based on the framework. When the framework guys move or rename a class, the applications guys get compile errors wherever they are using a refactored framework class. Is there a way in Eclipse ( Galileo Release ) to record the change and update the references in another workspace? What I've tried

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

心已入冬 提交于 2019-12-07 02:11:43
问题 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

Getting clang-tidy to fix header files

≯℡__Kan透↙ 提交于 2019-12-06 19:41:26
问题 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:

Tools for refactoring C# public fields into properties

天大地大妈咪最大 提交于 2019-12-06 02:25:16
问题 I have a lot of C# code that uses public fields, and I would like to convert them to properties. I have Resharper, and it will do them one by one, but this will take forever. Does anyone know of an automated refactoring tool that can help with this? 回答1: Resharper does it very quickly, using Alt+PageDown / ALt+Enter (with the default key bindings). If you are at the first field, Alt+PageDown will jump to the next one (since it'll include wrapping public fields as a suggested refactoring), and

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

不羁岁月 提交于 2019-12-05 15:43:12
问题 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 2 years ago . 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

Which clang-tidy checks provide automated fixes?

 ̄綄美尐妖づ 提交于 2019-12-05 13:49:00
I'd like to find out which of the clang-tidy checks are possible to run with the -fix option, i.e. automatically generate fixed code. I know all the modernize-* checks can do this and some other checks can too (like google-readability-casting) but nowhere did I find a complete list. Is there a list somewhere? Or a method to find out other than reading the source of each and every check? grep --include=\*.cpp -rc './' -e "FixItHint"|grep -v ':0$' > FixItChecks.txt I ran this grep command in the clang-tidy source directory. It counts the number of occurences of "FixItHint" string in all .cpp

Eclipse - record and apply move and rename refactorings to another workspace

拥有回忆 提交于 2019-12-05 12:01:19
I'm currently working in a big java project with quite a few submodules that are worked on by different teams. Some of these teams are building the "framework", others are building the "application" based on the framework. When the framework guys move or rename a class, the applications guys get compile errors wherever they are using a refactored framework class. Is there a way in Eclipse ( Galileo Release ) to record the change and update the references in another workspace? What I've tried so far is creating a refactoring script during the rename refactoring, but when I try to apply that