code-inspection

Disable PHPStorm's built-in inspection of JavaScript semicolons

我的梦境 提交于 2019-12-22 08:46:35
问题 PHPStorm 8.0.3 for Mac wants to tell me about missing semicolons in my JavaScript. I don't want PHPStorm to do this. This blog page says... Built-in inspections help you detect errors and potential problems, from obvious ones like a missing semicolon ... Later, the blog indicates that "The full list of built-in inspections is available in Preferences | Inspections", but I can find no mention of semicolons in any of the subcategories of the 14 inspection categories. Is PHPStorm intransigent

PyCharm false syntax error using turtle

旧街凉风 提交于 2019-12-20 01:55:12
问题 The code below works perfectly, however, PyCharm complains about syntax error in forward(100) #!/usr/bin/python from turtle import * forward(100) done() Since turtle is a stanrd library I don't think that I need to do additional configuration, am I right? 回答1: The forward() function is made available for importing by specifying __all__ in the turtle module, relevant part from the source code: _tg_turtle_functions = [..., 'forward', ...] __all__ = (_tg_classes + _tg_screen_functions + _tg

How to use IntelliJ IDEA to find all unused code?

三世轮回 提交于 2019-12-17 08:03:29
问题 When I am in a .java file the unused code is usually grayed out or has a green underline saying this code will probably (probably because of some weird JNI/Reflection corner cases) be unused. But I have this project with thousands of Java files and I want to find ALL INSTANCES of such probable-unused codes. How can I do that in IntelliJ IDEA? 回答1: Just use Analyze | Inspect Code with appropriate inspection enabled ( Unused declaration under Declaration redundancy group). Using IntelliJ 11 CE

How to use IntelliJ IDEA to find all unused code?

别来无恙 提交于 2019-12-17 08:03:17
问题 When I am in a .java file the unused code is usually grayed out or has a green underline saying this code will probably (probably because of some weird JNI/Reflection corner cases) be unused. But I have this project with thousands of Java files and I want to find ALL INSTANCES of such probable-unused codes. How can I do that in IntelliJ IDEA? 回答1: Just use Analyze | Inspect Code with appropriate inspection enabled ( Unused declaration under Declaration redundancy group). Using IntelliJ 11 CE

How can I tell if a function is called in a loop within python's tracer function?

时光毁灭记忆、已成空白 提交于 2019-12-10 18:54:59
问题 In the tracer callback set with python's sys.settrace() , I can get the function name, line number, etc. Now I want to know whether the current function being traced is called in a loop by its caller. Is there a way to do this? 来源: https://stackoverflow.com/questions/30770628/how-can-i-tell-if-a-function-is-called-in-a-loop-within-pythons-tracer-function

PhpStorm: get code inspection warnings for “Methods with the same name as their class will not be constructors”

纵饮孤独 提交于 2019-12-10 16:31:29
问题 Okay I've finally switched to PHP7. My code is a bit old and will be refurbished. Some of the problems are: class MagicClass function MagicClass(){ //etc } Which gives an deprecation warning during execution: Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; MagicClass has a deprecated constructor in This is good: class MagicClass function __construct(){ //etc } How can I get PhpStorm code inspection to warn me for such errors in my

IntelliJ suggests wrong @NotNull annotation

我怕爱的太早我们不能终老 提交于 2019-12-10 14:20:05
问题 IntelliJ is suggesting to import com.sun.istack.internal.NotNull the @NotNull annotation (which is wrong) in the following program: public class Test implements Comparable<Test> { @Override public int compareTo(@NotNull Test o) { return 0; } } When trying the correct import com.intellij.annotations.NotNull (I think) it looks like it can't find the class: 回答1: You can Alt+Enter on the warning before you add the annotation, press Right, choose Edit Inspection Settings, then Configure

Where is a Python built-in object's __enter__() and __exit__() defined?

旧巷老猫 提交于 2019-12-07 12:11:02
问题 I've read that the object's __ enter__() and __ exit__() methods are called every time 'with' is used. I understand that for user-defined objects, you can define those methods yourself, but I don't understand how this works for built-in objects/functions like 'open' or even the testcases. This code works as expected and I assume it closes the file with __ exit__(): with open('output.txt', 'w') as f: f.write('Hi there!') or with self.assertRaises(ValueError): remove_driver(self.driver) # self

Generate function calls tree from multiple Python files

青春壹個敷衍的年華 提交于 2019-12-06 16:57:18
问题 I have inherited a bunch of Python files and looking for a way to get an understanding of what is going on within them by collecting information about all the functions that have been defined and called within those files. Example of a file (MainModule.py): Import module1 Import module2 Import module3 ... Def func1(): ... Def func2(): ... result1 = Module1.funcX(args) result2 = Module2.funcY(args) ... By looking into this file, I want IDE to report what functions have been defined within this

IntelliJ IDEA @SuppressWarnings for inspection with name of tool

大兔子大兔子 提交于 2019-12-06 05:40:01
问题 I know I can suppress warnings from IntelliJ IDEA inspections like that: @SuppressWarnings("CollectionDeclaredAsConcreteClass") public PropertiesExpander(Properties properties) { this.properties.putAll(properties); } For person from outside it may not be clear for which tool this suppression is needed. PMD uses prefixes for that: @SuppressWarnings("PMD.UnusedLocalVariable") FindBugs uses dedicated annotation: @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") Is there any