Here are some draft code for a TODO plugin. It comes from a simple
plugin I've started for my company but was not used (all developpers use
eclipse and it's "task" view). If someone want's to build a new plugin,
it may be a starting point.
It's a simple Ant task that search "TODO" string in files from a fileset
and append line end to a raw repport.
Some enhancement may be considered :
- assert the "TODO" is inside a comment (line has any "//" prior)
- allow a configurable list of word to be used instead of hard coded
"TODO" ("FIXME"...)
Nico.
Jeff Jensen a �crit :
++75. in the same situation. Best of luck on an implementation...you have
lots of excited beta-testers waiting to try it! :-D
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, May 27, 2005 5:00 AM
To: Maven Users List
Subject: R�f. : RE: Task list of "// TODO" comments
Personally, I have no problem with the @todo. The stuff is that by default,
the IDEs do not use that (at least IntelliJ and Eclipse). What's more, in my
company, hundreds of developers have been working on WSAD for years now,
which has the following consequences:
1/ I can't ask them all to change their preferences, as I'm pretty sure only
10% of them would do it 2/ The existing code is already full of //TODO or
//FIXME
That's why I'd love to have this plugin. I'm currently looking how to
implement it rapidly.
Best Regards / Cordialement,
Fabrice BELLINGARD
DINQ/DSIN/INSI/EATE/IDVS/AIDV
(+33) (01 61) 45 15 91 - [EMAIL PROTECTED]
Adam Hardy
<[EMAIL PROTECTED]
co.uk> Pour
Maven Users List
27/05/2005 11:39 <[email protected]>
cc
Veuillez Objet
r�pondre � RE: Task list of "// TODO" comments
Maven Users List
<[EMAIL PROTECTED]
che.org>
Before you guys all leapt on board with your wishlist items, I was going to
ask what was wrong with using the @todo and the maven-tasklist-plugin.
If you go into the Eclipse menu, you can set Eclipse to pick this up and use
it via Preferences / java / Compiler / tasklist
Adam
-----Original Message-----
From: Mark Hobson [mailto:[EMAIL PROTECTED]
Sent: 27 May 2005 10:24
To: Maven Users List
Subject: Re: Task list of "// TODO" comments
+1
Customisable tags in a similar vein to eclipse would be great
- e.g. TODO:, FIXME:, etc.
On 5/27/05, Arik Kfir <[EMAIL PROTECTED]> wrote:
+1
----- Original Message -----
From: "Wim Deblauwe" <[EMAIL PROTECTED]>
To: "Maven Users List" <[email protected]>
Sent: Friday, May 27, 2005 10:59 AM
Subject: Re: Task list of "// TODO" comments
I would be interested in this too. IntelliJ uses the same.
regards,
Wim
2005/5/27, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
Hi guys,
I wanted to know if someone has already written a task
list plugin
that work for "// TODO" comments, as Eclipse uses this
kind of task
tag in the Java code.
Tanks & Best regards,
Fabrice
--------------------------------------------------------------------
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance
on it and notify the sender immediately. Please note that the BBC monitors
e-mails sent or received.
Further communication will signify your consent to this.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This message contains information that may be privileged or confidential and is
the property of the Capgemini Group. It is intended only for the person to whom
it is addressed. If you are not the intended recipient, you are not authorized
to read, print, retain, copy, disseminate, distribute, or use this message or
any part thereof. If you receive this message in error, please notify the
sender immediately and delete all copies of this message.
/* $Id: Todo.java,v 1.1 2004/03/23 16:31:10 ndeloof Exp $ */
package org.apache.maven.todo;
/**
* @author ndeloof
*/
public class Todo
{
//~ Instance fields --------------------------------------------------------
private String comment;
private String file;
private int line;
//~ Constructors -----------------------------------------------------------
/**
* @param file
* @param line
*/
public Todo(String file, int line, String comment)
{
super();
this.file = file;
this.line = line;
this.comment = comment;
}
//~ Methods ----------------------------------------------------------------
/**
* Acc�s � la propri�t� <code>comment</code>
*
* @param comment Valeur de la propri�t� comment.
*/
public void setComment(String comment)
{
this.comment = comment;
}
/**
* Acc�s � la propri�t� <code>comment</code>
*
* @return Valeur de la propri�t� comment.
*/
public String getComment()
{
return this.comment;
}
/**
* Acc�s � la propri�t� <code>file</code>
*
* @param file Valeur de la propri�t� file.
*/
public void setFile(String file)
{
this.file = file;
}
/**
* Acc�s � la propri�t� <code>file</code>
*
* @return Valeur de la propri�t� file.
*/
public String getFile()
{
return this.file;
}
/**
* Acc�s � la propri�t� <code>line</code>
*
* @param line Valeur de la propri�t� line.
*/
public void setLine(int line)
{
this.line = line;
}
/**
* Acc�s � la propri�t� <code>line</code>
*
* @return Valeur de la propri�t� line.
*/
public int getLine()
{
return this.line;
}
}
/* $Id: TodoTask.java,v 1.1 2004/03/23 16:31:10 ndeloof Exp $ */
package org.apache.maven.todo;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
/**
* @author ndeloof
*/
public class TodoTask extends Task
{
//~ Instance fields --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
protected Vector filesets = new Vector();
private String output;
//~ Methods ----------------------------------------------------------------
// ----------------------------------------------------------------
// ----------------------------------------------------------------
// ----------------------------------------------------------------
/**
* Acc�s � la propri�t� <code>filesets</code>
*
* @param filesets Valeur de la propri�t� filesets.
*/
public void setFilesets(Vector filesets)
{
this.filesets = filesets;
}
/**
* Acc�s � la propri�t� <code>filesets</code>
*
* @return Valeur de la propri�t� filesets.
*/
public Vector getFilesets()
{
return this.filesets;
}
/**
* Acc�s � la propri�t� <code>output</code>
*
* @param output Valeur de la propri�t� output.
*/
public void setOutput(String output)
{
this.output = output;
}
/**
* Acc�s � la propri�t� <code>output</code>
*
* @return Valeur de la propri�t� output.
*/
public String getOutput()
{
return this.output;
}
// ----------------------------------------------------------------
/**
* Adds a set of files to copy.
*/
public void addFileset(FileSet set)
{
this.filesets.addElement(set);
}
/**
* @see org.apache.tools.ant.Task#execute()
*/
public void execute() throws BuildException
{
List todos = new ArrayList();
for (int i = 0; i < this.filesets.size(); i++)
{
FileSet fs = (FileSet) this.filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
ds.scan();
File base = ds.getBasedir();
String[] sources = ds.getIncludedFiles();
for (int j = 0; j < sources.length; j++)
{
String source = sources[j];
try
{
BufferedReader reader =
new BufferedReader(new FileReader(base + File.separator
+ source));
String line;
int lineNumber = 0;
while ((line = reader.readLine()) != null)
{
lineNumber++;
int index = line.indexOf("TODO");
if (index >= 0)
{
String comment = line.substring(index + 4);
System.out.println(comment);
todos.add(new Todo(source, lineNumber, comment));
}
}
reader.close();
}
catch (IOException e)
{
throw new BuildException("error", e);
}
}
}
try
{
FileWriter writer = new FileWriter(this.output, false);
writer.write("<?xml version=\"1.0\"
encoding=\"ISO-8859-1\"?>\n<todos>\n");
for (Iterator iter = todos.iterator(); iter.hasNext();)
{
Todo todo = (Todo) iter.next();
writer.write(" <todo file=\"" + todo.getFile()
+ "\" line=\"" + todo.getLine() + "\" comment=\""
+ todo.getComment() + "\"/>\n");
}
writer.write("</todos>");
writer.close();
}
catch (IOException e)
{
// Nop
}
}
}
<?xml version="1.0"?>
<jsl:stylesheet
select="$doc"
xmlns:j="jelly:core"
xmlns:jsl="jelly:jsl"
xmlns:util="jelly:util"
xmlns:x="jelly:xml"
xmlns:doc="doc"
xmlns="dummy" trim="false">
<j:useBean var="mavenTool" class="org.apache.maven.util.MavenTool"/>
<jsl:template match="todos">
<document>
<properties>
<title>Eclipse Todos</title>
</properties>
<body>
<section name="Eclipse Todos">
<p>
The following document contains the Todos comments
</p>
</section>
<section name="Files">
<table>
<tr>
<th width="75">File</th>
<th>line</th>
<th>commentaire</th>
</tr>
<x:set var="tasks" select="todo"/>
<j:forEach var="task" items="${tasks}">
<j:set var="file" value="${task.attribute('file').getValue()}"/>
<j:set var="line" value="${task.attribute('line').getValue()}"/>
<j:set var="comment" value="${task.attribute('comment').getValue()}"/>
<tr>
<td>
${file}
</td>
<td>
<j:set var="lastIndex" value="${file.lastIndexOf('.java')}"/>
<j:choose>
<j:when test="${lastIndex > 0}">
<j:set var="index" value="${mavenTool.toInteger(lastIndex.toString())}"/>
<j:set var="nameWithoutJavaExtension" value="${file.substring(0, index)}"/>
<util:replace var="nameWithoutJavaExtension" value="${nameWithoutJavaExtension}" oldChar="\\" newChar="/"/>
<a href="xref/${nameWithoutJavaExtension}.html#${line}">${line}</a>
</j:when>
<j:otherwise>
${line}
</j:otherwise>
</j:choose>
</td>
<td>
${comment}
</td>
</tr>
</j:forEach>
</table>
</section>
</body>
</document>
</jsl:template>
</jsl:stylesheet>
<?xml version="1.0" encoding="ISO-8859-1"?>
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:u="jelly:util"
xmlns:doc="doc">
<goal name="todo:report" prereqs="todo:init">
<ant:echo>Extraction des commentaires "TODO"</ant:echo>
<todo output="${maven.build.dir}/todo-raw-report.xml">
<fileset dir="${basedir}/src/java">
<include name="**/*.java"/>
</fileset>
</todo>
<doc:jsl input="${maven.build.dir}/todo-raw-report.xml"
output="todo-report.xml"
stylesheet="${plugin.resources}/todo.jsl"
encoding="${maven.docs.outputencoding}"
outputMode="xml"
prettyPrint="true"/>
</goal>
<goal name="todo:init">
<taskdef
name="todo"
classname="org.apache.maven.todo.TodoTask">
<classpath>
<ant:pathelement path="${plugin.resources}" />
<ant:pathelement path="${plugin.dir}" />
<pathelement path="${pom.getDependencyClasspath()}"/>
<path refid="maven.dependency.classpath"/>
</classpath>
</taskdef>
</goal>
<goal name="maven-todo-plugin:register">
<j:if test="${sourcesPresent == 'true'}">
<doc:registerReport
name="Todo"
pluginName="todo"
link="todo-report"
description="Report on Eclipse style TODOs."/>
</j:if>
</goal>
<goal name="maven-todo-plugin:deregister">
<j:if test="${sourcesPresent == 'true'}">
<doc:deregisterReport name="todo"/>
</j:if>
</goal>
</project><?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<pomVersion>3</pomVersion>
<id>maven-todo-plugin</id>
<name>Maven todo plugin</name>
<currentVersion>1.0.0</currentVersion>
<inceptionYear>2004</inceptionYear>
<shortDescription>Maven plugin for Eclipse style todos</shortDescription>
<developers>
<developer>
<name>Nicolas De Loof</name>
<id>ndeloof</id>
<email>[EMAIL PROTECTED]</email>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.5.3-1</version>
</dependency>
</dependencies>
<build>
<!-- Useful if your plugin uses some beans -->
<sourceDirectory>src/java/main</sourceDirectory>
<unitTestSourceDirectory>src/java/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
</unitTest>
<resources>
<resource>
<directory>${basedir}/src/plugin-resources</directory>
<targetPath>plugin-resources</targetPath>
</resource>
<resource>
<directory>${basedir}</directory>
<includes>
<include>plugin.jelly</include>
<include>plugin.properties</include>
<include>project.properties</include>
<include>project.xml</include>
</includes>
</resource>
</resources>
</build>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]