Delete unused packages from requirements file

You can use Code Inspection in PyCharm. Delete the contents of your requirements.txt but keep the empty file. Load your project in, PyCharm go to Code -> Inspect code…. Choose Whole project option in dialog and click OK. In inspection results panel locate Package requirements section under Python (note that this section will be showed … Read more

Writing a new refactoring plugin for Eclipse?

I found the eclipse.org article the most helpful to get me started. To be honest you’re probably best off debugging some of the Eclipse refactorings to get a real feel for how they work. A good place to get started debugging the code is to set breakpoints on org.eclipse.jdt.core.dom.rewrite.ASTRewrite, particularly the rewriteAST() method, then trigger … Read more

Refactoring if/else logic

You should use Strategies, possibly implemented within an enum, e.g.: enum UserType { ADMIN() { public void doStuff() { // do stuff the Admin way } }, STUDENT { public void doStuff() { // do stuff the Student way } }; public abstract void doStuff(); } As the code structure within each outermost if branch … Read more

Visual Studio: Is there a “move class to different namespace” refactoring?

Visual Studio 2019 provides at least 2 built-in options: ‘Move to namespace…’ refactoring can be triggered on any class, and VS will prompt for the target namespace. ‘Change namespace to…’ refactoring is provided for when the current file namespace doesn’t match with the folder structure. This can be used to move individual classes to a … Read more

How do I deal with “signed/unsigned mismatch” warnings (C4018)?

It’s all in your things.size() type. It isn’t int, but size_t (it exists in C++, not in C) which equals to some “usual” unsigned type, i.e. unsigned int for x86_32. Operator “less” (<) cannot be applied to two operands of different sign. There’s just no such opcodes, and standard doesn’t specify, whether compiler can make … Read more

When is a function too long? [closed]

Here is a list of red-flags (in no particular order) that could indicate that a function is too long: Deeply nested control structures: e.g. for-loops 3 levels deep or even just 2 levels deep with nested if-statements that have complex conditions. Too many state-defining parameters: By state-defining parameter, I mean a function parameter that guarantees … Read more