Code Assist and Audit Rules


You probably know the Code Assist in JDeveloper.
It examines your code in the editor, and provides
assistance to fix common problems.
For example, it identifies a parameter that is not used in your code, and proposes as fix to remove it

JDevAuditWarning:

When your code complies with all the rules, then a green square is displayed in the upper-right corner of the code editor.
When there are errors, the square is red; finally, it's orange when there are warnings (as shown above).

An interesting question was posted in the JDeveloper Forum on OTN:
Is it possible to configure JDeveloper to ignore some warnings or errors ?

Answer is Yes:

  1. Select menu Tools -> Preferences

  2. In the left Pane, expand Audit and select  Profiles

  3. In the right Pane, under tab Rules (selected by default), expand Usages

  4. Select Unused Parameters.
    NB: You can see an explanation on the rule you selected in the lower part of the screen.

  5. Unselect this rule and click OK:
    JDevAuditUnusedParam:

  6. You can then click the Save As... button and give a meaningful name

Another option (and better in my opinion) is to keep the rule selected, but change the Severity and Style (right part of the dialog).
You can set the Severity=Advisory and the Style=Warning.
With this setting, no warning/error will be shown (green square), but the unused parameter will be underlined to indicate there is a Quick Fix available (Removed Unused Parameter):

JDevAuditAssistQuickFix:


Comments:

Hey Didier, Is it possible to know the list of rules supported by Code Assist? Like I just tried naming a variable in the wrong way expecting Code Assist to show me an alert, but it didn't till I ran the Audit Rules manually. So this is not supported by Code Assist. Nice article, BTW.

Posted by Rahul on November 14, 2006 at 03:46 PM CET #

Thanks for the feedback Rahul.

I'm not aware of a publish list of rules. However, the API is documented
I've never tried it myself, but I suppose you can get the list of rules from there.
I'll check with development if I can get more information.

What do you mean by "I just tried naming a variable in the wrong way" ?

Regards,

Didier.

Posted by Didier Laurent on November 14, 2006 at 04:37 PM CET #

Post a Comment:
Comments are closed for this entry.
About

Didier Laurent - Sr Principal Support Engineer in the JDeveloper team

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today