Menu

#1293 Disable VariableNamingConventions for native methods

PMD-5.2.3
closed
None
PMD
3-Major
Feature-Request
5.1.3
2014-12-21
2014-12-05
No

For this line :
private native void stream_dip_set_data(long stream, long dip_x, long dip_z);

I've the error :
VariableNamingConventions

=> Problem : this is a native function & not a variable !

Discussion

  • Andreas Dangel

    Andreas Dangel - 2014-12-15

    The rule actually complains about the two parameter names "dip_x" and "dip_z" - they contain underscores.

    There are a couple of parameters, to configure the rule: http://pmd.sourceforge.net/pmd-5.2.2/pmd-java/rules/java/naming.html#VariableNamingConventions

    You can disable "checkParameters" to ignore all method parameter names.

    Or do you think, a rule property, e.g. "ignoreNativeMethods" would be better? However, I would by default leave the rule, like it is currently - check native methods by default, too.

    Let me know, if you want a "ignoreNativeMethods" flag.

     
  • Andreas Dangel

    Andreas Dangel - 2014-12-15
    • status: open --> more-info-needed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-Next
     
  • Denis SEMMAU

    Denis SEMMAU - 2014-12-16

    Hello ,

    Yeah i think it would be a good idea to have an option to disable this rule for native methods !
    I have the same problem with the rule MethodNamingConventions that checks underscores on method names (I probably didn't report the correct one) : it would be interesting to define the same option (disable native methods) for this rule too !

    Thanks a lot,

     
  • Andreas Dangel

    Andreas Dangel - 2014-12-17
    • summary: VariableNamingConventions False positive for native methods --> Disable VariableNamingConventions for native methods
    • status: more-info-needed --> in-progress
    • Type: Bug --> Feature-Request
     
  • Andreas Dangel

    Andreas Dangel - 2014-12-17

    Added a new property checkNativeMethodParameters with which you can ignore parameters of native methods.
    Will be included in the next release.

     
  • Andreas Dangel

    Andreas Dangel - 2014-12-17
    • status: in-progress --> closed
     

Log in to post a comment.