Support for private constructors in autoclass
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 290
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
I have a class with its constructor marked private. Users are not supposed to construct this class directly, but call a separate static method to get a instance of the class. Here's a contrived example:
/** A person */
class Person {
/**
* Construct a person from the text of their full name
* @param {string} fullName The person's full name
*/
static fromFullName(fullName) {
const [firstName, lastName] = fullName.split(" ");
return new Person(firstName, lastName);
}
/**
* @private
* @param {string} firstName The person's first name
* @param {string} lastName The person's last name
*/
constructor(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
}
I would expect to only see the jsdoc for fromFullName when I don't show private members, like below. Instead I see both the private constructor and the static public constructor.
.. js:autoclass: Person
:members:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the js:autoclass directive and trace how the example's @private constructor is included when private members are hidden. Compare the generated output with the expected RST example; done means only fromFullName is documented while the private constructor is omitted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100