[ 
https://issues.apache.org/jira/browse/MAHOUT-2108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ackelcn updated MAHOUT-2108:
----------------------------
    Description: 
When I read the code of mahout, I find some comments with issue numbers. One of 
them comes from ClusterClassificationDriver.java:
{code:java}
 // belongs to which cluster - fix for MAHOUT-1410
      Class<? extends Writable> keyClass = vw.getFirst().getClass();
      Vector vector = vw.getSecond().get();
      if (!keyClass.equals(NamedVector.class)) {
        if (keyClass.equals(Text.class)) {
          vector = new NamedVector(vector, vw.getFirst().toString());
        } else if (keyClass.equals(IntWritable.class)) {
          vector = new NamedVector(vector, Integer.toString(((IntWritable) 
vw.getFirst()).get()));
        }
      }                    {code}
These comments are quite useful for other programmers and me to understand the 
code, but I notice that not all issue numbers are written in code comments. It 
can be already quite tedious to write them into commit messages :)

 

To handle the problem, I implemented a tool to automatically instrument issue 
numbers into code comments. I tried my tool on activemq, and the instrumented 
version is [https://github.com/ackelcn/mahout] 

 

To avoid confusion, if there is already an issue number in code comments, my 
tool ignored the issue number. All my generated comments start from //IC, so it 
is easy to find them.

 

Would you please some feedbacks to my tool? Please feel free to merge my 
generated comments in your code, if you feel that some are useful.

  was:
When I read the code of mahout, I find some comments with issue numbers. One of 
them comes from ClusterClassificationDriver.java:
{code:java}
 // belongs to which cluster - fix for MAHOUT-1410
      Class<? extends Writable> keyClass = vw.getFirst().getClass();
      Vector vector = vw.getSecond().get();
      if (!keyClass.equals(NamedVector.class)) {
        if (keyClass.equals(Text.class)) {
          vector = new NamedVector(vector, vw.getFirst().toString());
        } else if (keyClass.equals(IntWritable.class)) {
          vector = new NamedVector(vector, Integer.toString(((IntWritable) 
vw.getFirst()).get()));
        }
      }                    {code}
These comments are quite useful for other programmers and me to understand the 
code, but I notice that not all issue numbers are written in code comments. It 
can be already quite tedious to write them into commit messages :)

 

To handle the problem, I implemented a tool to automatically instrument issue 
numbers into code comments. I tried my tool on activemq, and the instrumented 
version is [https://github.com/ackelcn/mahoutwithissuecomment] 

 

To avoid confusion, if there is already an issue number in code comments, my 
tool ignored the issue number. All my generated comments start from //IC, so it 
is easy to find them.

 

Would you please some feedbacks to my tool? Please feel free to merge my 
generated comments in your code, if you feel that some are useful.


> Code comment with issue number
> ------------------------------
>
>                 Key: MAHOUT-2108
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-2108
>             Project: Mahout
>          Issue Type: Improvement
>            Reporter: ackelcn
>            Priority: Major
>
> When I read the code of mahout, I find some comments with issue numbers. One 
> of them comes from ClusterClassificationDriver.java:
> {code:java}
>  // belongs to which cluster - fix for MAHOUT-1410
>       Class<? extends Writable> keyClass = vw.getFirst().getClass();
>       Vector vector = vw.getSecond().get();
>       if (!keyClass.equals(NamedVector.class)) {
>         if (keyClass.equals(Text.class)) {
>           vector = new NamedVector(vector, vw.getFirst().toString());
>         } else if (keyClass.equals(IntWritable.class)) {
>           vector = new NamedVector(vector, Integer.toString(((IntWritable) 
> vw.getFirst()).get()));
>         }
>       }                    {code}
> These comments are quite useful for other programmers and me to understand 
> the code, but I notice that not all issue numbers are written in code 
> comments. It can be already quite tedious to write them into commit messages 
> :)
>  
> To handle the problem, I implemented a tool to automatically instrument issue 
> numbers into code comments. I tried my tool on activemq, and the instrumented 
> version is [https://github.com/ackelcn/mahout] 
>  
> To avoid confusion, if there is already an issue number in code comments, my 
> tool ignored the issue number. All my generated comments start from //IC, so 
> it is easy to find them.
>  
> Would you please some feedbacks to my tool? Please feel free to merge my 
> generated comments in your code, if you feel that some are useful.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to