Inspections: Inspect Code doesn't use the Error Profile?

Hi,

when I do Analyze->Inspect Code (actually I do that in order to try to reproduce TeamCity inspection runner behavior), it gives me error report where IDEA's *standard* code inspection shows no warnings/errors.
It seems Inspect Code is using a profile on it's own and is not using the Project Default Error profile.

Could someone explain me how to get the same analyzis Idea is doing with Inspect Code (- and hopefully get the same behavior with TeamCity) ?

5 comments
Comment actions Permalink

Hello nodje,

IDEA uses profile selected in combo box: select the same profile as used
by TeamCity and the results must be the same (if plugins enabled in TeamCity
and in your instance of IDEA are the same)

Thank you
-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

Hi,

when I do Analyze->Inspect Code (actually I do that in order to try to
reproduce TeamCity inspection runner behavior), it gives me error
report where IDEA's standard code inspection shows no
warnings/errors.

It seems Inspect Code is using a profile on it's own and is not using
the Project Default Error profile.

Could someone explain me how to get the same analyzis Idea is doing
with Inspect Code (- and hopefully get the same behavior with
TeamCity) ?

---
Original message URL:
http://www.jetbrains.net/devnet/message/5246632#5246632



0
Comment actions Permalink

Hi, I'm not sure I understand what you mean.

here's how I work for inspections:

I want to keep the same profile across a projects. Since it's not possible to share an IDE level profile, I manually maintain a Default project profile synchronized with the project one. So each every project has a local shared Project profile identical to the IDE one.

In order to avoid trouble with "external" files, I create a shared scope for each project that comprises every file under src/ (all projects are maven based so all project files are under src/). The local Default project profile is applied to this scope, so files like test-output/* are not included in inspections.

We this setting, I try to maintain all my files GREEN.
Now I try to enforce this by using the TeamCity's Inspection build, but I get inspection warning that do not appear in IDEA.

When I do Analyze->Inspect Code, I get a dialog box where I can select the scope and the inspection profile.
First, I have to manually select the scope that is the Default project profile is applied too in the IDEA configuration. Then, the Default project profile is selected by dedault in the combo for profile selection.
When I run this with, I get inspection warning/errors on classes that appear to be green in IDEA regular editor window.

That means that there's a configuration discrepancy somewhere: either IDEA regular editor window doesn't display an inspection result that is detected by the Profile, or the Profile used by the Analyze->Inspect Code is different than the one used by IDEA.

Now, speaking about TeamCity, I don't see how I can select the Profile, but the latter give me even more inspection results on files that were green in IDEA. That's probably a question that should go the TeamCity disucssion list.

thanks
-nodje

0
Comment actions Permalink

The IDEA editor gutter stripe can appear GREEN for a file but Analyze->Inspect Code can show warnings if your profile contains inspections tagged with "(availabe for Analyze|Inspect Code)". These inspections only run when you run Analyze->Inspect Code.

0
Comment actions Permalink

Hello nodje,

As was mentioned IDEA can show more warnings when it inspects in batch mode
because some inspections are disabled in editor. Is it your case?

Could you please describe your scenario with profiles? Do you have multiple
projects with the same profile shared with your team? May be it is possibble
to avoid manual sync for your profiles?

Seems that in TeamCity you use our default profile (if you leave all fields
blank). If you want to inspect with some profile you should put corresponding
file to the version control and point TeamCity to that file.


Thank you
-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

Hi, I'm not sure I understand what you mean.

here's how I work for inspections:

I want to keep the same profile across a projects. Since it's not
possible to share an IDE level profile, I manually maintain a Default
project profile synchronized with the project one. So each every
project has a local shared Project profile identical to the IDE one.

In order to avoid trouble with "external" files, I create a shared
scope for each project that comprises every file under src/ (all
projects are maven based so all project files are under src/). The
local Default project profile is applied to this scope, so files like
test-output/* are not included in inspections.

We this setting, I try to maintain all my files GREEN.

Now I try to enforce this by using the TeamCity's Inspection build,
but I get inspection warning that do not appear in IDEA.

When I do Analyze->Inspect Code, I get a dialog box where I can select
the scope and the inspection profile.

First, I have to manually select the scope that is the Default project
profile is applied too in the IDEA configuration. Then, the Default
project profile is selected by dedault in the combo for profile
selection.

When I run this with, I get inspection warning/errors on classes that
appear to be green in IDEA regular editor window.

That means that there's a configuration discrepancy somewhere: either
IDEA regular editor window doesn't display an inspection result that
is detected by the Profile, or the Profile used by the
Analyze->Inspect Code is different than the one used by IDEA.

Now, speaking about TeamCity, I don't see how I can select the
Profile, but the later give me even more inspection results on files
that were green in IDEA. That's probably a question that should go the
TeamCity disucssion list.

thanks
-nodje
---
Original message URL:
http://www.jetbrains.net/devnet/message/5246723#5246723



0
Comment actions Permalink

thanks Anna and Alex, I've been able to find out inspection that applies only to batch mode.
Now how can filter inspections in order to be able to manage batch mode only inspections? I can't fin a way to do that.


BTW, there seem to be a minor bug when using the Inpect Code result dialog - at least in #9939:
- when you right click on an inspection to apply a resolution to all classes concerned, the behavior seem erratic at best.

for instance: @SuppressWarnings({"WeakerAccess"}) get applied once per problem in class, which leads to insertion like:
@SuppressWarnings({"WeakerAccess", "WeakerAccess", "WeakerAccess", "WeakerAccess", "WeakerAccess", "WeakerAccess", "WeakerAccess"........})

Add EntryPoint applied to the inpection header make all problem dissapear from the Dialog, but they would all reappear on next inspect code.


Anna, I'd be glad to have a way to apply ONE unique profile to all projects. As far as I remember, it wasn't possible to share a global/IDE profile. So I came up with the actual solution which is synchronizing IDE profile with a local, shared, project profile, and this for each every profile.
I apply the same solution for global Coding Convention sharing.

I don't understand how to select a specific profile in TeamCity 4.0.1. I guess I need to add a 'Inspections profile path' but I don't know how to do that.

thanks
-nodje

0

Please sign in to leave a comment.