Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec files #3

Open
jonschlinkert opened this issue Nov 26, 2018 · 4 comments
Open

spec files #3

jonschlinkert opened this issue Nov 26, 2018 · 4 comments

Comments

@jonschlinkert
Copy link
Member

jonschlinkert commented Nov 26, 2018

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)

@tunnckoCore
Copy link
Collaborator

tunnckoCore commented Nov 26, 2018

Yup sounds it worth it.

As about the documentation system, yea exactly... I was thinking about the same thing too (the eslint and prettier on the code comment examples). Why not work on Docks together? I don't see how it's "very different". As you can see it has a few built-in plugins, plus rendering one (which isn't great currently but works pretty well - see parse-commit-message for bigger api docs generated with it). When I switch to the latest parse-comments most of the plugins will disappear. All plugins are running for each code comment.

I'll add examples linting in Docks anyway... Currently, it works very well and better than Verb for what I need, that's why I'm using it instead of Verb

@jonschlinkert
Copy link
Member Author

jonschlinkert commented Nov 26, 2018 via email

@jonschlinkert
Copy link
Member Author

jonschlinkert commented Nov 26, 2018 via email

@tunnckoCore
Copy link
Collaborator

Oh, don't take it wrong. I would, but it was just a lot more faster to write 100 lines of code to make such a thing, instead of losing myself in contributing to a few dependencies of Verb or other helpers. I was thinking about the name "Docks" for years anyway (published it back in ~2016) and even in 2018 I still don't like to have deps. Lately trying to drop as many devDeps as possible to narrow it down to only test runner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants