IntelliJ: How to enable warning messages for tests?

philmasterplus

Active member
I've been following the instructions on our wiki for IntelliJ. It's been working great so far, but there's a problem: Test code in the /test/ directory are not automatically verified/linted (i.e. no IDE errors or warnings). Since code under /src/ are verified/linted automatically, I assume it's a configuration problem. How can I configure IntelliJ to "work properly" for tests?

1612780904261.png
 

fronobulax

Developer
Staff member
I don't understand the question. "linted" and "verified" may mean something different to me. I don't think anything is automatically "liniting". I manually run the Analyze command and it can be run on on anything in /test/ or /src/ I would have called that "lint" except I don't want nor expect it to be automatic.

On my system anything that is a Java file, regardless of location, is checked for compilation errors. If that is "verified" I don't know what I did to make it happen in /test/

Tangentially, if someone put together a KoLmafia configuration for IntelliJ, I'd use it. tabs vs spaces and what Java version is enforced at the source code level are two things that have to be there but my preference is usually to make things "easier" so there is room for more.
 

MCroft

Developer
Staff member
@philmasterplus, Do you have the test folder marked as "test sources root"? Right click and "Mark Directory As ..." or go into the Project Structure>Modules, and select "test" and mark it as test sources root.

Once we see if that works, we can add those instructions to the project structures section (3) of the IJ Setup



Tangentially, if someone put together a KoLmafia configuration for IntelliJ, I'd use it. tabs vs spaces and what Java version is enforced at the source code level are two things that have to be there but my preference is usually to make things "easier" so there is room for more.
Veracity did and I put 'em in the Wiki. It is entirely possible that they can be improved.

KoLMafia Style Definitions
 

fronobulax

Developer
Staff member
@philmasterplus, Do you have the test folder marked as "test sources root"? Right click and "Mark Directory As ..." or go into the Project Structure>Modules, and select "test" and mark it as test sources root.

Once we see if that works, we can add those instructions to the project structures section (3) of the IJ Setup




Veracity did and I put 'em in the Wiki. It is entirely possible that they can be improved.

KoLMafia Style Definitions

I had some version but Nov. 2020 seems more recent. Thanks.
 

MCroft

Developer
Staff member
It was trying to put that up that kicked off the chain of events that led @fewyn to update the wiki and the forum. If you come up with better ones, they can be updated.
 

philmasterplus

Active member
I don't understand the question. "linted" and "verified" may mean something different to me. I don't think anything is automatically "liniting". I manually run the Analyze command and it can be run on on anything in /test/ or /src/ I would have called that "lint" except I don't want nor expect it to be automatic.

On my system anything that is a Java file, regardless of location, is checked for compilation errors. If that is "verified" I don't know what I did to make it happen in /test/

I meant the IDE running static analysis in the background and highlighting errors, warnings, etc.

@philmasterplus, Do you have the test folder marked as "test sources root"? Right click and "Mark Directory As ..." or go into the Project Structure>Modules, and select "test" and mark it as test sources root.

Once we see if that works, we can add those instructions to the project structures section (3) of the IJ Setup

That solved it! Thank you.

P.S. When I followed the Intellij Setup instructions on the wiki, I didn't have to "Mark as Sources Root" on /src/ or /lib/; IntelliJ just did it for me, so I wasn't even aware it was a thing. I'm confused as to why IntelliJ didn't do the same for /test/.
 
Last edited:
Top