imsky / PocketEuler

:heavy_plus_sign: Offline version of Project Euler.
116 stars 11 forks source link

Automated testing #36

Open jayvdb opened 8 years ago

jayvdb commented 8 years ago

It would be useful to have some form of automated testing to

  1. verify the .md is correct syntax
  2. the structure of the .md is consistent, e.g. wrt whitespace between problems
jayvdb commented 8 years ago

The obvious choice is to use Travis CI. What language should the tools be?

imsky commented 8 years ago

how would either 1 or 2 be done? for languages, i think python or javascript should work

jayvdb commented 8 years ago

For 1, run a very strict md parser on the file.

For 2, we look for any structural aspects which are not covered by the strict md parser.

Python would be my preference, for language, but would be happy with other languages if it has a better linter.

Two Python options found rather quickly

  1. https://pypi.python.org/pypi/pymarkdownlint / https://github.com/jorisroovers/pymarkdownlint
  2. https://pypi.python.org/pypi/mdlint / https://github.com/avoceteditors/mdlint

Others that probably have linting features

  1. https://pypi.python.org/pypi/Markdown
  2. https://pypi.python.org/pypi/ghmarkdown

From other languages:

  1. Ruby: https://github.com/mivok/markdownlint
  2. JS: https://github.com/DavidAnson/markdownlint
  3. JS: https://github.com/wooorm/remark-lint
imsky commented 8 years ago

i think just doing 1 is going to work for now. python seems fine

jayvdb commented 8 years ago

Note that https://github.com/wooorm/remark-lint (JS) finds more problems than the others, which I havent had time to look though closely.

imsky commented 8 years ago

interesting, feel free to integrate. i can take a look later also

jayvdb commented 8 years ago

I've got remark lint working, with it picking up some very good problems missed by the other two. I also tried using it to auto-format the .md, but it has too many undesirable unnecessary changes to be worth using at this stage (but waiting on https://github.com/wooorm/remark/issues/187 as it may be there is a config flag I have missed ), and it also breaks the syntax in a few places. It also doesnt fix the syntax for the cases where the rendering is currently wrong, so most of the current patches are still needed as-is even if we used remark to automatically neaten the .md.