Description
What if we created YAML "spec" files for all of the filters (one file for each category of filters) like array-spec.yaml
, with something like the following:
category: array
methods:
- name: pad_end
description: "Pads the given string with another string until the resulting string reaches the specified maximum length. The padding is applied from the end (right) of the current string."
examples:
- title: Example
signature: "string.pad_end(str, maxLength[, padString])"
args: ['Foo', 10, '0']
expected: 'Foo0000000'
tests:
- it: "Should append '0' to the string"
args: ['Foo', 10, '0']
expected: 'Foo0000000'
Then we just run a command in the terminal to generate the tests and docs and see which methods still need to be covered.
This might seem like over-engineering, but I'd be able to use parts of this on many projects, so I'm thinking it would be worth it.
On this topic, I've been working on a new documentation system (that I'll be pushing up soon) that can do the following (and more):
- lint code comments for typos/English grammatical errors
- lint examples in code comments for code errors
- lint code examples for formatting, missing params, descriptions, examples, etc.
- generate markdown documentation from code comments
- fill in missing information with data from the repository (package.json,
.git/config
, etc.) - lint markdown docs for "documentation coverage"
- cross-reference code comments with unit tests, spec files, and documentation examples, and returns a report with undocumented methods, code coverage, etc.
- use plugins to add other features
Thoughts? @doowb @tunnckoCore?
(P.S. @tunnckoCore I saw Docks, it looks nice. However, I've been working on (and thinking about) this "new" documentation system for a couple of years, and it's very different than Docks. I'd be happy to add you as a collaborator when I push it up)