-
This tool attempts to generate a Smalltalk class comment as shown in this figure:

-
The comment contains information types based on the default Pharo template:

1. Requirements
2. Installation
3. Usage
4. Development
5. References
6. License
- Pharo > 8.0
Metacello new
baseline: 'CommentGenerator';
repository: 'github://PR-research-data-tools/Smalltalk-class-comment-generator:main/src';
load.|cg|
cg := CommentGenerator new.
cg targetClass: RSShape.
cg generateDocument.There are various classes used to achieve class comment generation.

CommentGenerator class is one of the important classes. The user can pass a class of interest in targetClass and pass generateDocument message to generate class comment for the class.
It has two more important classes CGIdentifier and CGFormatter where the former contains most of the logic and latter formats the writestream output.
These classes are used to extract important or relevant information about a method. The visitor is set up by passing a method name (aSymbol).
| method visitor |
method := targetClass >> aSymbol.
visitor := CGAccessorVisitor new.
method ast acceptVisitor: visitor.
visitor result|ci|
ci := CGIdentifier new.
ci targetClass: RSShape.
ci getClassStereotype.|ci|
ci := CGIdentifier new.
ci targetClass: RSShape.
ci getMethodStereotypes.- Pharo
- Paper: Can We Automatically Generate Class Comments in Pharo?
- Replication paper: Automatic generation of natural language summaries for java classes
- replication package of the paper
MIT License