From e720b7d5c93a346bf528c40fab51615a9487f0a2 Mon Sep 17 00:00:00 2001 From: marsonya Date: Mon, 2 Nov 2020 19:56:03 +0530 Subject: [PATCH 1/4] Doctest Contribution Guidelines | Added Description --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8efea899d2..1c6ae99a3e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,6 +81,10 @@ To maximize the readability and correctness of our code, we require that new sub - We strongly recommend the use of ECMAScript 6 - Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms. +#### Testing + +Be confident that your code works. When was the last time you committed a code change, your build failed, and half of your app stopped working? Mine was last week. Writing tests for our Algorithms will help us ensure the implementations are air tight even after multiple fixes and code changes. +We use a NPM package [doctest](https://www.npmjs.com/package/doctest) to add basic testing functionality to our code. Doctests are simple structured comments that evaluate an function and ensure a required result. - Most importantly, From f9b95f4d87466b5a99856b06ffd830232e937f7b Mon Sep 17 00:00:00 2001 From: marsonya Date: Mon, 2 Nov 2020 19:56:28 +0530 Subject: [PATCH 2/4] Doctest Contribution Guidelines | Implementation details and reference --- CONTRIBUTING.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1c6ae99a3e..87bbc792f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,6 +86,18 @@ To maximize the readability and correctness of our code, we require that new sub Be confident that your code works. When was the last time you committed a code change, your build failed, and half of your app stopped working? Mine was last week. Writing tests for our Algorithms will help us ensure the implementations are air tight even after multiple fixes and code changes. We use a NPM package [doctest](https://www.npmjs.com/package/doctest) to add basic testing functionality to our code. Doctests are simple structured comments that evaluate an function and ensure a required result. +The implementation of doctest is quite simple. You can easily learn it [here](https://www.npmjs.com/package/doctest). + +It is advised that you add the Doctests in a multiline comment just after the Algorithm description. +/** +* Algorithm Description Here +* The Wikipedia Link +*/ +/** +* Doctests Here +*/ +For Code Structure reference see [this file](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/BubbleSort.js). + - Most importantly, - **Be consistent in the use of these guidelines when submitting.** From c8c715feb48126359dc0fb4a067ab2f8803287af Mon Sep 17 00:00:00 2001 From: marsonya Date: Mon, 2 Nov 2020 19:56:52 +0530 Subject: [PATCH 3/4] Doctest Contribution Guidelines | Guidelines for running doctests --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 87bbc792f8..2bd176ee8d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,6 +98,11 @@ It is advised that you add the Doctests in a multiline comment just after the Al */ For Code Structure reference see [this file](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/BubbleSort.js). +You can run the doctest by using the command +``` +$ doctest MyFile.js // if that fails, try: npx doctest MyFile.js +``` + - Most importantly, - **Be consistent in the use of these guidelines when submitting.** From d31b036f7339ac2bba8c6c33581c344c34937ab2 Mon Sep 17 00:00:00 2001 From: marsonya Date: Mon, 2 Nov 2020 19:59:16 +0530 Subject: [PATCH 4/4] Doctests Contribution Guidelines | Changed Section Position and Cleanup --- CONTRIBUTING.md | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2bd176ee8d..6711d5dbe9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,6 +49,21 @@ Algorithms in this repo should not be how-to examples for existing JavaScript pa - There should be no spaces in filenames. **Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are not +#### Testing + +Be confident that your code works. When was the last time you committed a code change, your build failed, and half of your app stopped working? Mine was last week. Writing tests for our Algorithms will help us ensure the implementations are air tight even after multiple fixes and code changes. +We use a NPM package [doctest](https://www.npmjs.com/package/doctest) to add basic testing functionality to our code. Doctests are simple structured comments that evaluate an function and ensure a required result. + +The implementation of doctest is quite simple. You can easily learn it [here](https://www.npmjs.com/package/doctest). + +It is advised that you add the Doctests in a multiline comment just after the Algorithm description. +For Code Structure reference see [this file](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/BubbleSort.js). + +You can run the doctest by using the command +``` +$ doctest MyFile.js // if that fails, try: npx doctest MyFile.js +``` + #### Coding Style To maximize the readability and correctness of our code, we require that new submissions follow [JavaScript Standard Style](https://standardjs.com/) @@ -80,30 +95,6 @@ To maximize the readability and correctness of our code, we require that new sub - Please use 'console.log()' - We strongly recommend the use of ECMAScript 6 - Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms. - -#### Testing - -Be confident that your code works. When was the last time you committed a code change, your build failed, and half of your app stopped working? Mine was last week. Writing tests for our Algorithms will help us ensure the implementations are air tight even after multiple fixes and code changes. -We use a NPM package [doctest](https://www.npmjs.com/package/doctest) to add basic testing functionality to our code. Doctests are simple structured comments that evaluate an function and ensure a required result. - -The implementation of doctest is quite simple. You can easily learn it [here](https://www.npmjs.com/package/doctest). - -It is advised that you add the Doctests in a multiline comment just after the Algorithm description. -/** -* Algorithm Description Here -* The Wikipedia Link -*/ -/** -* Doctests Here -*/ -For Code Structure reference see [this file](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/BubbleSort.js). - -You can run the doctest by using the command -``` -$ doctest MyFile.js // if that fails, try: npx doctest MyFile.js -``` - - - Most importantly, - **Be consistent in the use of these guidelines when submitting.** - Happy coding!