Questions tagged [code-inspection]

261 questions
405
votes
4 answers

How to use IntelliJ IDEA to find all unused code?

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…
pathikrit
  • 32,469
  • 37
  • 142
  • 221
370
votes
5 answers

What does ==$0 (double equals dollar zero) mean in Chrome Developer Tools?

In Google Chrome's developer tools, when I select an element, I see ==$0 next to the selected element. What does that mean?
oneNiceFriend
  • 6,691
  • 7
  • 29
  • 39
53
votes
5 answers

“Variable is never assigned” warning in IntelliJ IDEA can be suppressed only "partially"

Java EE + IntelliJ Idea 2016.3: I've written a class and declared a private field with a @Inject annotation. I have successfully got rid of the "unused declaration" notification from the "inspection results" window by adding javax.inject.Inject to…
rychu
  • 896
  • 1
  • 7
  • 16
34
votes
3 answers

Unclear inspection warning "NullableProblems" in IntelliJ

Why am I getting a warning from the "NullableProblems" inspection in IntelliJ on this: public class Test implements Comparable { @Override public int compareTo(Test o) { return 0; } } I'm using IntelliJ 14.1.4 and…
traveh
  • 2,700
  • 3
  • 27
  • 44
31
votes
8 answers

Kotlin suppress 'condition is always true'

Wasting more time scouring through the COUNTLESS number of inspections (which I know how to enable and disable), I cannot find ANY way to disable the particular inspection of 'Condition is always true' for my Kotlin (not Java) file in Android…
rmirabelle
  • 6,268
  • 7
  • 45
  • 42
27
votes
2 answers

Why does IntelliJ suggest to convert a call chain into a Sequence?

Assume the following Kotlin example that maps the source set src to a destination set dst: private val src: Set = setOf("hello", "world") private val dst: Set = src.map { it.length }.toSet() This works fine. However, IntelliJ's code…
20
votes
2 answers

How do I make PyCharm recognize placeholders in SQL statements?

I'm using PyCharm and I have an error on this SQL statement: SELECT * FROM table WHERE id= %(id)s The code syntax inspection says: expected, got '%' Is there a way to disable this error message? In other words, how do I make PyCharm…
Julien
  • 357
  • 2
  • 11
18
votes
1 answer

How to check which arguments a function/method takes?

To keep a couple modules I'm building in Python a bit consistent I want to do some automated code checking. For this I want to check the modules for their functions and the arguments the functions take. I can use hasattr() to check whether the…
kramer65
  • 50,427
  • 120
  • 308
  • 488
17
votes
1 answer

Code inspection says I need to dispose object. Which one?

This is my function. I already wrapped both client and message into using clause and still get error when run code inspection. Error points to first using line: public static void Send(MailItem mail) { var sender =…
katit
  • 17,375
  • 35
  • 128
  • 256
17
votes
1 answer

Intellij IDEA build-in inspection code vs checkstyle, PMD & findbugs

Recently i'm looking about the best tool set to do code inspection. My IDE is Intellij 15.0 and i know there is a good inspection capabilities there but when i look over the internet i didn't found good comparison between Intellij build-in…
Idan
  • 173
  • 1
  • 5
16
votes
1 answer

Context of lint.xml and inspection profile

In Android Studio there is the lint.xml configuration and ./idea/inspectionProfiles/.xml manageable via Settings => Editor => Inspections. I understand lint.xml is used by lint command line tool and the inspection profile is used by Android Studio…
15
votes
2 answers

Dismiss PyCharm code inspection warning for particular line of code

PyCharm's code inspection is a useful tool, but sometimes it gets things wrong. I know you can disable whole classes of warnings via settings, but what if you just want to dismiss a specific instance of a warning at a particular line?
Ghopper21
  • 10,287
  • 10
  • 63
  • 92
14
votes
2 answers

IntelliJ inspection saying module.exports does not exist for nodejs

IntelliJ is giving a warning of Property exports is not defined in type Module wherever I use module.exports= anywhere in the project.
Dakusan
  • 6,504
  • 5
  • 32
  • 45
13
votes
1 answer

Get list of methods in class using clang

In common IDEs (pick one) you often have an outline view showing you the list of methods for a specific class. Suppose I have a C++ interface class in IFoo.h that looks like this: #ifndef IFOO_H_ #define IFOO_H_ class IFoo { public: …
Konrad Kleine
  • 4,275
  • 3
  • 27
  • 35
13
votes
4 answers

Detecting empty function definitions in python

I need to detect whether a function is an empty definition or not. It can be like: def foo(): pass or like: def foo(i, *arg, **kwargs): pass or like: foo = lambda x: None What is the most elegant way to detect them using the 'inspect'…
Benji Mizrahi
  • 2,154
  • 2
  • 23
  • 38
1
2 3
17 18