├── .node-version ├── static ├── favicon.ico ├── favicon-16x16.png ├── favicon-32x32.png ├── apple-touch-icon.png ├── mstile-150x150.png ├── android-chrome-192x192.png ├── android-chrome-512x512.png ├── browserconfig.xml └── site.webmanifest ├── content ├── glossary.mdx ├── languages │ ├── sql │ │ ├── rspec.md │ │ └── index.md │ ├── cfml │ │ ├── testbox.md │ │ └── index.md │ ├── python │ │ ├── img │ │ │ ├── python-test-framework-example-dark.png │ │ │ └── python-test-framework-example-light.png │ │ └── index.md │ ├── vb │ │ ├── nunit.md │ │ └── index.md │ ├── elm │ │ ├── test.md │ │ └── index.md │ ├── haxe │ │ ├── utest.md │ │ └── index.md │ ├── ocaml │ │ ├── ounit.md │ │ └── index.md │ ├── raku │ │ ├── test.md │ │ └── index.md │ ├── reason │ │ ├── jest.md │ │ └── index.md │ ├── crystal │ │ ├── spec.md │ │ └── index.md │ ├── nim │ │ ├── unittest.md │ │ └── index.md │ ├── prolog │ │ ├── plunit.md │ │ └── index.md │ ├── swift │ │ ├── xctest.md │ │ └── index.md │ ├── commonlisp │ │ ├── rove.md │ │ └── index.md │ ├── coq │ │ ├── coq-codewars.md │ │ └── index.md │ ├── idris │ │ ├── specdris.md │ │ └── index.md │ ├── julia │ │ ├── factcheck.md │ │ └── index.md │ ├── nasm │ │ ├── criterion.md │ │ └── index.md │ ├── purescript │ │ ├── spec.md │ │ └── index.md │ ├── racket │ │ ├── rackunit.md │ │ └── index.md │ ├── solidity │ │ ├── truffle.md │ │ └── index.md │ ├── forth │ │ ├── ttester.md │ │ └── index.md │ ├── fortran │ │ ├── codewars-test.md │ │ └── index.md │ ├── bf │ │ ├── codewars-test.md │ │ └── index.md │ ├── clojure │ │ ├── index.md │ │ └── clojure-test.md │ ├── lua │ │ ├── index.md │ │ └── busted.md │ ├── shell │ │ ├── index.md │ │ └── rspec.md │ ├── coffeescript │ │ └── index.md │ ├── erlang │ │ ├── index.md │ │ └── eunit.md │ ├── groovy │ │ ├── index.md │ │ ├── spock.md │ │ └── junit.md │ ├── ruby │ │ ├── rspec.md │ │ ├── codewars-test.md │ │ └── index.md │ ├── objc │ │ └── index.md │ ├── dart │ │ ├── index.md │ │ └── test.md │ ├── csharp │ │ ├── index.md │ │ └── nunit.md │ ├── elixir │ │ ├── index.md │ │ └── exunit.md │ ├── go │ │ ├── index.md │ │ └── ginkgo.md │ ├── factor │ │ ├── index.md │ │ └── testest.md │ ├── kotlin │ │ ├── index.md │ │ ├── kotlintest.md │ │ └── junit.md │ ├── powershell │ │ ├── index.md │ │ └── pester.md │ ├── lambdacalc │ │ └── index.md │ ├── perl │ │ ├── index.md │ │ └── test.md │ ├── fsharp │ │ ├── index.md │ │ ├── fuchu.md │ │ └── nunit.md │ ├── cobol │ │ └── index.md │ ├── agda │ │ └── index.md │ ├── php │ │ ├── index.md │ │ └── phpunit.md │ ├── typescript │ │ ├── mocha.md │ │ └── index.md │ ├── javascript │ │ ├── mocha.md │ │ └── codewars-test.md │ ├── riscv │ │ ├── cgreen.md │ │ └── index.md │ ├── r │ │ ├── testthat.md │ │ └── index.md │ ├── cpp │ │ ├── index.md │ │ └── igloo │ │ │ └── index.md │ ├── d │ │ └── index.md │ ├── java │ │ ├── index.md │ │ └── junit.md │ ├── scala │ │ ├── index.md │ │ └── scalatest.md │ ├── c │ │ ├── index.md │ │ └── criterion.md │ ├── haskell │ │ ├── hspec.md │ │ └── index.md │ ├── pascal │ │ └── index.md │ └── rust │ │ └── index.md ├── community │ ├── img │ │ ├── follow_dark.png │ │ ├── follow_light.png │ │ ├── join-clan_dark.png │ │ ├── join-clan_light.png │ │ ├── solutions_dark.png │ │ ├── solutions_light.png │ │ ├── allies-board_dark.png │ │ ├── allies-board_light.png │ │ ├── followers-board_dark.png │ │ └── followers-board_light.png │ ├── moderation │ │ ├── tools.md │ │ └── keeping-codewars-safe.mdx │ ├── index.md │ └── following.mdx ├── gamification │ ├── img │ │ ├── top-bar_dark.png │ │ ├── top-bar_light.png │ │ ├── honor-breakdown_dark.png │ │ ├── rank-breakdown_dark.png │ │ ├── rank-breakdown_light.png │ │ └── honor-breakdown_light.png │ ├── index.mdx │ └── privileges.md ├── references │ ├── img │ │ ├── kata-trainer-dark.png │ │ └── kata-trainer-light.png │ ├── markdown │ │ └── img │ │ │ ├── math-typeset-example-dark.png │ │ │ └── math-typeset-example-light.png │ └── kata-editor.md ├── training │ ├── img │ │ ├── training-example │ │ │ ├── img1.png │ │ │ ├── img2.png │ │ │ ├── img3.png │ │ │ ├── img4.png │ │ │ ├── img5.png │ │ │ ├── img6.png │ │ │ ├── img7.png │ │ │ └── img8.png │ │ ├── buffer-limit-error-dark.png │ │ ├── buffer-limit-error-light.png │ │ ├── troubleshooting-print-console-dark.png │ │ └── troubleshooting-print-console-light.png │ └── README.md ├── authoring │ ├── tutorials │ │ └── img │ │ │ ├── new_kata-dark.png │ │ │ └── new_kata-light.png │ ├── kata.md │ ├── guidelines │ │ ├── reference-solution.md │ │ ├── index.md │ │ ├── preloaded.md │ │ └── coding.md │ ├── recipes │ │ └── read-solution-file.md │ ├── index.md │ └── translation.md ├── concepts │ ├── kata │ │ ├── img │ │ │ ├── add-translation_dark.png │ │ │ └── add-translation_light.png │ │ ├── beta-process.md │ │ ├── collections.md │ │ ├── satisfaction-rating.md │ │ ├── solutions.md │ │ ├── discourse.md │ │ └── tests.md │ ├── kumite.md │ └── kata.md ├── getting-started │ ├── img │ │ ├── solving_02_vote_dark.png │ │ ├── registering_05_enlist.png │ │ ├── solving_02_vote_light.png │ │ ├── solving_03_trainer_dark.png │ │ ├── solving_03_trainer_light.png │ │ ├── finding-kata_02_sidebar_dark.png │ │ ├── finding-kata_02_sidebar_light.png │ │ ├── registering_01_choose_language.png │ │ ├── solving_01_rank-progress_dark.png │ │ ├── solving_01_rank-progress_light.png │ │ ├── registering_02_multiply_initial.png │ │ ├── registering_04_multiply_success.png │ │ ├── setting-up_01_account-menu_dark.png │ │ ├── setting-up_01_account-menu_light.png │ │ ├── setting-up_02_training-menu_dark.png │ │ ├── setting-up_02_training-menu_light.png │ │ ├── registering_03_multiply_wrong_answer.png │ │ ├── finding-kata_01_training-routines_dark.png │ │ └── finding-kata_01_training-routines_light.png │ ├── solutions.md │ ├── registering.md │ └── kata-solved.mdx ├── index.mdx ├── curation │ ├── index.md │ ├── guidelines │ │ └── translation.md │ └── references │ │ └── approval-retirement-criteria.md └── meta │ └── docs.mdx ├── README.md ├── __tmp__ ├── popups │ ├── sidebar.png │ ├── training-routines.png │ ├── tips-kata-discourse.md │ ├── tips-solution-voting.md │ ├── tips-beta-kata.md │ ├── on-first-kata-completed.md │ ├── tips-kata-trainer.md │ ├── tips-advanced-code-fencing.md │ ├── tips-kata-translations.md │ └── kumite.md ├── wiki │ ├── kata-translations │ │ └── language-menu.png │ ├── README.md │ ├── tutorial-approving-translations.md │ ├── snippets-random-testing-in-javascript.md │ └── tutorial-how-to-translate-a-kata.md └── README.md ├── babel.config.js ├── .prettierignore ├── src ├── theme │ ├── MDXComponents │ │ ├── Code.js │ │ ├── Code.d.ts │ │ ├── Pre.d.ts │ │ └── Pre.js │ └── CodeBlock │ │ ├── index.d.ts │ │ └── index.js ├── components │ ├── Anchored.jsx │ └── AlignedIcon.jsx └── remark │ └── shiki │ └── languages │ └── README.md ├── .gitignore ├── netlify.toml ├── catalog-info.yaml ├── .github └── workflows │ ├── docsearch.yml │ └── reviewdog.yml ├── sitePlugin.js ├── LICENSE ├── docsearch.json ├── package.json ├── tailwind.config.js └── docusaurus.config.js /.node-version: -------------------------------------------------------------------------------- 1 | v16.15.1 2 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/static/favicon.ico -------------------------------------------------------------------------------- /content/glossary.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Glossary 3 | slug: /glossary 4 | --- 5 | 6 | TODO 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Codewars Docs 2 | 3 | > New documentation for Codewars. Still work in progress. 4 | -------------------------------------------------------------------------------- /static/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/static/favicon-16x16.png -------------------------------------------------------------------------------- /static/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/static/favicon-32x32.png -------------------------------------------------------------------------------- /__tmp__/popups/sidebar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/__tmp__/popups/sidebar.png -------------------------------------------------------------------------------- /content/languages/sql/rspec.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: RSpec 3 | tags: [sql, reference, testing] 4 | --- 5 | -------------------------------------------------------------------------------- /static/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/static/apple-touch-icon.png -------------------------------------------------------------------------------- /static/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/static/mstile-150x150.png -------------------------------------------------------------------------------- /content/languages/cfml/testbox.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: TestBox 3 | tags: [cfml, reference, testing] 4 | --- 5 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve("@docusaurus/core/lib/babel/preset")], 3 | }; 4 | -------------------------------------------------------------------------------- /static/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/static/android-chrome-192x192.png -------------------------------------------------------------------------------- /static/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/static/android-chrome-512x512.png -------------------------------------------------------------------------------- /__tmp__/popups/training-routines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/__tmp__/popups/training-routines.png -------------------------------------------------------------------------------- /content/community/img/follow_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/follow_dark.png -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .cache 2 | .docusaurus/ 3 | .cache-loader 4 | /__tmp__/ 5 | /dist/ 6 | src/.temp 7 | node_modules 8 | *.md 9 | -------------------------------------------------------------------------------- /content/community/img/follow_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/follow_light.png -------------------------------------------------------------------------------- /content/community/img/join-clan_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/join-clan_dark.png -------------------------------------------------------------------------------- /content/community/img/join-clan_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/join-clan_light.png -------------------------------------------------------------------------------- /content/community/img/solutions_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/solutions_dark.png -------------------------------------------------------------------------------- /content/community/img/solutions_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/solutions_light.png -------------------------------------------------------------------------------- /content/gamification/img/top-bar_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/gamification/img/top-bar_dark.png -------------------------------------------------------------------------------- /content/gamification/img/top-bar_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/gamification/img/top-bar_light.png -------------------------------------------------------------------------------- /content/community/img/allies-board_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/allies-board_dark.png -------------------------------------------------------------------------------- /content/community/img/allies-board_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/allies-board_light.png -------------------------------------------------------------------------------- /content/references/img/kata-trainer-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/references/img/kata-trainer-dark.png -------------------------------------------------------------------------------- /content/community/img/followers-board_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/followers-board_dark.png -------------------------------------------------------------------------------- /content/community/img/followers-board_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/community/img/followers-board_light.png -------------------------------------------------------------------------------- /content/references/img/kata-trainer-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/references/img/kata-trainer-light.png -------------------------------------------------------------------------------- /content/training/img/training-example/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/training-example/img1.png -------------------------------------------------------------------------------- /content/training/img/training-example/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/training-example/img2.png -------------------------------------------------------------------------------- /content/training/img/training-example/img3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/training-example/img3.png -------------------------------------------------------------------------------- /content/training/img/training-example/img4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/training-example/img4.png -------------------------------------------------------------------------------- /content/training/img/training-example/img5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/training-example/img5.png -------------------------------------------------------------------------------- /content/training/img/training-example/img6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/training-example/img6.png -------------------------------------------------------------------------------- /content/training/img/training-example/img7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/training-example/img7.png -------------------------------------------------------------------------------- /content/training/img/training-example/img8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/training-example/img8.png -------------------------------------------------------------------------------- /__tmp__/wiki/kata-translations/language-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/__tmp__/wiki/kata-translations/language-menu.png -------------------------------------------------------------------------------- /content/authoring/tutorials/img/new_kata-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/authoring/tutorials/img/new_kata-dark.png -------------------------------------------------------------------------------- /content/gamification/img/honor-breakdown_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/gamification/img/honor-breakdown_dark.png -------------------------------------------------------------------------------- /content/gamification/img/rank-breakdown_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/gamification/img/rank-breakdown_dark.png -------------------------------------------------------------------------------- /content/gamification/img/rank-breakdown_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/gamification/img/rank-breakdown_light.png -------------------------------------------------------------------------------- /content/training/img/buffer-limit-error-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/buffer-limit-error-dark.png -------------------------------------------------------------------------------- /content/training/img/buffer-limit-error-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/buffer-limit-error-light.png -------------------------------------------------------------------------------- /src/theme/MDXComponents/Code.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | export default function MDXCode(props) { 3 | return ; 4 | } 5 | -------------------------------------------------------------------------------- /content/authoring/tutorials/img/new_kata-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/authoring/tutorials/img/new_kata-light.png -------------------------------------------------------------------------------- /content/concepts/kata/img/add-translation_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/concepts/kata/img/add-translation_dark.png -------------------------------------------------------------------------------- /content/concepts/kata/img/add-translation_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/concepts/kata/img/add-translation_light.png -------------------------------------------------------------------------------- /content/gamification/img/honor-breakdown_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/gamification/img/honor-breakdown_light.png -------------------------------------------------------------------------------- /content/getting-started/img/solving_02_vote_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/solving_02_vote_dark.png -------------------------------------------------------------------------------- /content/getting-started/img/registering_05_enlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/registering_05_enlist.png -------------------------------------------------------------------------------- /content/getting-started/img/solving_02_vote_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/solving_02_vote_light.png -------------------------------------------------------------------------------- /content/getting-started/img/solving_03_trainer_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/solving_03_trainer_dark.png -------------------------------------------------------------------------------- /content/getting-started/img/solving_03_trainer_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/solving_03_trainer_light.png -------------------------------------------------------------------------------- /content/training/img/troubleshooting-print-console-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/troubleshooting-print-console-dark.png -------------------------------------------------------------------------------- /content/getting-started/img/finding-kata_02_sidebar_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/finding-kata_02_sidebar_dark.png -------------------------------------------------------------------------------- /content/getting-started/img/finding-kata_02_sidebar_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/finding-kata_02_sidebar_light.png -------------------------------------------------------------------------------- /content/getting-started/img/registering_01_choose_language.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/registering_01_choose_language.png -------------------------------------------------------------------------------- /content/getting-started/img/solving_01_rank-progress_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/solving_01_rank-progress_dark.png -------------------------------------------------------------------------------- /content/getting-started/img/solving_01_rank-progress_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/solving_01_rank-progress_light.png -------------------------------------------------------------------------------- /content/references/markdown/img/math-typeset-example-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/references/markdown/img/math-typeset-example-dark.png -------------------------------------------------------------------------------- /content/references/markdown/img/math-typeset-example-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/references/markdown/img/math-typeset-example-light.png -------------------------------------------------------------------------------- /content/training/img/troubleshooting-print-console-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/training/img/troubleshooting-print-console-light.png -------------------------------------------------------------------------------- /__tmp__/README.md: -------------------------------------------------------------------------------- 1 | This is a temporary directory. 2 | 3 | - `popups/` contains text of the popup notifications shown on Codewars 4 | - `wiki/` contains pages to migrate over 5 | -------------------------------------------------------------------------------- /content/getting-started/img/registering_02_multiply_initial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/registering_02_multiply_initial.png -------------------------------------------------------------------------------- /content/getting-started/img/registering_04_multiply_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/registering_04_multiply_success.png -------------------------------------------------------------------------------- /content/getting-started/img/setting-up_01_account-menu_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/setting-up_01_account-menu_dark.png -------------------------------------------------------------------------------- /content/getting-started/img/setting-up_01_account-menu_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/setting-up_01_account-menu_light.png -------------------------------------------------------------------------------- /content/getting-started/img/setting-up_02_training-menu_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/setting-up_02_training-menu_dark.png -------------------------------------------------------------------------------- /content/getting-started/img/setting-up_02_training-menu_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/setting-up_02_training-menu_light.png -------------------------------------------------------------------------------- /content/languages/python/img/python-test-framework-example-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/languages/python/img/python-test-framework-example-dark.png -------------------------------------------------------------------------------- /content/getting-started/img/registering_03_multiply_wrong_answer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/registering_03_multiply_wrong_answer.png -------------------------------------------------------------------------------- /content/languages/python/img/python-test-framework-example-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/languages/python/img/python-test-framework-example-light.png -------------------------------------------------------------------------------- /content/getting-started/img/finding-kata_01_training-routines_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/finding-kata_01_training-routines_dark.png -------------------------------------------------------------------------------- /content/getting-started/img/finding-kata_01_training-routines_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codewars/docs/HEAD/content/getting-started/img/finding-kata_01_training-routines_light.png -------------------------------------------------------------------------------- /src/theme/MDXComponents/Code.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { Props } from '@theme/MDXComponents/Code'; 3 | export default function MDXCode(props: Props): JSX.Element; 4 | -------------------------------------------------------------------------------- /src/theme/MDXComponents/Pre.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { Props } from '@theme/MDXComponents/Pre'; 3 | export default function MDXPre(props: Props): JSX.Element; 4 | -------------------------------------------------------------------------------- /src/theme/MDXComponents/Pre.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import CodeBlock from "@theme/CodeBlock"; 3 | export default function MDXPre(props) { 4 | return ; 5 | } 6 | -------------------------------------------------------------------------------- /src/theme/CodeBlock/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { Props } from '@theme/CodeBlock'; 3 | export default function CodeBlock({ children: rawChildren, ...props }: Props): JSX.Element; 4 | -------------------------------------------------------------------------------- /__tmp__/wiki/README.md: -------------------------------------------------------------------------------- 1 | Files under `wiki/` were imported from our [wiki pages](https://github.com/codewars/codewars.com/wiki). 2 | 3 | These need to be optimized for the new documentation site, reorganized and rewritten if necessary, then moved into `content/`. 4 | -------------------------------------------------------------------------------- /content/languages/vb/nunit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - vb 4 | - reference 5 | - testing 6 | --- 7 | 8 | # NUnit 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/elm/test.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - elm 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Elm Test 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/haxe/utest.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - haxe 4 | - reference 5 | - testing 6 | --- 7 | 8 | # utest 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/ocaml/ounit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - ocaml 4 | - reference 5 | - testing 6 | --- 7 | 8 | # OUnit 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/raku/test.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - raku 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Test 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/reason/jest.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - reason 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Jest 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/crystal/spec.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - crystal 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Spec 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/nim/unittest.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - nim 4 | - reference 5 | - testing 6 | --- 7 | 8 | # unittest 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/prolog/plunit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - prolog 4 | - reference 5 | - testing 6 | --- 7 | 8 | # PLUnit 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/swift/xctest.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - swift 4 | - reference 5 | - testing 6 | --- 7 | 8 | # XCTest 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/commonlisp/rove.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - commonlisp 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Rove 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/coq/coq-codewars.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - coq 4 | - reference 5 | - testing 6 | --- 7 | 8 | # coq_codewars 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/idris/specdris.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - idris 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Specdris 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/julia/factcheck.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - julia 4 | - reference 5 | - testing 6 | --- 7 | 8 | # FactCheck 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/nasm/criterion.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - nasm 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Criterion 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/purescript/spec.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - purescript 4 | - reference 5 | - testing 6 | --- 7 | 8 | # spec 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/racket/rackunit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - racket 4 | - reference 5 | - testing 6 | --- 7 | 8 | # RackUnit 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/solidity/truffle.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - solidity 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Truffle 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/forth/ttester.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - forth 4 | - reference 5 | - testing 6 | --- 7 | 8 | # ttester with Codewars extension 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/fortran/codewars-test.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - fortran 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Codewars Test Framework 9 | 10 | 15 | -------------------------------------------------------------------------------- /content/languages/bf/codewars-test.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Codewars Test Framework 3 | tags: [bf, reference, testing] 4 | --- 5 | 6 | 7 | > **DEPRECATED** Use Mocha 8 | 9 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .cache 3 | .DS_Store 4 | src/.temp 5 | node_modules 6 | dist 7 | !.env.example 8 | .env 9 | .env.* 10 | /schema.graphql 11 | .eslintcache 12 | .stylelintcache 13 | package-lock.json 14 | 15 | # Production 16 | /build 17 | 18 | # Generated files 19 | .docusaurus 20 | .cache-loader 21 | -------------------------------------------------------------------------------- /static/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #da532c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /content/training/README.md: -------------------------------------------------------------------------------- 1 | > TODO This section should contain anything about training on Codewars. 2 | > 3 | > - debugging tips 4 | > - how to use sample tests 5 | > - how to use discussion page 6 | > - guidelines to communicate effectively 7 | > - https://github.com/codewars/docs/issues/142 8 | > - how to vote solutions 9 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | command = "yarn build" 3 | publish = "build/" 4 | 5 | [[plugins]] 6 | package = "netlify-plugin-cache" 7 | [plugins.inputs] 8 | paths = [ 9 | "node_modules/.cache", 10 | ] 11 | 12 | [[redirects]] 13 | from = "/community/rules" 14 | to = "/community/code-of-conduct" 15 | -------------------------------------------------------------------------------- /src/components/Anchored.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const Anchored = ({ id, children }) => { 4 | return ( 5 |
6 | 7 | {children} 8 |
9 | ); 10 | }; 11 | export default Anchored; 12 | -------------------------------------------------------------------------------- /src/remark/shiki/languages/README.md: -------------------------------------------------------------------------------- 1 | Additional languages for shiki. 2 | 3 | - Factor https://github.com/DexterHaslem/vscode-factor 4 | - Fortran https://github.com/krvajal/vscode-fortran-support 5 | - Haxe https://github.com/vshaxe/haxe-TmLanguage 6 | - Idris https://github.com/zjhmale/vscode-idris 7 | - Racket https://github.com/pouyakary/vscode-racket 8 | -------------------------------------------------------------------------------- /content/languages/clojure/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Clojure 3 | description: Clojure on Codewars 4 | slug: /languages/clojure 5 | tags: [clojure] 6 | --- 7 | 8 | 9 | ## Versions 10 | 1.8.0 11 | ## Test Frameworks 12 | clojure.test 13 | ## Timeout 14 | 12 seconds 15 | ## Packages 16 | None 17 | ## Services 18 | None 19 | ## Language ID 20 | `clojure` 21 | -------------------------------------------------------------------------------- /content/languages/lua/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Lua 3 | description: Lua on Codewars 4 | slug: /languages/lua 5 | tags: [lua] 6 | --- 7 | 8 | 9 | ## Versions 10 | 5.3 11 | ## Test Frameworks 12 | [busted](https://lunarmodules.github.io/busted/) 13 | ## Timeout 14 | 12 seconds 15 | ## Packages 16 | None 17 | ## Services 18 | None 19 | ## Language ID 20 | `lua` 21 | -------------------------------------------------------------------------------- /content/languages/shell/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Shell 3 | description: Shell on Codewars 4 | slug: /languages/shell 5 | tags: [shell] 6 | --- 7 | 8 | 9 | ## Versions 10 | - bash 11 | - csh 12 | - tcsh 13 | - dash 14 | ## Test Frameworks 15 | RSpec 16 | ## Timeout 17 | 12 seconds 18 | ## Packages 19 | None 20 | ## Services 21 | None 22 | ## Language ID 23 | `shell` 24 | -------------------------------------------------------------------------------- /content/languages/swift/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Swift 3 | description: Swift on Codewars 4 | slug: /languages/swift 5 | tags: [swift] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 5.9 12 | 13 | ## Test Frameworks 14 | XCTest 15 | 16 | ## Timeout 17 | 12 seconds 18 | 19 | ## Packages 20 | None 21 | 22 | ## Services 23 | None 24 | 25 | ## Language ID 26 | `swift` 27 | -------------------------------------------------------------------------------- /content/languages/coffeescript/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CoffeeScript 3 | description: CoffeeScript on Codewars 4 | slug: /languages/coffeescript 5 | tags: [coffeescript] 6 | --- 7 | 8 | 9 | ## Versions 10 | 1.12.4 11 | ## Test Frameworks 12 | Codewars 13 | ## Timeout 14 | 12 seconds 15 | ## Packages 16 | None 17 | ## Services 18 | None 19 | ## Language ID 20 | `coffeescript` 21 | -------------------------------------------------------------------------------- /content/languages/erlang/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Erlang 3 | description: Erlang on Codewars 4 | slug: /languages/erlang 5 | tags: [erlang] 6 | --- 7 | 8 | 9 | ## Versions 10 | 26.0 11 | ## Test Frameworks 12 | [EUnit](http://erlang.org/doc/apps/eunit/chapter.html) 13 | ## Timeout 14 | 12 seconds 15 | ## Packages 16 | None 17 | ## Services 18 | None 19 | ## Language ID 20 | `erlang` 21 | -------------------------------------------------------------------------------- /src/components/AlignedIcon.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | // Wraps Tabler icon and aligns to the surrounding text better. 4 | // Created to display the crown and shield icons in the moderation page. 5 | const Aligned = ({ icon: Icon }) => ( 6 |
7 | 8 |
9 | ); 10 | 11 | export default Aligned; 12 | -------------------------------------------------------------------------------- /content/languages/groovy/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Groovy 3 | description: Groovy on Codewars 4 | slug: /languages/groovy 5 | tags: [groovy] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 2.5 12 | 13 | ## Test Frameworks 14 | - JUnit 15 | - Spock 16 | 17 | ## Timeout 18 | 16 seconds 19 | 20 | ## Packages 21 | None 22 | 23 | ## Services 24 | None 25 | 26 | ## Language ID 27 | 28 | `groovy` 29 | -------------------------------------------------------------------------------- /content/languages/ruby/rspec.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: RSpec 3 | tags: [ruby, reference, testing] 4 | --- 5 | 6 | # RSpec 7 | 8 | ## Basic Setup 9 | 10 | ### Solution 11 | 12 | ```ruby 13 | def add(a, b) 14 | a + b 15 | end 16 | ``` 17 | 18 | ### Tests 19 | 20 | ```ruby 21 | describe 'add' do 22 | it 'returns the sum of its arguments' do 23 | expect(add(1, 2)).to eq(3) 24 | end 25 | end 26 | ``` 27 | -------------------------------------------------------------------------------- /content/languages/objc/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Objective-C 3 | description: Objective-C on Codewars 4 | slug: /languages/objc 5 | tags: [objc] 6 | --- 7 | 8 | 9 | ## Versions 10 | GNUStep 1.8.1/Clang 11 | ## Test Frameworks 12 | [UnitKit](https://github.com/Codewars/codewars.com/wiki/UnitKit) 13 | ## Timeout 14 | 12 seconds 15 | ## Packages 16 | None 17 | ## Services 18 | None 19 | ## Language ID 20 | `objc` 21 | -------------------------------------------------------------------------------- /content/languages/dart/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Dart 3 | description: Dart on Codewars 4 | slug: /languages/dart 5 | tags: [dart] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 2.14 12 | - 3.3 13 | 14 | ## Test Frameworks 15 | 16 | [test](https://pub.dartlang.org/packages/test) 17 | 18 | ## Timeout 19 | 12 seconds 20 | 21 | ## Packages 22 | None 23 | 24 | ## Services 25 | None 26 | 27 | ## Language ID 28 | 29 | `dart` 30 | -------------------------------------------------------------------------------- /content/languages/sql/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SQL 3 | description: SQL on Codewars 4 | slug: /languages/sql 5 | tags: [sql] 6 | --- 7 | 8 | ## Versions 9 | 10 | - SQLite3 11 | - Postgres 9.6 12 | - Postgres 13.0 13 | 14 | ## Test Frameworks 15 | 16 | RSpec 17 | 18 | ## Timeout 19 | 20 | 14 seconds 21 | 22 | ## Packages 23 | 24 | None 25 | 26 | ## Services 27 | 28 | None 29 | 30 | ## Language ID 31 | 32 | `sql` 33 | -------------------------------------------------------------------------------- /content/languages/crystal/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Crystal 3 | description: Crystal on Codewars 4 | slug: /languages/crystal 5 | tags: [crystal] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 1.0 12 | 13 | ## Test Frameworks 14 | 15 | - [Spec](https://crystal-lang.org/api/1.0.0/Spec.html) 16 | 17 | ## Timeout 18 | 12 seconds 19 | ## Packages 20 | None 21 | ## Services 22 | None 23 | 24 | ## Language ID 25 | 26 | `crystal` 27 | -------------------------------------------------------------------------------- /content/languages/solidity/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Solidity 3 | description: Solidity on Codewars 4 | slug: /languages/solidity 5 | tags: [solidity] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 0.8.16 12 | 13 | ## Test Frameworks 14 | 15 | - [Mocha](https://hardhat.org/tutorial/testing-contracts) 16 | 17 | ## Timeout 18 | 19 | 16 seconds 20 | 21 | ## Services 22 | 23 | None 24 | 25 | ## Language ID 26 | 27 | `solidity` 28 | -------------------------------------------------------------------------------- /content/languages/csharp/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: C# 3 | description: C# on Codewars 4 | slug: /languages/csharp 5 | tags: [csharp] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 10.0 (.NET 6.0) 12 | - 12.0 (.NET 8.0) 13 | 14 | ## Test Frameworks 15 | 16 | [NUnit](https://nunit.org/) 17 | 18 | ## Timeout 19 | 12 seconds 20 | 21 | ## Packages 22 | None 23 | 24 | ## Services 25 | None 26 | 27 | ## Language ID 28 | 29 | `csharp` 30 | -------------------------------------------------------------------------------- /content/languages/elixir/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Elixir 3 | description: Elixir on Codewars 4 | slug: /languages/elixir 5 | tags: [elixir] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 1.15 12 | 13 | ## Test Frameworks 14 | 15 | [ExUnit](https://hexdocs.pm/ex_unit/ExUnit.html) 16 | 17 | ## Timeout 18 | 19 | 12 seconds 20 | 21 | ## Packages 22 | 23 | None 24 | 25 | ## Services 26 | 27 | None 28 | 29 | ## Language ID 30 | 31 | `elixir` 32 | -------------------------------------------------------------------------------- /content/languages/go/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Go 3 | description: Go on Codewars 4 | slug: /languages/go 5 | tags: [go] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | 1.20 12 | 13 | ## Test Frameworks 14 | 15 | [Ginkgo](http://onsi.github.io/ginkgo/) 16 | 17 | ## Timeout 18 | 19 | 12 seconds 20 | 21 | ## Packages 22 | 23 | - [Gomega](http://onsi.github.io/gomega/) 24 | 25 | ## Services 26 | 27 | None 28 | 29 | ## Language ID 30 | 31 | `go` 32 | -------------------------------------------------------------------------------- /content/languages/vb/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: VB.NET 3 | description: VB.NET on Codewars 4 | slug: /languages/vb 5 | tags: [vb] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | - 15.5 (.Net Core 2.1) 16 | 17 | ## Test Frameworks 18 | 19 | [NUnit](http://www.nunit.org/) 20 | 21 | ## Timeout 22 | 23 | 12 seconds 24 | 25 | ## Packages 26 | 27 | None 28 | 29 | ## Services 30 | 31 | None 32 | 33 | ## Language ID 34 | 35 | `vb` 36 | -------------------------------------------------------------------------------- /content/references/kata-editor.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Kata Editor 3 | tags: [reference] 4 | --- 5 | 6 | :::note 7 | *This page is a stub, please consider contributing to it.* 8 | ::: 9 | 10 | ## What is the Kata Editor? 11 | 12 | The Kata Editor is the authoring tool used to create and modify kata. It is accessible through the profile menu found in the top right corner of this site. Only users who have earned the [[Create Kata|Privileges]] privilege may access the Kata Editor. 13 | -------------------------------------------------------------------------------- /content/languages/factor/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Factor 3 | description: Factor on Codewars 4 | slug: /languages/factor 5 | tags: [factor] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | 0.98 16 | 17 | ## Test Frameworks 18 | 19 | [testest](https://github.com/Codewars/testest) 20 | 21 | ## Timeout 22 | 23 | 12 seconds 24 | 25 | ## Packages 26 | 27 | None 28 | 29 | ## Services 30 | 31 | None 32 | 33 | ## Language ID 34 | 35 | `factor` 36 | -------------------------------------------------------------------------------- /content/languages/kotlin/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Kotlin 3 | description: Kotlin on Codewars 4 | slug: /languages/kotlin 5 | tags: [kotlin] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 1.3 12 | - 1.5 13 | - 1.9 14 | 15 | ## Test Frameworks 16 | 17 | - JUnit4 18 | - KotlinTest 19 | - Spek 20 | 21 | ## Timeout 22 | 23 | 16 seconds 24 | 25 | ## Packages 26 | - kotlin.test 27 | - Kluent 28 | - Expekt 29 | 30 | ## Services 31 | None 32 | 33 | ## Language ID 34 | 35 | `kotlin` 36 | -------------------------------------------------------------------------------- /content/languages/powershell/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Powershell 3 | description: Powershell on Codewars 4 | slug: /languages/powershell 5 | tags: [powershell] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | - 6.0 16 | - 7.2 17 | 18 | ## Test Frameworks 19 | [Pester](https://github.com/pester/Pester) 20 | 21 | ## Timeout 22 | 12 seconds 23 | 24 | ## Packages 25 | None 26 | 27 | ## Services 28 | None 29 | 30 | ## Language ID 31 | 32 | `powershell` 33 | -------------------------------------------------------------------------------- /static/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "The Codewars Docs", 3 | "short_name": "The Codewars Docs", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#222222", 17 | "background_color": "#222222", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /content/languages/clojure/clojure-test.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Clojure Test 3 | tags: [clojure, reference, testing] 4 | --- 5 | 6 | # Clojure Test 7 | 8 | ## Basic Setup 9 | 10 | ### Solution Code 11 | 12 | ```clojure 13 | (ns solution) 14 | 15 | (defn add [a b] 16 | (+ a b)) 17 | ``` 18 | 19 | ### Tests 20 | 21 | ```clojure 22 | (ns solution-test 23 | (:require [clojure.test :refer :all] 24 | [solution :refer [add]])) 25 | 26 | (deftest Add 27 | (is (= (add 1 2) 3))) 28 | ``` 29 | -------------------------------------------------------------------------------- /content/languages/lambdacalc/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Lambda Calculus 3 | description: Lambda Calculus on Codewars 4 | slug: /languages/lambdacalc 5 | tags: [lambdacalc] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | 1.0.0 16 | 17 | ## Test Frameworks 18 | 19 | [lc-test](/languages/lambdacalc/lc-test/) 20 | 21 | ## Timeout 22 | 23 | 12 seconds 24 | 25 | ## Packages 26 | 27 | None 28 | 29 | ## Services 30 | 31 | None 32 | 33 | ## Language ID 34 | 35 | `lambdacalc` 36 | -------------------------------------------------------------------------------- /content/languages/perl/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Perl 3 | description: Perl on Codewars 4 | slug: /languages/perl 5 | tags: [perl] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | 5.30 16 | 17 | ## Test Frameworks 18 | 19 | [`Test::More`](https://perldoc.perl.org/Test::More) ([`Test::Most`](https://metacpan.org/pod/Test::Most) can be used to reduce boilerplate) 20 | 21 | ## Timeout 22 | 23 | 12 seconds 24 | 25 | ## Packages 26 | 27 | None 28 | 29 | ## Services 30 | 31 | None 32 | 33 | 34 | ## Language ID 35 | 36 | `perl` 37 | -------------------------------------------------------------------------------- /content/languages/fsharp/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: F# 3 | description: F# on Codewars 4 | slug: /languages/fsharp 5 | tags: [fsharp] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 4.1 12 | - 6.0 13 | 14 | ## Test Frameworks 15 | 16 | - [Fuchu](https://github.com/mausch/Fuchu) (F# 4.1 only) 17 | - [NUnit](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-fsharp-with-nunit) (F# 6.0 only) 18 | 19 | ## Timeout 20 | 21 | 12 seconds 22 | 23 | ## Packages 24 | 25 | None 26 | 27 | ## Services 28 | 29 | None 30 | 31 | ## Language ID 32 | 33 | `fsharp` 34 | -------------------------------------------------------------------------------- /content/languages/bf/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: BF 3 | description: BF on Codewars 4 | slug: /languages/bf 5 | tags: [bf] 6 | --- 7 | 8 | ## Versions 9 | 10 | 20041219 (package [bf](https://packages.ubuntu.com/xenial/bf) in Ubuntu Xenial) 11 | 12 | Executed with `bf -c29999 solution`. 13 | 14 | ## References 15 | 16 | - [manpage](http://manpages.ubuntu.com/manpages/xenial/man1/bf.1.html) 17 | 18 | ## Test Frameworks 19 | Codewars 20 | 21 | ## Timeout 22 | 12 seconds 23 | 24 | ## Packages 25 | None 26 | 27 | ## Services 28 | None 29 | 30 | ## Language ID 31 | 32 | `bf` 33 | -------------------------------------------------------------------------------- /catalog-info.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: backstage.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: codewars-docs 5 | description: Codewars application documentation. 6 | annotations: 7 | github.com/project-slug: codewars/docs 8 | links: 9 | - url: https://docs.codewars.com 10 | title: Production Environment 11 | icon: url 12 | - url: https://github.com/codewars/docs/actions 13 | title: CI/CD Pipelines 14 | icon: jenkins 15 | tags: 16 | - nodejs 17 | spec: 18 | type: service 19 | lifecycle: production 20 | owner: qualified-codewars 21 | -------------------------------------------------------------------------------- /content/languages/cobol/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: COBOL 3 | description: COBOL on Codewars 4 | slug: /languages/cobol 5 | tags: [cobol] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | - `3.1 (IBM)` (GnuCOBOL v3.1 `-std=ibm -O2 -fstatic-call -ffold-copy=lower`) 16 | 17 | ## Test Frameworks 18 | 19 | A custom test framework is used. See [codewars/cobol-test](https://github.com/codewars/cobol-test). 20 | 21 | ## Timeout 22 | 23 | 12 seconds 24 | 25 | ## Packages 26 | 27 | None 28 | 29 | ## Services 30 | 31 | None 32 | 33 | ## Language ID 34 | 35 | `cobol` 36 | -------------------------------------------------------------------------------- /content/languages/go/ginkgo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ginkgo 3 | tags: [go, reference, testing] 4 | --- 5 | 6 | # Ginkgo 7 | 8 | ## Basic Setup 9 | 10 | ### Solution 11 | 12 | ```go 13 | package kata 14 | 15 | func Add(a, b int) int { 16 | return a + b 17 | } 18 | ``` 19 | 20 | ### Tests 21 | 22 | ```go 23 | package kata_test 24 | 25 | import ( 26 | . "github.com/onsi/ginkgo" 27 | . "github.com/onsi/gomega" 28 | . "codewarrior/kata" 29 | ) 30 | 31 | var _ = Describe("Add", func() { 32 | It("should add integers", func() { 33 | Expect(Add(1, 1)).To(Equal(2)) 34 | }) 35 | }) 36 | ``` 37 | -------------------------------------------------------------------------------- /content/languages/forth/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Forth 3 | description: Forth on Codewars 4 | slug: /languages/forth 5 | tags: [forth] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Work In Progress. See [Codewars/ttester-codewars](https://github.com/Codewars/ttester-codewars). 12 | 13 | ## Versions 14 | 15 | Gforth 0.7.3 16 | 17 | ## Test Frameworks 18 | 19 | `ttester` with [Codewars extension](https://github.com/Codewars/ttester-codewars) 20 | 21 | ## Timeout 22 | 23 | 12 seconds 24 | 25 | ## Packages 26 | 27 | None 28 | 29 | ## Services 30 | 31 | None 32 | 33 | ## Language ID 34 | 35 | `forth` 36 | -------------------------------------------------------------------------------- /content/languages/lua/busted.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - lua 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Busted 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```lua 15 | return function(a, b) 16 | return a + b 17 | end 18 | ``` 19 | 20 | ### Tests 21 | 22 | ```lua 23 | local add = require "solution" 24 | 25 | describe("add", function() 26 | it("should add numbers", function() 27 | assert.are.same(2, add(1, 1)) 28 | end) 29 | end) 30 | ``` 31 | 32 | 37 | -------------------------------------------------------------------------------- /__tmp__/popups/tips-kata-discourse.md: -------------------------------------------------------------------------------- 1 | --- 2 | subject: "Tips: Kata Discourse" 3 | on: 4 | paths: 5 | - /discuss 6 | criteria: 7 | honor: 8 | lt: 50 9 | --- 10 | 11 | Welcome to the kata discourse. Anyone can leave comments. If you need help you can post the code you are struggling with and mark it as a "spoiler" so that only those who have completed the kata can see it. 12 | 13 | If you wish to log an issue about this specific kata, such as poorly worded descriptions or issues with test cases, then you can leave a comment. Before posting the comment, make sure to mark it as a suggestion or an issue. 14 | -------------------------------------------------------------------------------- /content/languages/erlang/eunit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - erlang 4 | - reference 5 | - testing 6 | --- 7 | 8 | # EUnit 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```erlang 15 | -module(kata). 16 | -export([add/2]). 17 | 18 | add(A, B) -> A + B. 19 | ``` 20 | 21 | ### Tests 22 | 23 | ```erlang 24 | -module(kata_tests). 25 | -include_lib("eunit/include/eunit.hrl"). 26 | 27 | basic_test_() -> 28 | {"Basic tests", 29 | [{"add(1, 2) = 3", ?_assertMatch(3, kata:add(1, 2))}]}. 30 | ``` 31 | 32 | 37 | -------------------------------------------------------------------------------- /content/languages/elixir/exunit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - elixir 4 | - reference 5 | - testing 6 | --- 7 | 8 | # ExUnit 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```elixir 15 | defmodule Kata do 16 | def add(a, b) do 17 | a + b 18 | end 19 | end 20 | ``` 21 | 22 | ### Tests 23 | 24 | ```elixir 25 | defmodule TestSolution do 26 | use ExUnit.Case 27 | import Kata, only: [add: 2] 28 | 29 | test "adds two numbers" do 30 | assert add(1, 2) == 3 31 | end 32 | end 33 | ``` 34 | 35 | 40 | -------------------------------------------------------------------------------- /content/languages/agda/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Agda 3 | description: Agda on Codewars 4 | slug: /languages/agda 5 | tags: [agda] 6 | --- 7 | 8 | ## Status 9 | 10 | Beta 11 | 12 | ## Versions 13 | 14 | 2.6.0.1 15 | 16 | ## Test Frameworks 17 | 18 | None. Make the program type check. 19 | 20 | ## Timeout 21 | 22 | 16 seconds 23 | 24 | ## Packages 25 | 26 | - stdlib [v1.0.1](https://github.com/agda/agda-stdlib/releases/tag/v1.0.1) 27 | - Cubical [b1fddc15](https://github.com/agda/cubical/commit/b1fddc15b80ed9569224b8a1461ae5f879dab826) (latest compatible with 2.6.0) 28 | 29 | ## Services 30 | 31 | None 32 | 33 | ## Language ID 34 | 35 | `agda` 36 | -------------------------------------------------------------------------------- /content/languages/groovy/spock.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - groovy 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Spock 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```groovy 15 | class Adder { 16 | static def add(a, b) { a + b } 17 | } 18 | ``` 19 | 20 | ### Tests 21 | 22 | ```groovy 23 | import spock.lang.Specification 24 | 25 | class AdderSpec extends Specification { 26 | def "Adder.add returns the sum"() { 27 | expect: 28 | assert Adder.add(1, 1) == 2 29 | } 30 | } 31 | ``` 32 | 33 | 34 | 39 | -------------------------------------------------------------------------------- /content/languages/fsharp/fuchu.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - fsharp 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Fuchu 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```fsharp 15 | let add a b = a + b 16 | ``` 17 | 18 | ### Tests 19 | 20 | ```fsharp 21 | module Tests = begin 22 | open Fuchu 23 | let suite = 24 | testList "Add" [ 25 | testCase "Adds two numbers" <| 26 | fun _ -> 27 | Assert.Equal("add(1, 1) == 2", 2, add 1 1) 28 | ] 29 | end 30 | ``` 31 | 32 | 37 | -------------------------------------------------------------------------------- /content/languages/kotlin/kotlintest.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - kotlin 4 | - reference 5 | - testing 6 | --- 7 | 8 | # KotlinTest 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```kotlin 15 | fun add(a: Int, b: Int) = a + b 16 | ``` 17 | 18 | ### Tests 19 | 20 | ```kotlin 21 | import io.kotlintest.matchers.shouldBe 22 | import io.kotlintest.specs.StringSpec 23 | 24 | class TestAdd : StringSpec() { 25 | init { 26 | "add(1, 1) should return 2" { 27 | add(1, 1) shouldBe 2 28 | } 29 | } 30 | } 31 | ``` 32 | 33 | 38 | -------------------------------------------------------------------------------- /content/languages/python/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Python 3 | description: Python on Codewars 4 | slug: /languages/python 5 | tags: [python] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 3.8 12 | - 3.10 13 | - 3.11 14 | 15 | ## Test Frameworks 16 | 17 | - [Codewars Test Framework](/languages/python/codewars-test) 18 | - unittest 19 | 20 | ## Timeout 21 | 12 seconds 22 | 23 | ## Packages 24 | 25 | - beautifulsoup4 (bs4) 26 | - gmpy2 27 | - numpy 28 | - pandas 29 | - psycopg2 30 | - pycrypto (Crypto) 31 | - pymongo 32 | - redis 33 | - requests 34 | - scikit-learn 35 | - scipy 36 | - six 37 | 38 | ## Services 39 | 40 | - sqlite 41 | - redis-server 42 | - mongodb 43 | 44 | ## Language ID 45 | 46 | `python` 47 | -------------------------------------------------------------------------------- /content/languages/ocaml/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ocaml 3 | description: Ocaml on Codewars 4 | slug: /languages/ocaml 5 | tags: [ocaml] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 5.0.0 12 | 13 | ## Test Frameworks 14 | [OUnit 2.2.7](https://ocaml.org/p/ounit2/2.2.7/doc/OUnit/index.html) 15 | 16 | ## Timeout 17 | 12 seconds 18 | 19 | ## Packages 20 | - [Jane Street Base v0.15.1](https://opensource.janestreet.com/base/) 21 | - [Batteries 3.6.0](https://ocaml-batteries-team.github.io/batteries-included/hdoc2/) 22 | - [Domainslib 0.5.0](https://github.com/ocaml-multicore/domainslib) 23 | - [Zarith 1.12](https://github.com/ocaml/Zarith) 24 | 25 | ## Services 26 | None 27 | 28 | ## Language ID 29 | 30 | `ocaml` 31 | -------------------------------------------------------------------------------- /content/languages/php/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: PHP 3 | description: PHP on Codewars 4 | slug: /languages/php 5 | tags: [php] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 7.0 12 | - 7.4 13 | - 8.0 14 | 15 | ## Test Frameworks 16 | [PHPUnit](https://phpunit.de/) 17 | 18 | - [PHPUnit 5.7](https://phpunit.de/manual/5.7/en/) (PHP 7.0) 19 | - [PHPUnit 9.1](https://phpunit.readthedocs.io/en/9.1/) (PHP 7.4) 20 | - The name of the test class must end with `Test` 21 | - [PHPUnit 9.5](https://phpunit.readthedocs.io/en/9.5/) (PHP 8.0) 22 | - The name of the test class must end with `Test` 23 | 24 | ## Timeout 25 | 12 seconds 26 | 27 | ## Packages 28 | None 29 | 30 | ## Services 31 | None 32 | 33 | ## Language ID 34 | 35 | `php` 36 | -------------------------------------------------------------------------------- /content/languages/fsharp/nunit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - fsharp 4 | - reference 5 | - testing 6 | --- 7 | 8 | # NUnit 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```fsharp 15 | namespace Challenge 16 | 17 | module Challenge = 18 | let add a b = a + b 19 | ``` 20 | 21 | ### Tests 22 | 23 | ```fsharp 24 | namespace Challenge.Tests 25 | 26 | open System 27 | open NUnit.Framework 28 | open Challenge 29 | 30 | [] 31 | type TestClass () = 32 | [] 33 | member this.TestAddsTwoNumbers() = 34 | Assert.AreEqual(Challenge.add 1 2, 3) 35 | ``` 36 | 37 | 42 | -------------------------------------------------------------------------------- /content/languages/typescript/mocha.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Mocha 3 | tags: [typescript, reference, testing] 4 | --- 5 | 6 | # Mocha 7 | 8 | ## Basic Setup 9 | 10 | ### Solution 11 | 12 | ```typescript 13 | const add = (a: number, b: number): number => a + b; 14 | 15 | export default add; 16 | ``` 17 | 18 | ### Tests 19 | 20 | ```typescript 21 | import {assert, config, expect} from "chai"; 22 | import add from "./solution"; 23 | 24 | // don't truncate assertion diff output 25 | config.truncateThreshold = 0; 26 | 27 | describe("add", () => { 28 | it("should add two numbers", () => { 29 | assert.strictEqual(add(1, 2), 3); 30 | 31 | // ...or use expect assertions: 32 | expect(add(1, 2)).to.equal(3); 33 | }); 34 | }); 35 | ``` 36 | -------------------------------------------------------------------------------- /__tmp__/popups/tips-solution-voting.md: -------------------------------------------------------------------------------- 1 | --- 2 | subject: "Tips: Solution Voting" 3 | on: 4 | paths: 5 | - /solutions 6 | - /discuss 7 | criteria: 8 | honor: 9 | lt: 50 10 | --- 11 | 12 | You can vote on other Codewarrior's solutions to help uncover the best ones. There are 2 choices for voting: 13 | 14 | ## Best Practices 15 | 16 | Best practices are for solutions that you think are a good combination of being maintainable and efficient. They may not be the fastest solution - if the fastest solution involves overly optimizing the code in a way that becomes hard to read. 17 | 18 | ## Clever 19 | 20 | Clever votes are for solutions that you feel like are notable in some way, but not something you would expect to see in production code. 21 | -------------------------------------------------------------------------------- /content/languages/typescript/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: TypeScript 3 | description: TypeScript on Codewars 4 | slug: /languages/typescript 5 | tags: [typescript] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 4.9 (`--target es2022 --strict`) Node 18 12 | 13 | ## Test Frameworks 14 | [Mocha](http://mochajs.org/) 15 | 16 | ## Timeout 17 | 12 seconds 18 | 19 | ## Packages 20 | 21 | ### TypeScript 4.2 22 | 23 | - `mocha`: `8.3.0` 24 | - `chai`: `4.3.0` 25 | - `fast-check`: `2.13.0` 26 | - `lodash`: `4.17.21` 27 | - `rxjs`: `6.6.6` 28 | 29 | ### TypeScript 4.9 30 | 31 | - `mocha`: `10.2.0` 32 | - `chai`: `4.3.7` 33 | - `fast-check`: `3.4.0` 34 | - `lodash`: `4.17.21` 35 | - `rxjs`: `7.8.0` 36 | 37 | ## Services 38 | None 39 | 40 | ## Language ID 41 | `typescript` 42 | -------------------------------------------------------------------------------- /.github/workflows/docsearch.yml: -------------------------------------------------------------------------------- 1 | name: DocSearch Scraper 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | # Run daily at 00:00 UTC 7 | - cron: "0 0 * * *" 8 | 9 | jobs: 10 | scrape: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Get DocSearch Config 15 | id: docsearch-config 16 | run: echo "::set-output name=json::$(cat docsearch.json | jq -r tostring)" 17 | - name: Run DocSearch Scraper 18 | run: docker run -e TZ -e API_KEY -e APPLICATION_ID -e CONFIG algolia/docsearch-scraper:latest 19 | env: 20 | TZ: UTC 21 | API_KEY: ${{ secrets.ALGOLIA_API_KEY }} 22 | APPLICATION_ID: "2O5VWTLFC8" 23 | CONFIG: ${{ steps.docsearch-config.outputs.json }} 24 | -------------------------------------------------------------------------------- /content/languages/javascript/mocha.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Mocha 3 | tags: [javascript, reference, testing] 4 | --- 5 | 6 | # Mocha 7 | 8 | ## Basic Setup 9 | 10 | ### Solution 11 | 12 | ```javascript 13 | const add = (a, b) => a + b; 14 | ``` 15 | 16 | ### Tests 17 | 18 | ```javascript 19 | const {assert, config, expect} = require("chai"); 20 | 21 | // don't truncate assertion diff output 22 | config.truncateThreshold = 0; 23 | 24 | describe("add", () => { 25 | it("should add two numbers", () => { 26 | assert.strictEqual(add(1, 2), 3); 27 | 28 | // ...or use expect assertions: 29 | expect(add(1, 2)).to.equal(3); 30 | }); 31 | }); 32 | ``` 33 | 34 | 39 | -------------------------------------------------------------------------------- /content/languages/csharp/nunit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - csharp 4 | - reference 5 | - testing 6 | --- 7 | 8 | # NUnit 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```csharp 15 | public class Challenge 16 | { 17 | public static int Add(int a, int b) 18 | { 19 | return a + b; 20 | } 21 | } 22 | ``` 23 | 24 | ### Tests 25 | 26 | ```csharp 27 | using NUnit.Framework; 28 | 29 | [TestFixture] 30 | public class AddTest 31 | { 32 | [Test, Description("should add two numbers")] 33 | public void ShouldAddTwoNumbers() 34 | { 35 | Assert.That(Challenge.Add(1, 2), Is.EqualTo(3), "1 + 2 should equal 3"); 36 | } 37 | } 38 | ``` 39 | 40 | 45 | -------------------------------------------------------------------------------- /content/concepts/kata/beta-process.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Beta Process 3 | tags: [concept] 4 | --- 5 | 6 | Each kata is crafted for and by the community. Kata are created by other users rewarded with kata authoring privilege. When a kata is published by an author (or Sensei), it will go into a beta process where the community can help test and provide quality assurance feedback and cast a vote for its difficulty ranking. The feedback during this process is vital to making sure all kata are of the highest quality. 7 | 8 | Not every user is able to perform a full review of a beta kata, but every user can help in some way! Users are strongly encouraged to participate in the beta evaluation of kata awaiting their approval. For more details, see [Curating of a Kata][curating-kata]. 9 | 10 | 11 | [curating-kata]: /curation/kata/ 12 | -------------------------------------------------------------------------------- /content/languages/riscv/cgreen.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - riscv 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Cgreen 9 | 10 | Unit tests for RISC-V are written in C with [Cgreen](https://cgreen-devs.github.io/cgreen/) while the solution file is in assembly. 11 | 12 | ## Basic Setup 13 | 14 | ### Solution 15 | 16 | ```riscv 17 | .globl add 18 | add: 19 | addw a0, a0, a1 20 | ret 21 | ``` 22 | 23 | ### Tests 24 | 25 | ```c 26 | #include 27 | 28 | int add(int, int); 29 | 30 | Describe(Add); 31 | BeforeEach(Add) {} 32 | AfterEach(Add) {} 33 | 34 | Ensure(Add, should_add_integers) { 35 | assert_that(add(1, 1), is_equal_to(2)); 36 | } 37 | 38 | TestSuite *solution_tests() { 39 | TestSuite *suite = create_test_suite(); 40 | add_test_with_context(suite, Add, should_add_integers); 41 | return suite; 42 | } 43 | ``` 44 | -------------------------------------------------------------------------------- /sitePlugin.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | module.exports = () => { 4 | return { 5 | name: "site-plugin", 6 | 7 | // Make `@components/` resolve to `src/components`. 8 | configureWebpack: (_config, _isServer) => ({ 9 | resolve: { 10 | alias: { 11 | "@components": path.resolve(__dirname, "src/components/"), 12 | }, 13 | }, 14 | }), 15 | 16 | // Append new PostCSS plugins. 17 | configurePostCss: (postcssOptions) => { 18 | postcssOptions.plugins.push( 19 | require("tailwindcss"), 20 | require("postcss-nested"), 21 | require("postcss-preset-env")({ 22 | autoprefixer: { 23 | flexbox: "no-2009", 24 | }, 25 | stage: 4, 26 | }) 27 | ); 28 | return postcssOptions; 29 | }, 30 | }; 31 | }; 32 | -------------------------------------------------------------------------------- /content/languages/reason/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Reason 3 | description: Reason on Codewars 4 | slug: /languages/reason 5 | tags: [reason] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | 3.3 16 | 17 | ## Test Frameworks 18 | 19 | Jest ([bs-jest](https://github.com/glennsl/bs-jest)) 20 | 21 | ### Example 22 | 23 | ```ocaml 24 | let add = (a, b) => a + b; 25 | ``` 26 | ```ocaml 27 | open Jest; 28 | 29 | describe("add", () => { 30 | open Expect; 31 | 32 | test("1 + 1", () => 33 | expect(Solution.add(1, 1)) |> toBe(2)); 34 | }); 35 | ``` 36 | 37 | Solution is always put in the `Solution` module. Optional preloaded code can be provided (`Preloaded` module). 38 | 39 | ## Timeout 40 | 41 | 12 seconds 42 | 43 | ## Packages 44 | 45 | None 46 | 47 | ## Services 48 | 49 | None 50 | 51 | ## Language ID 52 | 53 | `reason` 54 | -------------------------------------------------------------------------------- /content/languages/nasm/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: NASM 3 | description: NASM on Codewars 4 | slug: /languages/nasm 5 | tags: [nasm] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | 2.11 12 | 13 | Submitted code is assembled with `nasm -f elf64`. 14 | 15 | ## Test Frameworks 16 | 17 | [Criterion](https://criterion.readthedocs.io/en/master/) 18 | 19 | ```nasm 20 | section .text 21 | global add 22 | add: ; int add(int a, int b) using 32-bit registers for ints 23 | mov eax, edi ; result = a 24 | add eax, esi ; result += b 25 | ret ; return result 26 | ``` 27 | ```c 28 | #include 29 | int add(int, int); 30 | Test(add_test, should_add_integers) { 31 | cr_assert_eq(add(1, 1), 2); 32 | } 33 | ``` 34 | 35 | ## Timeout 36 | 12 seconds 37 | 38 | ## Packages 39 | None 40 | 41 | ## Services 42 | None 43 | 44 | ## Language ID 45 | 46 | `nasm` 47 | -------------------------------------------------------------------------------- /content/languages/r/testthat.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - r 4 | - reference 5 | - testing 6 | --- 7 | 8 | # testthat 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```r 15 | add <- function(a, b) { 16 | a + b 17 | } 18 | ``` 19 | 20 | ### Tests 21 | 22 | ```r 23 | context("add") 24 | 25 | test_that("should add numbers", { 26 | expect_equal(add(1, 2), 3) 27 | }) 28 | ``` 29 | 30 | ## Using Preloaded 31 | 32 | ### Preloaded 33 | 34 | ```r 35 | f <- function(a, b) { a + b } 36 | ``` 37 | 38 | ### Solution 39 | 40 | ```r 41 | source("setup.R") 42 | add <- f 43 | ``` 44 | 45 | ### Tests 46 | 47 | ```r 48 | context("add") 49 | 50 | test_that("addition using preloaded works", { 51 | expect_equal(add(1, 1), 2) 52 | }) 53 | ``` 54 | 55 | 60 | -------------------------------------------------------------------------------- /content/languages/cpp/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: C++ 3 | description: C++ on Codewars 4 | slug: /languages/cpp 5 | tags: [cpp] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - Clang 8 C++17 (`-std=c++17 -pthread -lm -lcrypto -ldl -ltbb -lfmt -O2 -Wall -Wextra -fsanitize=return`) with `libstdc++-9` 12 | 13 | ## Test Frameworks 14 | 15 | - [Igloo](https://github.com/joakimkarlsson/igloo) 16 | 17 | > Igloo uses assertion library [snowhouse](https://github.com/banditcpp/snowhouse). 18 | > - `Clang 8 C++17`: [v3.1.1](https://github.com/banditcpp/snowhouse/releases/tag/v3.1.1) 19 | 20 | Some changes were made in order to produce output for Codewars and support C++17 ([diff](https://github.com/joakimkarlsson/igloo/compare/master...codewars:codewars)). 21 | 22 | ## Timeout 23 | 12 seconds 24 | 25 | ## Packages 26 | 27 | - `range-v3` 28 | - `fmt` 29 | 30 | ## Services 31 | None 32 | 33 | ## Language ID 34 | 35 | `cpp` 36 | -------------------------------------------------------------------------------- /content/languages/d/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: D 3 | description: D on Codewars 4 | slug: /languages/d 5 | tags: [d] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 2.098 12 | 13 | ## Test Frameworks 14 | 15 | Uses builtin `unittest` blocks with UDA to name them. 16 | 17 | ### Example 18 | 19 | Solution: 20 | ```d 21 | module solution; 22 | 23 | export int add(int a, int b) { 24 | return a + b; 25 | } 26 | ``` 27 | 28 | Tests: 29 | ```d 30 | module solution_test; 31 | 32 | import solution : add; 33 | // fluent asserts is supported 34 | version(unittest) import fluent.asserts; 35 | 36 | @("named test case") 37 | unittest { 38 | add(1, 1).should.equal(2).because("1 + 1 == 2"); 39 | assert(add(1, 1) == 2); 40 | } 41 | ``` 42 | 43 | The optional preloaded code is a separate module. 44 | 45 | ## Timeout 46 | 47 | 12 seconds 48 | 49 | ## Packages 50 | 51 | ## Services 52 | 53 | None 54 | 55 | ## Language ID 56 | 57 | `d` 58 | -------------------------------------------------------------------------------- /content/languages/java/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Java 3 | description: Java on Codewars 4 | slug: /languages/java 5 | tags: [java] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - Java 8 12 | - Java 11 13 | - Java 17 14 | 15 | ## Test Frameworks 16 | 17 | JUnit (both JUnit 4 and 5 are supported) 18 | 19 | ## Timeout 20 | 21 | 16 seconds 22 | 23 | ## Packages 24 | 25 | ### Java 11/17 26 | 27 | - `junit:junit` 28 | - `org.junit.jupiter:junit-jupiter-api` 29 | - `org.junit.jupiter:junit-jupiter-engine` 30 | - `org.junit.platform:junit-platform-launcher` 31 | - `org.junit.vintage:junit-vintage-engine` 32 | - `net.jqwik:jqwik` 33 | - `org.mockito:mockito-core` 34 | - `org.assertj:assertj-core` 35 | - `org.assertj:assertj-guava` 36 | - `org.apache.commons:commons-lang3` 37 | - `org.apache.commons:commons-math3` 38 | - `com.google.guava:guava` 39 | - `org.jsoup:jsoup` 40 | - `org.dom4j:dom4j` 41 | 42 | ## Services 43 | 44 | None 45 | 46 | ## Language ID 47 | 48 | `java` 49 | -------------------------------------------------------------------------------- /content/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Codewars 3 | sidebar_label: Introduction 4 | slug: / 5 | --- 6 | 7 | Codewars is a platform that helps you learn, train, and improve your coding skills by solving programming tasks of many types and difficulty levels. You choose how you would like to learn. Do you want to take on increasingly difficult challenges? Maybe you prefer training through repetition and by improving your solutions. After solving a task, compare your answer with other users and learn from them or help less experienced users by answering their questions. 8 | 9 | By following this tutorial, you will learn how to create a new account on Codewars, configure it for an optimal training experience, and become familiar with basic elements of the user interface. Soon you will be able to face the challenges collected in Codewars' library and start learning! 10 | 11 | If you haven't joined yet, read how to [register](/getting-started/registering/) a new account on Codewars. 12 | -------------------------------------------------------------------------------- /content/languages/coq/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Coq 3 | description: Coq on Codewars 4 | slug: /languages/coq 5 | tags: [coq] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 8.12 12 | - 8.15 13 | 14 | ## Test Frameworks 15 | 16 | [coq_codewars](https://github.com/Codewars/coq_codewars) 17 | 18 | ## Interactive Proof Editing Support 19 | 20 | Unfortunately, the Codewars environment does not support the interactive development of Coq proofs. The current recommended method of solving a Kata is by copying the relevant code snippets onto your local machine and developing your solution locally: preloaded code should go into `Preloaded.v`, your solution into `Solution.v` and the Sample/Submit tests into `SolutionTest.v`. 21 | 22 | ## Timeout 23 | 24 | 16 seconds 25 | 26 | ## Packages 27 | 28 | - [Equations](http://mattam82.github.io/Coq-Equations/) 29 | - [mathcomp](http://math-comp.github.io/math-comp/) 30 | 31 | ## Services 32 | 33 | None 34 | 35 | ## Language ID 36 | 37 | `coq` 38 | -------------------------------------------------------------------------------- /content/languages/cpp/igloo/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Igloo 3 | sidebar_label: Overview 4 | slug: /languages/cpp/igloo 5 | tags: [cpp, reference, testing] 6 | --- 7 | 8 | # Igloo 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```cpp 15 | int add(int a, int b) { 16 | return a + b; 17 | } 18 | ``` 19 | 20 | ### Tests 21 | 22 | ```cpp 23 | int add(int a, int b); 24 | 25 | Describe(Add) { 26 | It(should_add_two_numbers) { 27 | Assert::That(add(1, 2), Equals(3)); 28 | } 29 | }; 30 | ``` 31 | 32 | 41 | -------------------------------------------------------------------------------- /content/languages/shell/rspec.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: RSpec 3 | tags: [shell, reference, testing] 4 | --- 5 | 6 | # RSpec 7 | 8 | Shell can be tested with Ruby's [RSpec](https://rspec.info/) library which runs the solution shell script as a subprocess. The `run_shell(args: [], output: true)` function is provided to facilitate this. Calling `run_shell(2, 3, 4)` effectively runs `bash -c $(cat solution.sh) 2 3 4` and returns the script's stdout as a string. 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```shell 15 | #!/bin/bash 16 | 17 | echo $(($1 + $2)) 18 | ``` 19 | 20 | ### Tests 21 | 22 | ```ruby 23 | def add(a, b) 24 | # run the solution script and return stdout as a string 25 | run_shell args: [a, b] 26 | end 27 | 28 | describe "add" do 29 | it "should add two numbers" do 30 | expect(add(1, 2)).to eq("3") 31 | end 32 | end 33 | ``` 34 | 35 | 40 | -------------------------------------------------------------------------------- /content/languages/scala/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Scala 3 | description: Scala on Codewars 4 | slug: /languages/scala 5 | tags: [scala] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 2.13 12 | - 3.0 13 | 14 | ## Test Frameworks 15 | 16 | [ScalaTest](http://www.scalatest.org/) 17 | 18 | :::note 19 | 20 | Scala 3.0 uses ScalaTest 3.2 which is not compatible with ScalaTest 3.0 used with Scala 2.13. 21 | 22 | ::: 23 | 24 | ## Timeout 25 | 26 | 16 seconds 27 | 28 | ## Packages 29 | 30 | ### 2.13 31 | 32 | - `org.scalatest:scalatest_2.13:3.0.8` 33 | - `org.scalacheck:scalacheck_2.13:1.14.0` 34 | - `org.typelevel:cats-core_2.13:2.0.0` 35 | - `org.typelevel:cats-effect_2.13:2.0.0` 36 | 37 | ### 3.0 38 | 39 | - `org.scalactic:scalactic_3:3.2.10` 40 | - `org.scalatest:scalatest_3:3.2.10` 41 | - `org.scalatestplus:scalacheck-1-15_3:3.2.10.0` 42 | - `org.typelevel:cats-core_3:2.6.1` 43 | - `org.typelevel:cats-effect_3:3.2.9` 44 | 45 | ## Services 46 | 47 | None 48 | 49 | ## Language ID 50 | 51 | `scala` 52 | -------------------------------------------------------------------------------- /content/languages/prolog/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Prolog 3 | description: Prolog on Codewars 4 | slug: /languages/prolog 5 | tags: [prolog] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | SWI Prolog v8.0 16 | 17 | ## Test Frameworks 18 | 19 | [plunit](https://www.swi-prolog.org/pldoc/doc_for?object=section(%27packages/plunit.html%27)) 20 | 21 | ### Example 22 | 23 | `plunit` can be used normally. 24 | ```prolog 25 | add_1(X,Y) :- Y is X+1. 26 | ``` 27 | ```prolog 28 | :- begin_tests(solution). 29 | :- include(solution). 30 | 31 | test(add_1) :- 32 | add_1(1, X), 33 | assertion(X == 2). 34 | 35 | :- end_tests(solution). 36 | ``` 37 | 38 | The name of the solution module is inferred from the test file using the line `:- begin_tests(example).`. 39 | Optional preloaded code is written to `preloaded.pl`. 40 | 41 | ## Timeout 42 | 43 | 12 seconds 44 | 45 | ## Packages 46 | 47 | None 48 | 49 | ## Services 50 | 51 | None 52 | 53 | ## Language ID 54 | 55 | `prolog` 56 | -------------------------------------------------------------------------------- /content/languages/raku/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Raku 3 | description: Raku on Codewars 4 | slug: /languages/raku 5 | tags: [raku] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | [Rakudo 2020.09](https://github.com/rakudo/rakudo/releases/tag/2020.09) 16 | 17 | ## Test Frameworks 18 | 19 | [Test](https://docs.raku.org/language/testing) 20 | 21 | ### Example 22 | 23 | ```raku 24 | use v6; 25 | unit module Solution; 26 | 27 | sub add($a, $b) is export { 28 | $a + $b; 29 | } 30 | ``` 31 | 32 | ```raku 33 | use v6; 34 | use Test; 35 | # The name of the solution module is inferred from the code. 36 | use Solution; 37 | 38 | subtest "test add", { 39 | is(add(1, 1), 2); 40 | } 41 | # or 42 | is(add(2, 2), 4); 43 | 44 | done-testing; 45 | ``` 46 | 47 | Preloaded code can be provided and it will be a separate module. 48 | 49 | ## Timeout 50 | 51 | 12 seconds 52 | 53 | ## Packages 54 | 55 | None 56 | 57 | ## Services 58 | 59 | None 60 | 61 | 62 | ## Language ID 63 | 64 | `raku` 65 | -------------------------------------------------------------------------------- /content/languages/c/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: C 3 | description: C on Codewars 4 | slug: /languages/c 5 | tags: [c] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - Clang 8 / C18 with glibc (POSIX) 12 | 13 | ## Command 14 | 15 | ```bash 16 | clang \ 17 | -std=c18 \ 18 | # Libraries. See Packages section below for more details. 19 | -lm -lcrypto -ldl -pthread -lcriterion -lsqlite3 \ 20 | -Wall -Wextra \ 21 | # Optional preloaded code 22 | preloaded.c \ 23 | # Solution and tests 24 | solution.c \ 25 | tests.c \ 26 | # Hooks for reporting 27 | criterion-hooks.o 28 | ``` 29 | 30 | ## Test Frameworks 31 | [Criterion](https://criterion.readthedocs.io/en/master/) 32 | 33 | ## Timeout 34 | 12 seconds 35 | 36 | ## Packages 37 | 38 | - C math functions (`libm`) 39 | - OpenSSL (`libcrypto`) 40 | - Dynamic Linking (`libdl`) 41 | - POSIX threads (`libpthread`) 42 | - Criterion testframework (`libcriterion`) 43 | - SQLite (`libsqlite3`) 44 | 45 | ## Services 46 | None 47 | 48 | ## Language ID 49 | 50 | `c` 51 | -------------------------------------------------------------------------------- /__tmp__/popups/tips-beta-kata.md: -------------------------------------------------------------------------------- 1 | --- 2 | subject: "Tips about Beta Kata" 3 | on: 4 | paths: 5 | - /solutions 6 | criteria: 7 | challenge.rank: 8 | eq: "" 9 | honor: 10 | lt: 50 11 | --- 12 | 13 | You just completed a "beta" kata. These are kata that are in the process of being vetted by the community. 14 | 15 | A few things you should know about beta kata: 16 | 17 | - The community votes on how difficult they think the kata is (Kyu level). 18 | - The community votes on how satisfying the kata is, a kata must have a high rating to make it out of beta. 19 | - The community can leave and discuss issues with the kata on the discourse page. A kata cannot come out of beta if it has issues. 20 | - Once a kata has received enough feedback, other Codewarriors who have earned the privilege to do so (through honor) can approve the kata. 21 | - Once a kata becomes ranked, you will receive the rank credit towards your progress. 22 | - Everyone who completes a beta kata earns an additional honor point for doing so. 23 | -------------------------------------------------------------------------------- /content/languages/haxe/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Haxe 3 | description: Haxe on Codewars 4 | slug: /languages/haxe 5 | tags: [haxe] 6 | --- 7 | 8 | 9 | ## Status 10 | Beta 11 | 12 | ## Versions 13 | 14 | 4.0 15 | 16 | ## Test Frameworks 17 | 18 | [utest](https://github.com/haxe-utest/utest) 19 | 20 | ### Example 21 | 22 | `src/Solution.hx` 23 | ```haxe 24 | class Example { 25 | public static function add(a:Int, b:Int):Int { 26 | return a + b; 27 | } 28 | } 29 | ``` 30 | 31 | `tests/SolutionTest.hx` 32 | ```haxe 33 | import utest.Assert; 34 | import Solution; 35 | 36 | class SolutionTest extends utest.Test { 37 | function testExample() { 38 | Assert.equals(2, Example.add(1, 1)); 39 | } 40 | } 41 | ``` 42 | The name of the test class must be `SolutionTest`. 43 | 44 | The optional preloaded code is a separate module (`src/Preloaded.hx`) that you can import. 45 | 46 | ## Timeout 47 | 48 | 12 seconds 49 | 50 | ## Packages 51 | 52 | None 53 | 54 | ## Services 55 | 56 | None 57 | 58 | ## Language ID 59 | 60 | `haxe` 61 | -------------------------------------------------------------------------------- /__tmp__/popups/on-first-kata-completed.md: -------------------------------------------------------------------------------- 1 | --- 2 | subject: "Your first completed kata" 3 | on: 4 | paths: 5 | - /solutions 6 | criteria: 7 | honor: 8 | lt: 50 9 | --- 10 | 11 | Congrats on completing your first kata! Here are some tips for what to do now. 12 | 13 | ## Solutions 14 | 15 | Each time you complete a kata you will be shown the solution of other Codewarriors. This is a great way to pick up new tips and tricks. 16 | 17 | ## Next Kata 18 | 19 | You can move on to the next kata by clicking this button in the top right corner. It will randomly select a new kata for you based 20 | off of your selected language and training routine. Your active training routine is found on the dashboard page if you want to change it. 21 | 22 | ## Train Again 23 | 24 | If the kata is available in another language that you know or are interested in, try to complete it again in that language. 25 | 26 | ## Discourse 27 | 28 | If you have something to say about the kata you just took, you can head over to the discourse section to chat about it. 29 | -------------------------------------------------------------------------------- /content/concepts/kata/collections.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Collections 3 | tags: [concept] 4 | --- 5 | 6 | 7 | _TBD: this page was imported from old CW wiki and needs to be reviewied/redacted._ 8 | 9 | ## What are collections? 10 | 11 | Collections are a way for the community to curate groups of kata that can be trained on in a sequence. All collections are public. 12 | 13 | ## How does this relate to bookmarks? 14 | 15 | Bookmarking (starring) a kata is similar to collecting a kata, except that your bookmarks are kept private. They are also easily accessible via the top right bookmarks dropdown. If you intend to keep a list of kata you wish to work on later then bookmarks will serve you better. 16 | 17 | ## Can I add to someone else's collection? 18 | 19 | Only the warrior who created the collection can add to it. You are free to create your own collection with the same name. Kata are also searchable within the kata library by any collection name it is associated with. In this way you can easily find kata that span across multiple collections of the same name. 20 | -------------------------------------------------------------------------------- /content/curation/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Content Curation 3 | slug: /curation 4 | --- 5 | 6 | All content available on Codewars is reviewed, approved, and maintained by members of the Codewars community. If Codewars users want to ensure that working with kata and translations is a pleasant, fun, and educative experience, there's no one else than users themselves who can guarantee that the content is of sufficient quality. 7 | 8 | To support users in assuring good quality kata and translations, a set of help pages were created with articles related to curating and maintenance activities: tutorials explaining how to review and maintain Codewars content, and a reference of guidelines and requirements that a piece of content should meet to be considered good. 9 | 10 | This section of the documentation is meant mostly for reviewers, approvers, and maintainers, who would like to work with existing content created by other users. Kata authors and translators can find helpful documentation in areas related to [authoring][docs-authoring]. 11 | 12 | [docs-authoring]: /authoring/ 13 | -------------------------------------------------------------------------------- /content/languages/haskell/hspec.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - haskell 4 | - reference 5 | - testing 6 | --- 7 | 8 | # HSpec 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```haskell 15 | module Example where 16 | 17 | add :: Num a => a -> a -> a 18 | add = (+) 19 | ``` 20 | 21 | ### Tests 22 | 23 | ```haskell 24 | module ExampleSpec where -- test module name MUST end with Spec 25 | import Test.Hspec 26 | import Example 27 | 28 | spec :: Spec -- `spec` is required 29 | spec = do 30 | describe "Example" $ do 31 | it "adds two numbers" $ do 32 | (add 1 1) `shouldBe` (2 :: Integer) 33 | 34 | main :: IO () -- `main` is optional 35 | main = hspec spec 36 | ``` 37 | 38 | The test module's name must end with `Spec`. `Spec` by itself is not allowed. 39 | Examples: `ExampleSpec`, `Example.ExampleSpec` are allowed while `Spec`, `Example.Spec`, `ExampleTest`, `Example.KataTest` are not. 40 | 41 | The common convention is: If the solution's module name is e.g. `YourKata.SomeTask`, just add `Spec` to the end without a dot, e.g. `YourKata.SomeTaskSpec`. 42 | 43 | -------------------------------------------------------------------------------- /content/authoring/kata.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Creating a Kata 3 | tags: [authoring] 4 | --- 5 | 6 | _TBD: improve this stub_ 7 | 8 | ## Requirements 9 | 10 | To create a new kata, a user needs to earn the ["Create Kata" privilege][reference-privileges]. After reaching the required amount of Honor, the privilege is granted and the user can select the **"New Kata"** option from their profile menu. 11 | 12 | 13 | ## Kata Editor 14 | 15 | Kata are created with the [kata editor](/references/kata-editor/) 16 | 17 | Users new to creating kata may refer to the [tutorial](/authoring/tutorials/create-first-kata/). 18 | 19 | Some [languages](/languages/) also have a page dedicated to authoring kata, with code examples and best practices. 20 | 21 | Every kata author should follow [kata authoring guidelines](/authoring/guidelines/kata/). 22 | 23 | After being published, every kata goes through the [beta process](/concepts/kata/beta-process/) and is subject to a series of [reviews](/curation/kata/). 24 | 25 | 26 | [reference-privileges]: /gamification/privileges/ 27 | [docs-curating]: /curation/ 28 | -------------------------------------------------------------------------------- /content/gamification/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Rewards and Progress 3 | tags: [concept] 4 | slug: /gamification 5 | --- 6 | 7 | On Codewars, there are two different scales you can level up by doing different things: 8 | 9 | - [**_Rank_**][concept-ranks]: This scale defines your proficiency and current kyu/dan level. You can level up your rank doing only one thing: solving kata. 10 | - [**_Honor_**][concept-honor]: Honor points represent how active the user is. Honor can be earned in many ways: completing kata, translating them, voting, and many others. Earning Honor points grants you additional [privileges][concept-privileges], which let you perform actions not available to everyone, like creating new kata, translations, etc. More details in the next pages. 11 | 12 | Your current rank and honor are displayed in the top bar: 13 | 14 | ![Top Bar](./img/top-bar_light.png#gh-light-mode-only) 15 | ![Top Bar](./img/top-bar_dark.png#gh-dark-mode-only) 16 | 17 | [concept-ranks]: /gamification/ranks/ 18 | [concept-honor]: /gamification/honor/ 19 | [concept-privileges]: /gamification/privileges/ 20 | -------------------------------------------------------------------------------- /content/languages/dart/test.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - dart 4 | - reference 5 | - testing 6 | --- 7 | 8 | # test 9 | 10 | ## Basic Setup 11 | 12 | Tests are written just like how you'd write outside of Codewars. 13 | 14 | The solution belongs to a package named `solution`. So it can be imported from `package:solution/solution.dart` and the optional preloaded code provided by the kata author can be imported from `package:solution/preloaded.dart`. 15 | 16 | ### Solution 17 | 18 | ```dart 19 | int add(int a, int b) { 20 | return a + b; 21 | } 22 | ``` 23 | 24 | ### Tests 25 | 26 | ```dart 27 | import "package:test/test.dart"; 28 | import "package:solution/solution.dart"; 29 | 30 | void main() { 31 | group("adder", () { 32 | test("adds two numbers", () { 33 | expect(add(1, 2), equals(3)); 34 | }); 35 | }); 36 | } 37 | ``` 38 | 39 | See [`test`'s documentation](https://pub.dartlang.org/packages/test#writing-tests) for how to write tests. 40 | 41 | 46 | -------------------------------------------------------------------------------- /content/languages/perl/test.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - perl 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Test::More 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```perl 15 | package Solution; 16 | 17 | use 5.030; 18 | use strict; 19 | use warnings; 20 | use Exporter qw(import); 21 | 22 | our @EXPORT_OK = qw(add); 23 | 24 | sub add { 25 | my $a = shift; 26 | my $b = shift; 27 | return $a + $b; 28 | } 29 | 30 | 1; 31 | ``` 32 | 33 | ### Tests 34 | 35 | ```perl 36 | # use strict; 37 | # use warnings; 38 | # use Test::More; 39 | # Instead of the above, `Test::Most` can be used instead to reduce boilerplate. 40 | use Test::Most; 41 | # The name of the solution package is inferred from the code. 42 | use Solution qw(add); 43 | 44 | subtest "add" => sub { 45 | is(add(1, 1), 2); 46 | }; 47 | # or 48 | is(add(2, 2), 4); 49 | 50 | done_testing(); 51 | ``` 52 | 53 | Preloaded code can be provided and it will be a separate package. 54 | 55 | 60 | -------------------------------------------------------------------------------- /content/languages/nim/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Nim 3 | description: Nim on Codewars 4 | slug: /languages/nim 5 | tags: [nim] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 1.6 12 | 13 | ## Test Frameworks 14 | 15 | [unittest](https://nim-lang.org/docs/unittest.html) 16 | 17 | Tests are currently executed using the following: 18 | ```nim 19 | # tests.nim 20 | import unittest, codewars_output 21 | addOutputFormatter(OutputFormatter(newCodewarsOutputFormatter())) 22 | import solution 23 | include solution_tests 24 | ``` 25 | 26 | The custom output formatter is open sourced at [codewars/nim-unittest](https://github.com/codewars/nim-unittest). 27 | 28 | ### Using Preloaded Code 29 | 30 | Preloaded 31 | ```nim 32 | proc f*(x, y: int): int = x + y 33 | ``` 34 | 35 | Solution 36 | ```nim 37 | import setup # required 38 | proc add*(x, y, z: int): int = f(x, y) + z 39 | ``` 40 | 41 | Tests 42 | ```nim 43 | suite "add(x, y, z) using preloaded f(x, y)": 44 | test "works": 45 | check(add(1, 1, 1) == 3) 46 | ``` 47 | 48 | ## Timeout 49 | 12 seconds 50 | ## Packages 51 | None 52 | ## Services 53 | None 54 | ## Language ID 55 | `nim` 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Qualified, Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /content/authoring/guidelines/reference-solution.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Writing a Reference Solution 3 | tags: [authoring, reference] 4 | next: /authoring/guidelines/translation/ 5 | --- 6 | 7 | 8 | :::note 9 | On this page, the term "Reference Solution" refers to a separate code snippet provided by a kata author or translator, which is used by Codewars to verify the correctness of the kata while it's being published. 10 | 11 | For guidelines related to the piece of code used by submissions tests to generate expected answers, see [Reference Solution][authoring-guidelines-tests-solution] section on [Writing Submission Tests][authoring-guidelines-tests] page. 12 | ::: 13 | 14 | The reference solution **should conform to [General Coding Guidelines][authoring-guidelines-general-coding]** because it must be maintained, unlike other submitted solutions. Always think about the future maintainers and translators. 15 | 16 | [authoring-guidelines-general-coding]: /authoring/guidelines/coding/ 17 | [authoring-guidelines-tests]: /authoring/guidelines/submission-tests/ 18 | [authoring-guidelines-tests-solution]: /authoring/guidelines/submission-tests/#reference-solution 19 | -------------------------------------------------------------------------------- /content/languages/c/criterion.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Criterion 3 | tags: [c, reference, testing] 4 | --- 5 | 6 | The Criterion testing framework is available in its [Github repository](https://github.com/Snaipe/Criterion). Reference for the Criterion API can be found here: [https://criterion.readthedocs.io/en/master/intro.html](https://criterion.readthedocs.io/en/master/intro.html). 7 | 8 | ## Basic Setup 9 | 10 | ```c 11 | int add(int a, int b) { 12 | return a + b; 13 | } 14 | ``` 15 | 16 | ```c 17 | #include 18 | 19 | int add(int, int); 20 | 21 | Test(add_test, should_add_integers, .description = "should add integers") { 22 | int a = 1; 23 | int b = 1; 24 | int expected = 2; 25 | cr_assert_eq(expected, add(a, b), "add(%d, %d) == %d", a, b, expected); 26 | } 27 | ``` 28 | 29 | ## Assertions 30 | 31 | _TBD_ 32 | 33 | [Assertions reference](https://criterion.readthedocs.io/en/master/assert.html) can be found in the Criterion documentation. 34 | 35 | - assert vs except 36 | - messages 37 | 38 | 43 | -------------------------------------------------------------------------------- /__tmp__/popups/tips-kata-trainer.md: -------------------------------------------------------------------------------- 1 | --- 2 | subject: "Tips: Kata Trainer" 3 | on: 4 | paths: 5 | - /train/ 6 | - /train$ 7 | criteria: 8 | honor: 9 | lt: 10 10 | --- 11 | 12 | Welcome to the kata trainer! A few tips to get you started: 13 | 14 | ## Attempt 15 | 16 | This button will submit your code against the full set of tests needed to complete the kata. 17 | 18 | ## Test 19 | 20 | This button will test your solution against the _sample_ tests. Most kata will have provided you some sample tests to get you going, while others will not, in which case some test documentation will be shown instead. 21 | 22 | If you care about using TDD, then the sample tests section will be very useful for you. You are encouraged to write your own tests as you try to complete the kata, as you would if you were writing production code. 23 | 24 | ## Production Quality Code 25 | 26 | Some Codewarriors like to write code golfed or creative/clever solutions, but most try to write production quality code. After you have completed all of the test cases (via the attempt button), you will be given an opportunity to cleanup your code so that it's "code review" ready. 27 | -------------------------------------------------------------------------------- /content/languages/scala/scalatest.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - scala 4 | - reference 5 | - testing 6 | --- 7 | 8 | # ScalaTest 9 | 10 | ## Basic Setup (Scala 3.0/ScalaTest 3.2) 11 | 12 | ### Solution 13 | 14 | ```scala 15 | def add(a: Int, b: Int) = a + b 16 | ``` 17 | 18 | ### Tests 19 | 20 | ```scala 21 | import org.scalatest.flatspec._ 22 | import org.scalatest.matchers.should._ 23 | 24 | class AdderSpec extends AnyFlatSpec with Matchers { 25 | "add(1, 2)" should "be 3" in { 26 | add(1, 2) shouldBe (3) 27 | } 28 | } 29 | ``` 30 | 31 | ## Basic Setup (Scala 2.13/ScalaTest 3.0) 32 | 33 | :::warning 34 | Scala 3 should be used for new content 35 | ::: 36 | 37 | ### Solution 38 | 39 | ```scala 40 | object Adder { 41 | def add(a: Int, b: Int) = a + b 42 | } 43 | ``` 44 | 45 | ### Tests 46 | 47 | ```scala 48 | import org.scalatest._ 49 | 50 | class AdderSpec extends FlatSpec with Matchers { 51 | behavior of "Adder.add" 52 | 53 | it should "add two numbers" in { 54 | Adder.add(1, 2) should equal (3) 55 | } 56 | } 57 | ``` 58 | 59 | 64 | -------------------------------------------------------------------------------- /content/getting-started/solutions.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Viewing Solutions 3 | --- 4 | 5 | ## Learning 6 | 7 | Viewing accepted solutions, be it after solving a kata or after unlocking them, is one of the best ways to learn. Other users could have different ideas for solving the task. Their solutions can be clearer, shorter, faster, or use functions you did not know existed. You can learn a lot while studying them, and it's very often worthwhile to at least briefly read over them. 8 | 9 | If some solution caught your special attention, you can write a post in the solution's discourse section to praise it, criticize it in some way, or ask questions about it. 10 | 11 | ## Voting 12 | 13 | You can vote on other user's solutions to help uncover the best ones. There are two choices for voting: 14 | 15 | ### Best Practices 16 | 17 | Best practices are for solutions that you think are a good combination of being maintainable and efficient. They may not be the fastest solution - if the fastest solution involves overly optimizing the code in a way that becomes hard to read. 18 | 19 | ### Clever 20 | 21 | Clever votes are for solutions that you feel like are notable in some way, but not something you would expect to see in production code. 22 | -------------------------------------------------------------------------------- /content/languages/racket/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Racket 3 | description: Racket on Codewars 4 | slug: /languages/racket 5 | tags: [racket] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 8.1 [CS](https://docs.racket-lang.org/guide/performance.html#%28tech._c%29) 12 | - 8.1 [BC](https://docs.racket-lang.org/guide/performance.html#%28tech._bc%29) 13 | 14 | BC can be used when CS implementation have performance issues (e.g., bignums). 15 | 16 | ## Test Frameworks 17 | 18 | [RackUnit](https://docs.racket-lang.org/rackunit/) 19 | 20 | ### Example 21 | 22 | ```racket 23 | #lang racket 24 | (provide add) 25 | (define (add a b) (+ a b)) 26 | ``` 27 | ```racket 28 | #lang racket 29 | (require "solution.rkt") 30 | (require rackunit 31 | codewars/rackunit) 32 | 33 | (run-tests 34 | (test-suite 35 | "example" 36 | (test-case 37 | "add" 38 | (check-equal? (add 1 1) 2)))) 39 | ``` 40 | Import `"solution.rkt"`, `rackunit` and [`codewars/rack-unit`](https://github.com/Codewars/codewars-rackunit). 41 | Optional preloaded code will be written to `"preloaded.rkt"`. 42 | 43 | ## Timeout 44 | 45 | 12 seconds 46 | 47 | ## Packages 48 | 49 | None 50 | 51 | ## Services 52 | 53 | None 54 | 55 | ## Language ID 56 | 57 | `racket` 58 | -------------------------------------------------------------------------------- /docsearch.json: -------------------------------------------------------------------------------- 1 | { 2 | "index_name": "codewars-docs", 3 | "start_urls": ["https://docs.codewars.com/"], 4 | "sitemap_urls": ["https://docs.codewars.com/sitemap.xml"], 5 | "sitemap_alternate_links": true, 6 | "stop_urls": [], 7 | "selectors": { 8 | "lvl0": { 9 | "selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]", 10 | "type": "xpath", 11 | "global": true, 12 | "default_value": "Documentation" 13 | }, 14 | "lvl1": "header h1", 15 | "lvl2": "article h2", 16 | "lvl3": "article h3", 17 | "lvl4": "article h4", 18 | "lvl5": "article h5", 19 | "lvl6": "article h6", 20 | "text": "article p, article li" 21 | }, 22 | "strip_chars": " .,;:#", 23 | "custom_settings": { 24 | "separatorsToIndex": "_", 25 | "attributesForFaceting": ["language", "version", "type", "docusaurus_tag"], 26 | "attributesToRetrieve": [ 27 | "hierarchy", 28 | "content", 29 | "anchor", 30 | "url", 31 | "url_without_anchor", 32 | "type" 33 | ] 34 | }, 35 | "nb_hits": 3038 36 | } 37 | -------------------------------------------------------------------------------- /src/theme/CodeBlock/index.js: -------------------------------------------------------------------------------- 1 | import copy from "copy-text-to-clipboard"; 2 | import React, { useRef, useState } from "react"; 3 | 4 | const CodeBlock = ({ ...props }) => { 5 | const pre = useRef(null); 6 | const [showCopied, setShowCopied] = useState(false); 7 | const handleCopyCode = () => { 8 | if (pre.current) { 9 | copy( 10 | Array.from(pre.current.querySelectorAll("code")) 11 | .map((el) => el.textContent) 12 | .join("\n") 13 | ); 14 | setShowCopied(true); 15 | setTimeout(() => setShowCopied(false), 1500); 16 | } 17 | }; 18 | 19 | return ( 20 |
21 |

22 |       
30 |     
31 | ); 32 | }; 33 | 34 | export default CodeBlock; 35 | -------------------------------------------------------------------------------- /content/languages/idris/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Idris 3 | description: Idris on Codewars 4 | slug: /languages/idris 5 | tags: [idris] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | 1.3.x 16 | 17 | ## Test Frameworks 18 | 19 | [specdris](https://github.com/pheymann/specdris) 20 | 21 | ### Example 22 | 23 | ```idris 24 | module Solution 25 | 26 | %access export 27 | %default total 28 | 29 | add : Nat -> Nat -> Nat 30 | add a b = a + b 31 | ``` 32 | 33 | ```idris 34 | module SolutionSpec 35 | 36 | import Specdris.Spec 37 | import Solution 38 | 39 | %access export 40 | %default total 41 | 42 | specSuite : IO () 43 | specSuite = spec $ do 44 | describe "add" $ do 45 | it "adds two natural numbers" $ do 46 | (1 `add` 1) `shouldBe` 2 47 | ``` 48 | 49 | The test needs to export `specSuite : IO ()` like in [the official example](https://github.com/pheymann/specdris/blob/7d7721cb16f71a389145ce0f41562d889ae648a7/examples/SpecExample.idr). 50 | 51 | The names of the module can be anything and the optional preloaded code will be just extra module. 52 | 53 | ## Timeout 54 | 55 | 12 seconds 56 | 57 | ## Packages 58 | 59 | None 60 | 61 | ## Services 62 | 63 | None 64 | 65 | ## Language ID 66 | 67 | `idris` 68 | -------------------------------------------------------------------------------- /content/languages/commonlisp/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CommonLisp 3 | description: CommonLisp on Codewars 4 | slug: /languages/commonlisp 5 | tags: [commonlisp] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | SBCL 2.0.9 12 | 13 | ## Test Frameworks 14 | 15 | [rove](https://github.com/fukamachi/rove) 16 | 17 | ### Example 18 | 19 | ```lisp 20 | (in-package #:cl-user) 21 | (defpackage #:challenge/solution 22 | (:use #:cl) 23 | (:export #:add)) 24 | (in-package #:challenge/solution) 25 | 26 | (defun add (a b) (+ a b)) 27 | ``` 28 | ```lisp 29 | (in-package #:cl-user) 30 | (defpackage #:challenge/tests/solution 31 | (:use #:cl 32 | #:rove 33 | #:challenge/solution)) 34 | (in-package #:challenge/tests/solution) 35 | ; Solution can be imported from `challenge/solution`. 36 | ; Optional preloaded package (`challenge/preloaded`) can be provided by kata authors. 37 | 38 | ; Write tests with Rove (https://github.com/fukamachi/rove). 39 | ; The use of `testing` is recommended for better output on Codewars. 40 | (deftest test-solution 41 | (testing "add" 42 | (ok (= (add 1 1) 2)))) 43 | ``` 44 | 45 | ## Timeout 46 | 47 | 12 seconds 48 | 49 | ## Packages 50 | 51 | None 52 | 53 | ## Services 54 | 55 | None 56 | 57 | ## Language ID 58 | 59 | `commonlisp` 60 | -------------------------------------------------------------------------------- /content/languages/cfml/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CFML 3 | description: CFML on Codewars 4 | slug: /languages/cfml 5 | tags: [cfml] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | Lucee v5.2 16 | 17 | ## Test Frameworks 18 | 19 | [TestBox v3](https://testbox.ortusbooks.com) 20 | 21 | ### Example 22 | 23 | The solution and the tests are written to `Solution.cfc` and `SolutionTest.cfc` respectively. 24 | Optional preloaded code is written to `Preloaded.cfc` if given. 25 | 26 | ```javascript 27 | component { 28 | function add(required a, required b) { 29 | return a + b; 30 | } 31 | } 32 | ``` 33 | 34 | ```javascript 35 | component extends="CodewarsBaseSpec" { 36 | function beforeAll(){ 37 | SUT = createObject( 'Solution' ); 38 | } 39 | 40 | function run(){ 41 | describe( "Example", function(){ 42 | it( 'add(a, b) returns sum', function(){ 43 | expect( SUT.add(1, 1) ).toBe( 2 ); 44 | }); 45 | }); 46 | } 47 | } 48 | ``` 49 | [`CodewarsBaseSpec`](https://github.com/Codewars/testbox-codewars/blob/master/CodewarsBaseSpec.cfc) allows grouping debugging outputs under the relevant test case. 50 | 51 | ## Timeout 52 | 53 | 16 seconds 54 | 55 | ## Packages 56 | 57 | None 58 | 59 | ## Services 60 | 61 | None 62 | 63 | 64 | ## Language ID 65 | 66 | `cfml` 67 | -------------------------------------------------------------------------------- /.github/workflows/reviewdog.yml: -------------------------------------------------------------------------------- 1 | name: reviewdog 2 | on: [pull_request] 3 | jobs: 4 | misspell: 5 | name: runner / misspell 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v1 9 | - uses: reviewdog/action-misspell@v1 10 | with: 11 | github_token: ${{ secrets.GITHUB_TOKEN }} 12 | reporter: github-pr-review 13 | locale: "US" 14 | pattern: "*.md*" 15 | 16 | languagetool: 17 | name: runner / languagetool 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v2 21 | - uses: reviewdog/action-languagetool@v1 22 | with: 23 | github_token: ${{ secrets.GITHUB_TOKEN }} 24 | reporter: github-pr-review 25 | level: warning 26 | language: en-US 27 | patterns: "**/*.md **/*.mdx **/*.txt glossary.yml" 28 | # Disable the following in addition to the defaults: 29 | # - "Possible agreement error: numeral + singular countable noun" 30 | disabled_rules: "WHITESPACE_RULE,EN_QUOTES,DASH_RULE,WORD_CONTAINS_UNDERSCORE,UPPERCASE_SENTENCE_START,ARROWS,COMMA_PARENTHESIS_WHITESPACE,UNLIKELY_OPENING_PUNCTUATION,SENTENCE_WHITESPACE,CURRENCY,EN_UNPAIRED_BRACKETS,PHRASE_REPETITION,PUNCTUATION_PARAGRAPH_END,METRIC_UNITS_EN_US,ENGLISH_WORD_REPEAT_BEGINNING_RULE,CD_NN" 31 | -------------------------------------------------------------------------------- /content/languages/kotlin/junit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - kotlin 4 | - reference 5 | - testing 6 | --- 7 | 8 | # JUnit 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```kotlin 15 | fun add(a: Int, b: Int) = a + b 16 | ``` 17 | 18 | ### Tests (JUnit 5) 19 | 20 | ```kotlin 21 | import org.junit.jupiter.api.Assertions.assertEquals 22 | import org.junit.jupiter.api.DisplayName 23 | import org.junit.jupiter.api.Nested 24 | import org.junit.jupiter.api.Test 25 | 26 | @DisplayName("Testing Adder") 27 | class AdderTests { 28 | @Test 29 | @DisplayName("add(1, 1) returns 2") 30 | fun addTwo() { 31 | assertEquals(2, add(1, 1), "1 + 1 should equal 2") 32 | } 33 | 34 | @Nested 35 | @DisplayName("Negative Integers") 36 | class Negatives { 37 | @Test 38 | @DisplayName("add(-1, -1) returns -2") 39 | fun addTwoNegative() { 40 | assertEquals(-2, add(-1, -1), "-1 + -1 should equal -2") 41 | } 42 | } 43 | } 44 | ``` 45 | 46 | ### Tests (JUnit 4) 47 | 48 | ```kotlin 49 | import kotlin.test.assertEquals 50 | import org.junit.Test 51 | 52 | class TestAdd { 53 | @Test 54 | fun addTest() { 55 | assertEquals(2, add(1, 1)) 56 | } 57 | } 58 | ``` 59 | 60 | 65 | -------------------------------------------------------------------------------- /content/languages/ruby/codewars-test.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Codewars Test Framework 3 | tags: [ruby, reference, testing] 4 | --- 5 | 6 | # Codewars Test Framework 7 | 8 | :::warning 9 | RSpec should be used instead of Codewars Test Framework for new content. 10 | ::: 11 | 12 | ## Basic Setup 13 | 14 | ```ruby 15 | describe "Tests" do 16 | it "a test case" do 17 | Test.assert_equals(add(1, 1), 2, "optional message") 18 | end 19 | end 20 | ``` 21 | 22 | ## Assertions 23 | 24 | ### `assert_equals` 25 | 26 | `Test.assert_equals(actual, expected, msg = nil)` 27 | 28 | Checks that the actual value equals the expected value. 29 | 30 | ### `assert_not_equals` 31 | 32 | `Test.assert_not_equals(actual, unexpected, msg = nil)` 33 | 34 | Checks that the actual value does not equal the unexpected value. 35 | 36 | ### `expect_error` 37 | 38 | `Test.expect_error(msg, &block)` 39 | 40 | Checks that `block` raises an error. 41 | 42 | ### `expect_no_error` 43 | 44 | `Test.expect_no_error(msg, &block)` 45 | 46 | Checks that `block` raises no error. 47 | 48 | ### `expect` 49 | 50 | `Test.expect(passed, msg = nil)` 51 | 52 | Checks that `passed` is truthy. 53 | 54 | ## Utilities 55 | 56 | ### `random_number` 57 | 58 | `Test.random_number()` 59 | 60 | Returns a random number. 61 | 62 | ### `random_token` 63 | 64 | `Test.random_token()` 65 | 66 | Returns a random string. 67 | -------------------------------------------------------------------------------- /content/authoring/recipes/read-solution-file.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to Read a Solution File 3 | tags: [authoring, recipe] 4 | --- 5 | 6 | Some kata may wish to analyze the content of the solution file in order to verify requirements related to the code itself. For example, tests of a code golf kata would probably want to verify the length of the submitted solution. 7 | 8 | ## Location 9 | 10 | The submitted solution is written to a file located at `/workspace/solution.txt`. It can be read by file I/O procedures available in the language of the tests. 11 | 12 | :::info 13 | Older language versions have `/home/codewarrior` symlinked to `/workspace`, so `/home/codewarrior/solution.txt` works on those, but this behavior is deprecated and not present in code runners for new language versions. Kata which use the old path (i.e. `/home/codewarrior/solution.txt`) should be updated to use `/workspace/solution.txt`. 14 | ::: 15 | 16 | ## Encoding 17 | 18 | The file is encoded with **UTF-8**. 19 | 20 | :::warning 21 | Since UTF-8 encodes characters with byte sequences of variable length, it's not always the case that the file size (measured in bytes) equals code length (measured in characters). Kata authors should always consider the possible difference between size in bytes and amount of stored characters, state the requirements (i.e. what is measured) precisely, and verify it correctly. 22 | ::: 23 | -------------------------------------------------------------------------------- /content/languages/groovy/junit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - groovy 4 | - reference 5 | - testing 6 | --- 7 | 8 | # JUnit 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```groovy 15 | class Adder { 16 | static def add(a, b) { a + b } 17 | } 18 | ``` 19 | 20 | ### Tests (JUnit 5) 21 | 22 | ```groovy 23 | import static org.junit.jupiter.api.Assertions.assertEquals 24 | 25 | import org.junit.jupiter.api.DisplayName 26 | import org.junit.jupiter.api.Nested 27 | import org.junit.jupiter.api.Test 28 | 29 | @DisplayName("Testing Adder") 30 | class AdderTests { 31 | @Test 32 | @DisplayName("Adder.add(1, 1) returns 2") 33 | void "1 + 1 = 2"() { 34 | assertEquals(2, Adder.add(1, 1), "1 + 1 should equal 2") 35 | } 36 | 37 | @Nested 38 | @DisplayName("Negative Integers") 39 | class Negatives { 40 | @Test 41 | @DisplayName("Adder.add(-1, -1) returns -2") 42 | void "-1 + -1 = -2"() { 43 | assertEquals(-2, Adder.add(-1, -1), "-1 + -1 should equal -2") 44 | } 45 | } 46 | } 47 | ``` 48 | 49 | ### Tests (JUnit 4) 50 | 51 | ```groovy 52 | import org.junit.Test 53 | import static org.junit.Assert.assertEquals 54 | 55 | class TestAdd { 56 | @Test 57 | void "1 + 1 = 2"() { 58 | assertEquals(2, Adder.add(1, 1)) 59 | } 60 | } 61 | ``` 62 | 63 | 68 | -------------------------------------------------------------------------------- /content/languages/pascal/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Pascal 3 | description: Pascal on Codewars 4 | slug: /languages/pascal 5 | tags: [pascal] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | Free Pascal v3.2 16 | 17 | ## Test Frameworks 18 | 19 | [FPTest](https://github.com/graemeg/fptest) 20 | 21 | ### Example 22 | 23 | ```pascal 24 | unit Example; 25 | 26 | {$mode objfpc}{$H+} 27 | 28 | interface 29 | 30 | function Add(const A: Integer; const B: Integer): Integer; 31 | 32 | implementation 33 | 34 | function Add(const A: Integer; const B: Integer): Integer; 35 | begin 36 | Result := A + B; 37 | end; 38 | 39 | end. 40 | ``` 41 | 42 | ```pascal 43 | unit ExampleTests; 44 | 45 | {$mode objfpc}{$H+} 46 | 47 | interface 48 | 49 | uses 50 | TestFramework, 51 | Example; 52 | 53 | type 54 | TExampleTests = class(TTestCase) 55 | published 56 | procedure TestAdd; 57 | end; 58 | 59 | procedure RegisterTests; 60 | 61 | implementation 62 | 63 | procedure RegisterTests; 64 | begin 65 | TestFramework.RegisterTest(TExampleTests.Suite); 66 | end; 67 | 68 | procedure TExampleTests.TestAdd; 69 | begin 70 | CheckEquals(2, Add(1, 1)); 71 | end; 72 | 73 | end. 74 | ``` 75 | 76 | Preloaded code can be provided as a separate unit. 77 | 78 | ## Timeout 79 | 80 | 12 seconds 81 | 82 | ## Packages 83 | 84 | None 85 | 86 | ## Services 87 | 88 | None 89 | 90 | ## Language ID 91 | 92 | `pascal` 93 | -------------------------------------------------------------------------------- /content/languages/fortran/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Fortran 3 | description: Fortran on Codewars 4 | slug: /languages/fortran 5 | tags: [fortran] 6 | --- 7 | 8 | 9 | ## Status 10 | Beta 11 | 12 | ## Versions 13 | 14 | - `f2008` with GFortran 9 (`-std=f2008 -fall-intrinsics`) 15 | 16 | ## Test Frameworks 17 | 18 | [Codewars Test Framework (CW2)](https://github.com/Codewars/fortran-test-framework) 19 | 20 | **NOTE:** Unlike other Codewars test frameworks, assertions take expected value first. 21 | 22 | ```fortran 23 | module Solution 24 | implicit none 25 | contains 26 | function add(a, b) 27 | integer(kind=4),intent(in)::a 28 | integer(kind=4),intent(in)::b 29 | integer(kind=4)::add 30 | add = a + b 31 | end function 32 | end module 33 | ``` 34 | 35 | ```fortran 36 | program TestCases 37 | use CW2 38 | use Solution 39 | implicit none 40 | call assertEquals(2, add(1, 1)) 41 | end program 42 | ``` 43 | 44 | Module names can be anything valid. Preloaded can be used to add another module. 45 | 46 | Using `describe` and `it`: 47 | ```fortran 48 | program TestCases 49 | use CW2 50 | use Solution 51 | implicit none 52 | call describe("add") 53 | call it("adds integers") 54 | call assertEquals(2, add(1, 1)) 55 | call endContext() 56 | call endContext() 57 | end program 58 | ``` 59 | 60 | 61 | ## Timeout 62 | 12 seconds 63 | 64 | ## Packages 65 | None 66 | 67 | ## Services 68 | None 69 | 70 | ## Language ID 71 | 72 | `fortran` 73 | -------------------------------------------------------------------------------- /content/languages/haskell/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Haskell 3 | description: Haskell on Codewars 4 | slug: /languages/haskell 5 | tags: [haskell] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - GHC 9.2.5 ([LTS Haskell 20.10](https://www.stackage.org/lts-20.10)) 12 | 13 | ## Test Frameworks 14 | 15 | [Hspec](http://hspec.github.io/) 16 | 17 | ## Timeout 18 | 19 | 12 seconds 20 | 21 | ## Container image 22 | 23 | [Haskell container image at Github](https://github.com/codewars/haskell) 24 | 25 | ## Packages 26 | 27 | ### GHC 9.2.5 28 | 29 | From [package.yaml](https://github.com/codewars/haskell/blob/main/workspace/package.yaml) 30 | 31 | | package | version | 32 | | --- | --- | 33 | | base | 4.16.4.0 | 34 | | attoparsec | 0.14.4 | 35 | | haskell-src-exts | 1.23.1 | 36 | | hspec | 2.9.7 | 37 | | hspec-attoparsec | 0.1.0.2 | 38 | | hspec-codewars | 0.1.0 | 39 | | hspec-contrib | 0.5.2 | 40 | | hspec-formatters-codewars | 0.3.0 | 41 | | hspec-megaparsec | 2.2.0 | 42 | | HUnit-approx | 1.1.1.1 | 43 | | lens | 5.1.1 | 44 | | megaparsec | 9.2.2 | 45 | | mtl | 2.2.2 | 46 | | parsec | 3.1.15.0 | 47 | | persistent | 2.13.3.5 | 48 | | persistent-sqlite | 2.13.1.1 | 49 | | persistent-template | 2.12.0.0 | 50 | | random | 1.2.1.1 | 51 | | regex-pcre | 0.95.0.0 | 52 | | regex-posix | 0.96.0.1 | 53 | | regex-tdfa | 1.3.2 | 54 | | split | 0.2.3.5 | 55 | | text | 1.2.5.0 | 56 | | transformers | 0.5.6.2 | 57 | | vector | 0.12.3.1 | 58 | 59 | 60 | ## Services 61 | 62 | None 63 | 64 | ## Language ID 65 | 66 | `haskell` 67 | -------------------------------------------------------------------------------- /content/languages/r/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: R 3 | description: R on Codewars 4 | slug: /languages/r 5 | tags: [r] 6 | --- 7 | 8 | 9 | ## Versions 10 | 3.4.1 11 | 12 | ## Test Frameworks 13 | [testthat](https://github.com/hadley/testthat) 14 | 15 | ## Timeout 16 | 17 | 12 seconds 18 | 19 | ## Packages 20 | 21 | Packages in the [tidyverse](https://www.tidyverse.org/) are installed (v1.2.1). 22 | 23 | Note that some packages requires `suppressPackageStartupMessages` or `warn.conflicts=FALSE` to avoid warnings printed to `stderr` causing failure (Codewars' limitation). 24 | 25 | Example: 26 | ```r 27 | suppressPackageStartupMessages( 28 | library(dplyr) 29 | ) 30 | # or 31 | library(dplyr, warn.conflicts=FALSE) 32 | ``` 33 | 34 | For `ggplot2`, use SVGs or data URIs to show the image. Specify `width` and `height` when calling `ggsave` to avoid message written to `stderr`. 35 | 36 | Example: 37 | ```r 38 | library(ggplot2) 39 | # example plot 40 | p <- ggplot(mpg, aes(displ, hwy, colour = class)) + 41 | geom_point() 42 | 43 | # SVG 44 | svgf <- "/workspace/p.svg" 45 | ggsave(plot=p, filename=svgf, width=7, height=7) 46 | cat(sprintf('\n%s\n', paste(readLines(svgf, encoding="UTF-8"), collapse=""))) 47 | 48 | # PNG 49 | pngf <- "/workspace/p.png" 50 | ggsave(plot=p, filename=pngf, width=7, height=7) 51 | cat(sprintf('\n\n', base64enc::base64encode(pngf))) 52 | ``` 53 | 54 | ## Services 55 | 56 | None 57 | 58 | ## Language ID 59 | 60 | `r` 61 | -------------------------------------------------------------------------------- /__tmp__/wiki/tutorial-approving-translations.md: -------------------------------------------------------------------------------- 1 | Sometimes, a user will create a translation of your kata. Most users notify you with a comment. So where can you find those translations? Let's have a look at the language dropdown: 2 | 3 | ![language icons](https://i.imgur.com/15I8v4i.png) 4 | 5 | Notice the little `+ Add New` at the bottom? Click on it to see the current list of translations: 6 | 7 | ![translation list](http://i.imgur.com/gVBdlbq.png) 8 | 9 | Here you get a quick overview of all translations. To see them in detail and approve, decline or fork them, click on the translation's title, in this case, "Reverse every other word in the string" PHP translation. 10 | 11 | Now, in order to *approve* or *decline* the translation, a click on the correct buttons (top on the right-hand side) is sufficient. 12 | 13 | ![buttons](https://i.imgur.com/xhw8Tuj.png) 14 | 15 | ## Remarks on accepting a translation 16 | 17 | Before you accept a translation, make sure that the difficulty and quality of the translation matches the current languages. In doubt, write a comment on the translation. If the translation diverges from the original kata, ask the translator politely whether (s)he can modify the translation so that it matches your intent. 18 | 19 | If you want to comment on the translation, you can do that on the "Discourse" page, just as in normal katas or Kumites. This is especially helpful if you're not sure whether the translation really reflects your original intentions. 20 | 21 | *(Note: this tutorial is a stub. Please expand it)* -------------------------------------------------------------------------------- /content/concepts/kata/satisfaction-rating.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Satisfaction Rating 3 | tags: [concept] 4 | --- 5 | 6 | 7 | _TBD: this page was imported from old CW wiki and needs to be reviewied/redacted._ 8 | 9 | The satisfaction rating is the score shown here: 10 | 11 | ![Satisfaction Rating](https://www.evernote.com/l/AAU2GBEeCMZLGJZ1EJDQIAC1mbCwW8HWARcB/image.png) 12 | 13 | It indicates the number of satisfied users. This score is derived from the votes shown after you complete a kata. You can either vote very, somewhat or not satisfied, as shown here: 14 | 15 | ![Voting](https://www.evernote.com/l/AAUwNziPnz5PE7VBi9V0y1qIAdHFT_q4mGIB/image.png) 16 | 17 | ## How should I interpret these votes? 18 | 19 | - If you got a lot of value out of the kata and found it to be well constructed, you should vote "Very" 20 | - If you got some value out of the kata but the quality may not be top notch, you should vote "Somewhat" 21 | - If you got no value out of the kata, in regards to enjoyment, education experience, etc, then you should pick "None". 22 | 23 | #### A special note about the "None" vote 24 | 25 | If you think the kata itself is valuable but you simply have some issues with it, then you should select "Somewhat" and create an issue instead. If you thought the kata is really great, other than the issues, then you can choose "Very". Please do not choose "None" simply because the kata has an issue but it is otherwise a good kata. The satisfaction rating is meant to indicate quality of kata as a concept, not its current state of condition in terms of open issues. 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@codewars/docs", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "format": "prettier --write .", 7 | "lint:format": "prettier --check .", 8 | "docusaurus": "docusaurus", 9 | "start": "docusaurus start", 10 | "build": "docusaurus build", 11 | "swizzle": "docusaurus swizzle", 12 | "deploy": "docusaurus deploy", 13 | "clear": "docusaurus clear", 14 | "serve": "docusaurus serve", 15 | "write-translations": "docusaurus write-translations", 16 | "write-heading-ids": "docusaurus write-heading-ids" 17 | }, 18 | "dependencies": { 19 | "@docusaurus/core": "^2.0.0-beta.21", 20 | "@docusaurus/preset-classic": "^2.0.0-beta.21", 21 | "@mdx-js/react": "^1.6.21", 22 | "@tabler/icons": "^1.40.2", 23 | "clsx": "^1.1.1", 24 | "copy-text-to-clipboard": "^3.0.1", 25 | "react": "^17.0.1", 26 | "react-dom": "^17.0.1" 27 | }, 28 | "browserslist": { 29 | "production": [ 30 | ">0.5%", 31 | "not dead", 32 | "not op_mini all" 33 | ], 34 | "development": [ 35 | "last 1 chrome version", 36 | "last 1 firefox version", 37 | "last 1 safari version" 38 | ] 39 | }, 40 | "devDependencies": { 41 | "autoprefixer": "^10.2.5", 42 | "netlify-plugin-cache": "^1.0.3", 43 | "postcss": "^8.2.13", 44 | "postcss-nested": "^5.0.5", 45 | "postcss-preset-env": "^6.7.0", 46 | "prettier": "^2.2.1", 47 | "shiki": "^0.10.1", 48 | "tailwindcss": "^2.2.2", 49 | "unist-util-visit": "^2.0.3" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /content/languages/julia/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Julia 3 | description: Julia on Codewars 4 | slug: /languages/julia 5 | tags: [julia] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | - 1.0 16 | - 1.5 17 | 18 | ## Test Frameworks 19 | 20 | [FactCheck](https://github.com/codewars/FactCheck.jl) 21 | 22 | ### Minimum Example 23 | ```julia 24 | module Adder 25 | export add 26 | function add(a, b) 27 | a + b 28 | end 29 | end 30 | ``` 31 | ```julia 32 | using FactCheck 33 | facts("add") do 34 | @fact Adder.add(1, 1) --> 2 35 | end 36 | ``` 37 | 38 | ### With Random Tests 39 | ```julia 40 | using FactCheck 41 | using .Solution 42 | 43 | facts("multiply") do 44 | context("fixed tests") do 45 | @fact multiply(2, 2) --> 4 46 | @fact multiply(1, 1) --> 1 47 | @fact multiply(3, 2) --> 6 48 | end 49 | 50 | context("random tests") do 51 | for _ = 1:100 52 | a = rand(-100:100) 53 | b = rand(-100:100) 54 | # Note that the string after the assertions is for custom error message, 55 | # but used as test case name on Codewars. 56 | @fact multiply(a, b) --> a*b "multiply($(a), $(b))" 57 | end 58 | end 59 | end 60 | ``` 61 | 62 | ## Timeout 63 | 12 seconds 64 | 65 | ## Packages 66 | ### 1.5 67 | ```toml 68 | [deps] 69 | DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" # version = "0.18.9" 70 | IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" # version = "1.3.0" 71 | Lazy = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0" # version = "0.15.1" 72 | ``` 73 | 74 | ## Services 75 | None 76 | 77 | ## Language ID 78 | 79 | `julia` 80 | -------------------------------------------------------------------------------- /content/authoring/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Authoring Content 3 | slug: /authoring 4 | tags: [authoring] 5 | --- 6 | 7 | All content available on Codewars is created by members of the Codewars community. It's ideas of Codewars users that get turned into kata, and the fact that users are familiar with plenty of programming languages allows for a large number of available translations. 8 | 9 | This section of the documentation is meant mostly for authors and translators who would like to introduce new challenges and make them available for other Codewars users. Creating a kata or translating it, even an easy one, is a difficult task. It requires a much wider set of skills compared to that of just solving a kata. Unlike problem solvers, authors need to master skills related to software development in general, as well as problem design, writing good test suites, documenting the task and its requirements, and communicating with reviewers. 10 | 11 | To support users in creating good quality kata and translations, a set of help pages were created with articles related to content authoring activities: tutorials explaining how to create and translate a kata, and a reference of [guidelines][authoring-guidelines] and requirements that every author should follow to make sure that a piece of content created by them meets quality criteria. 12 | 13 | For more details, see help pages related to creating a specific type of content: 14 | - [Creating a kata][authoring-kata] 15 | - [Creating a translation][authoring-translation] 16 | 17 | [authoring-guidelines]: /authoring/guidelines/ 18 | [authoring-kata]: /authoring/kata/ 19 | [authoring-translation]: /authoring/translation/ 20 | -------------------------------------------------------------------------------- /content/languages/java/junit.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: JUnit 3 | tags: [java, reference, testing] 4 | --- 5 | 6 | You can use JUnit [4](https://junit.org/junit4/) or [5](https://junit.org/junit5/) in Codewars. 5 offers nesting, pretty name display and multiple test classes. 7 | 8 | Note that JUnit assertions use `(expected, actual)` parameter ordering rather than the typical `(actual, expected)`. 9 | 10 | ## Basic Setup 11 | 12 | ### Example solution 13 | 14 | ```java 15 | public class Adder { 16 | public static int add(int a, int b) { 17 | return a + b; 18 | } 19 | } 20 | ``` 21 | 22 | ### JUnit 4 23 | 24 | ```java 25 | import org.junit.Test; 26 | import static org.junit.Assert.assertEquals; 27 | 28 | public class AdderTests { 29 | @Test 30 | public void testAdd() { 31 | assertEquals(3, Adder.add(1, 2)); 32 | } 33 | } 34 | ``` 35 | 36 | ### JUnit 5 37 | 38 | ```java 39 | import org.junit.jupiter.api.DisplayName; 40 | import org.junit.jupiter.api.Nested; 41 | import org.junit.jupiter.api.Test; 42 | import static org.junit.jupiter.api.Assertions.assertEquals; 43 | 44 | @DisplayName("Testing Adder") 45 | class AdderTests { 46 | @Test 47 | @DisplayName("Adder.add(1, 1) returns 2") 48 | void testPositives() { 49 | assertEquals(2, Adder.add(1, 1), "1 + 1 should equal 2"); 50 | } 51 | 52 | @Nested 53 | @DisplayName("Negative Integers") 54 | class NegativeTests { 55 | @Test 56 | @DisplayName("Adder.add(-1, -1) returns -2") 57 | void testNegatives() { 58 | assertEquals(-2, Adder.add(-1, -1), "-1 + -1 should equal -2"); 59 | } 60 | } 61 | } 62 | ``` 63 | -------------------------------------------------------------------------------- /__tmp__/popups/tips-advanced-code-fencing.md: -------------------------------------------------------------------------------- 1 | --- 2 | subject: "Tips: Advanced Code Fencing" 3 | on: 4 | paths: 5 | - /translation/new 6 | --- 7 | 8 | The description for a translation is shared between all languages for a kata. There are some enhanced markdown options available to allow you to selectively show content based off of the language - including a recently introduced ability to use `if` and `if-not` statements. 9 | 10 | ## Basic Code Block Filtering: 11 | 12 | The easiest way to provide language specific content is when providing language specific code examples. If you simply place language examples on top of each other, only the one related to the current language will be shown. 13 | 14 | ```` 15 | ```javascript 16 | function example(){ 17 | // only shown if javascript is active 18 | } 19 | ``` 20 | ```ruby 21 | def example 22 | # only shown if ruby is active 23 | end 24 | ``` 25 | ```` 26 | 27 | ## Filterable Markdown Blocks 28 | 29 | A newer feature on Codewars is the ability to filter entire sections of markdown using `if` and `if-not` statements. These statements are also used with code blocks. The following examples try to illustrate different ways in which you can use these statements. 30 | 31 | ```` 32 | ~~~if:javascript,ruby 33 | This content will only be shown if javascript or ruby are active. 34 | 35 | > A few things to note: 36 | - Markdown is still available to be used within these code blocks 37 | ~~~ 38 | ~~~if-not:ruby 39 | This markdown will only be shown if ruby **is not** the active language. 40 | ```javascript 41 | // still only shown if javascript is the active language, since it has multiple examples next to it 42 | ``` 43 | ```python 44 | # only shown if python is active 45 | ``` 46 | ~~~ 47 | ```` 48 | -------------------------------------------------------------------------------- /content/community/moderation/tools.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Community Moderation Tools 3 | sidebar_label: Moderation Tools 4 | tags: [reference] 5 | slug: /community/moderation/tools 6 | --- 7 | 8 | [Moderators](/community/moderation/#moderators) are a group of users selected to support other users with handling problems related to content and the community. They have access to tools and features not available to regular users, which can be used to solve problems reported by community members. In particular, moderators can: 9 | 10 | - Handle problematic users, cheaters, and griefers: 11 | - Handle reports about dishonest users 12 | - Flag solutions as cheat 13 | - Revoke privileges related to authoring 14 | - Remove dubious votes on beta kata 15 | - Manually fix effects of some bugs: 16 | - Revalidate solutions which do not pass tests anymore but haven't been invalidated automatically 17 | - Force recalculation of broken satisfaction rating on beta kata 18 | - Force solutions affected by the grouping bug to appear on the kata solutions page 19 | - Ensure quality of content: 20 | - Unpublish unapprovable or severely broken beta kata 21 | - Hide solutions which can be considered spoilers from kata solutions page (for example a highly optimized solution to an easy version of a 7 kyu kata which can be used to solve 2 kyu, challenge version) 22 | - Approve changes to documentation 23 | - Manage Codewars repositories, boards, and chats: 24 | - [codewars/codewars.com](https://github.com/codewars/codewars.com) GitHub repository 25 | - [codewars/docs](https://github.com/codewars/docs) GitHub repository 26 | - [codewars/content-issues](https://github.com/codewars/content-issues) GitHub repository 27 | - [Codewars Discord server](https://discord.gg/7U9t33jrgG) 28 | -------------------------------------------------------------------------------- /content/languages/elm/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Elm 3 | description: Elm on Codewars 4 | slug: /languages/elm 5 | tags: [elm] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | 0.19 12 | 13 | ## Test Frameworks 14 | 15 | [elm test](https://github.com/elm-explorations/test) 16 | 17 | ### Example 18 | 19 | The name of the solution module can be anything. 20 | Extra module can be provided in preloaded section. 21 | 22 | ```elm 23 | module Example exposing (..) 24 | 25 | add : Int -> Int -> Int 26 | add x y = x + y 27 | ``` 28 | 29 | ```elm 30 | module ExampleTest exposing (..) 31 | 32 | import Expect exposing (Expectation) 33 | import Test exposing (..) 34 | 35 | import Example 36 | 37 | suite : Test 38 | suite = 39 | describe "Example" 40 | [ test "add" <| 41 | \_ -> 42 | Example.add 1 1 43 | |> Expect.equal 2 44 | ] 45 | ``` 46 | 47 | `Fuzz` can be used for property based testing: 48 | 49 | ```elm 50 | module ExampleTest exposing (..) 51 | 52 | import Expect exposing (Expectation) 53 | import Test exposing (..) 54 | import Fuzz 55 | 56 | import Example 57 | 58 | suite : Test 59 | suite = 60 | describe "Example" 61 | [ fuzz2 Fuzz.int Fuzz.int "add" <| 62 | \a b -> 63 | Example.add a b 64 | |> Expect.equal (a + b) 65 | ] 66 | ``` 67 | 68 | ## Timeout 69 | 70 | 12 seconds 71 | 72 | ## Packages 73 | 74 | - `elm/core` 75 | - `elm-community/array-extra` 76 | - `elm-community/basics-extra` 77 | - `elm-community/dict-extra` 78 | - `elm-community/list-extra` 79 | - `elm-community/maybe-extra` 80 | - `elm-community/random-extra` 81 | - `elm-community/string-extra` 82 | - `elm-explorations/test` 83 | 84 | ## Services 85 | 86 | None 87 | 88 | ## Language ID 89 | 90 | `elm` 91 | -------------------------------------------------------------------------------- /content/languages/riscv/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: RISC-V 3 | sidebar_label: Overview 4 | slug: /languages/riscv 5 | --- 6 | 7 | ## Status 8 | 9 | Beta 10 | 11 | ## Version 12 | 13 | QEMU Toolchain: QEMU 7.1, GCC 11.3.0, Binutils 2.38 14 | 15 | ISA String: RV64GCV_Zba_Zbb_Zbc_Zbs_Zbkx_Zk_Zks 16 | 17 | Codewars uses [QEMU user mode emulation](https://www.qemu.org/docs/master/user/main.html) to support RISC-V content. Codewars is configured to use the following extensions for RISC-V: 18 | - `G` - General-Purpose* 19 | - `C` - Compressed* 20 | - `V` - Vector*† 21 | - Zb* - Bit-Manipulation 22 | - `Zba` - Address Generation 23 | - `Zbb` - Basic 24 | - `Zbc` - Carry-less 25 | - `Zbs` - Single-bit 26 | - Cryptography - Scalar§ 27 | - `Zbkx` - Crossbar permutation 28 | - `Zk` - Standard 29 | - `Zks` - ShangMi 30 | 31 | The most recent version of the specification for each can be downloaded below (as of 26 Dec 2023): 32 | - *RISC-V Unprivileged Specification 33 | - Vector Extension Specification 34 | - Bit-Manipulation Extension Specification 35 | - §Cryptography Extension Specification 36 | 37 | ## Test Frameworks 38 | 39 | [Cgreen](https://cgreen-devs.github.io/cgreen/) 40 | 41 | ## Timeout 42 | 43 | 12 seconds 44 | 45 | ## Packages 46 | 47 | Cgreen test framework (`libcgreen`) 48 | 49 | ## Services 50 | 51 | None 52 | 53 | ## Language ID 54 | 55 | `riscv` 56 | -------------------------------------------------------------------------------- /content/getting-started/registering.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Sign up to Codewars 3 | --- 4 | 5 | You’ve decided to join Codewars; that’s great! If you need help signing up, follow these steps to create your new account and start solving tasks (Kata), learning, and improving your programming skills!  6 | 7 | ## How to sign up  8 | First, go to our [sign-up](https://www.codewars.com/join) page. Here, you will have the option to create a Codewars account in one of two ways;   9 | 1. Type your username and email address, and create a password. 10 | 2. Sign up using your GitHub Account.   11 |   12 | **Important note:** 13 | Once your account is set up, you will receive an email asking to confirm your email address. Please be aware that certain features on Codewars will be limited until your account is confirmed. Check your spam folder if you cannot find the email in your inbox. 14 | 15 | If you can’t find this email, you can request it again by logging into your account, heading to your ‘account settings,’ and selecting ‘resend.’   16 |   17 | ## Establish your training settings  18 | Once you have signed up, you can select some training settings on Codewars. These settings will help us recommend challenges (Kata) to you and provide you with more opportunities on Codewars. These settings allow you to tell us how much programming experience you have, what languages you have experience in, and what programming languages you wish to train in (e.g., what languages you will challenge yourself with Codewars Kata).  19 |   20 | ## What’s next?  21 | Once your training settings have been saved, you will be brought to your training dashboard. Here, you will find your allies (accounts you follow or members of your [Clan](https://docs.codewars.com/community/following/#clans)), the latest comments on Codewars, and, most importantly, your [next challenge to solve](https://docs.codewars.com/getting-started/finding-kata/).  22 |   23 | You’re now ready to train on Codewars; enjoy! 24 | -------------------------------------------------------------------------------- /content/authoring/translation.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Translating a Kata 3 | tags: [authoring] 4 | --- 5 | 6 | _TBD: improve this stub_ 7 | 8 | New translators may refer to the [tutorial(TODO)](/authoring/translation/). 9 | 10 | Some [languages](/languages/) also have a page dedicated to authoring kata, with code examples and best practices. 11 | 12 | Every translator should follow [translation authoring guidelines](/authoring/guidelines/translation/). 13 | 14 | After being published, every translation goes through a series of [reviews](/curation/translation/) before it can be approved. 15 | 16 | 33 | 34 | [sequential-code-blocks]: /references/markdown/extensions/#sequential-code-blocks 35 | [conditional-rendering]: /references/markdown/extensions/#conditional-rendering 36 | -------------------------------------------------------------------------------- /content/getting-started/kata-solved.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: After Solving a Kata 3 | --- 4 | 5 | Finally, this great moment happened: the test output panel is all green, and you were able to submit your solution. Congratulations! It's time to collect your reward. It's also a good time to share some feedback, to guide others who'd encounter the same kata. 6 | 7 | ## Rewards 8 | 9 | You worked hard to solve your last challenge, and after you succeeded, you definitely deserve a reward. Each solved tasks rewards you in two ways: progressing your rank, and granting some amount of Honor points. The more difficult kata you solve, the bigger the reward. 10 | 11 | ### Rank 12 | 13 | The rank level reflects your experience and knowledge you have gained by solving kata. You start at the lowest rank of 8 kyū, and each correct solution brings you closer to a higher rank. You can see your rank progress toward the next level on your profile page: 14 | 15 | ![Rank Progress](./img/solving_01_rank-progress_light.png#gh-light-mode-only) 16 | ![Rank Progress](./img/solving_01_rank-progress_dark.png#gh-dark-mode-only) 17 | 18 | More information on ranks and progress can be found [here](/gamification/ranks/). 19 | 20 | ### Honor 21 | 22 | Honor points are rewarded by contributing to Codewars in many ways, and solving a kata is one of them. By earning Honor points, you gain additional [privileges](/gamification/privileges/) and climb [leaderboards](gamification/honor#leaderboards-and-honor-percentile). 23 | 24 | ## Feedback 25 | 26 | After you have successfully solved a task, you can let others know how you liked it. One way to do this is to leave your satisfaction vote: 27 | 28 | ![Satisfaction Vote](./img/solving_02_vote_light.png#gh-light-mode-only) 29 | ![Satisfaction Vote](./img/solving_02_vote_dark.png#gh-dark-mode-only) 30 | 31 | You can also participate in the discussion on a kata. If you wish to log an issue about this specific kata, such as poorly worded descriptions or issues with test cases, then you can leave a comment in the discourse section. More on this in the next part. 32 | -------------------------------------------------------------------------------- /content/languages/powershell/pester.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - powershell 4 | - reference 5 | - testing 6 | --- 7 | 8 | # Pester 9 | 10 | ## Basic Setup 11 | 12 | ### Solution 13 | 14 | ```powershell 15 | function Add-Numbers($a, $b) { 16 | return $a + $b 17 | } 18 | ``` 19 | 20 | ### Tests 21 | 22 | ```powershell 23 | BeforeAll { 24 | . $PSCommandPath.Replace(".Tests.ps1", ".ps1") 25 | } 26 | 27 | Describe "Add-Numbers" { 28 | It "adds positive numbers" { 29 | Add-Numbers 1 1 | Should -Be 2 30 | } 31 | It "adds negative numbers" { 32 | Add-Numbers 1 -6 | Should -Be -5 33 | } 34 | } 35 | ``` 36 | 37 | ## Improving Logging 38 | 39 | Because Pester doesn't provide a way to log extra information (and outputting from the solution interferes with the actual returned value), debugging on Codewars can be difficult. `Write-Host` somewhat works by bypassing Pester. But all of the logs will be shown at the top and not inside each test cases like many of the other languages. 40 | 41 | Tests like the following can help minimize the frustration: 42 | 43 | ```powershell 44 | Describe "Multiply" { 45 | Context "Fixed Tests" { 46 | # Parameterized test 47 | It "Multiply is

" -TestCases @( 48 | @{ a = 2; b = 2; p = 4 } 49 | @{ a = 1; b = 1; p = 1 } 50 | @{ a = 2; b = 3; p = 6 } 51 | @{ a = 3; b = 2; p = 6 } 52 | ) { 53 | param ($a, $b, $p) 54 | Multiply $a $b | Should Be $p 55 | } 56 | } 57 | Context "Random Tests" { 58 | # try to generate useful test case names because 59 | # inspecting the arguments is difficult 60 | $rand = New-Object System.Random 61 | For ($i=0; $i -lt 100; $i++) { 62 | $a = $rand.next(1, 100) 63 | $b = $rand.next(1, 100) 64 | $p = $a * $b 65 | It("Multiply $($a) $($b) is $($p)") { 66 | Multiply $a $b | Should Be $p 67 | } 68 | } 69 | } 70 | } 71 | ``` 72 | 73 | 78 | -------------------------------------------------------------------------------- /content/languages/ruby/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ruby 3 | description: Ruby on Codewars 4 | slug: /languages/ruby 5 | tags: [ruby] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 2.5 12 | - 3.0 13 | 14 | ## Test Frameworks 15 | 16 | From Ruby 3.0, [RSpec](https://rspec.info/) is used under the hood: 17 | 18 | ```ruby 19 | # Defaults to the global `describe` for backwards compatibility, but `RSpec.desribe` works as well. 20 | describe "Example" do 21 | it "should return the sum" do 22 | expect(add(1, 1)).to eq(2), "failure message" 23 | # The following is still supported, but new tests should not use them. 24 | # Test.assert_equals(add(1, 1), 2, "failure message") 25 | end 26 | end 27 | ``` 28 | 29 | Note that if an assertion message is provided while using RSpec, actual and expected results have to be in that message otherwise the information will not be shown to the user. 30 | See [`rspec-expectations`](https://rspec.info/documentation/3.10/rspec-expectations/). 31 | 32 | Earlier versions use [Codewars Test Framework](https://github.com/Codewars/codewars.com/wiki/Codewars-Ruby-Test-Framework) with similar syntax. 33 | 34 | ## Timeout 35 | 36 | 12 seconds 37 | 38 | ## Packages 39 | 40 | 41 | 42 | ### Ruby MRI 2.5 43 | 44 | - activesupport (5.2.0) 45 | - factory_bot (4.8.2) 46 | - faker (1.8.7) 47 | - faraday (0.15.1) 48 | - mongo (2.5.3) 49 | - mongoid (6.2.0) 50 | - nokogiri (1.8.2) 51 | - pg (1.0.0) 52 | - rack (2.0.5) 53 | - rails (5.2.0) 54 | - redis (4.0.1) 55 | - rspec (3.7.0) 56 | - rspec-its (1.2.0) 57 | - sequel (5.8.0) 58 | - sinatra (2.0.1) 59 | - sqlite3 (1.3.13) 60 | - webmock (3.4.2) 61 | 62 | ### Ruby MRI 3.0.0 63 | 64 | - faker (2.17.0) 65 | - faraday (1.3.0) 66 | - mongo (2.14.0) 67 | - nokogiri (1.11.2) 68 | - pg (1.2.3) 69 | - rack (2.2.3) 70 | - rack-test (1.1.0) 71 | - redis (4.2.5) 72 | - rspec (3.10.0) 73 | - sequel (5.42.0) 74 | - sinatra (2.1.0) 75 | - sqlite3 (1.4.2) 76 | - webmock (3.12.2) 77 | 78 | ## Services 79 | 80 | - sqlite 81 | - redis 82 | - mongodb 83 | 84 | ## Language ID 85 | 86 | `ruby` 87 | -------------------------------------------------------------------------------- /content/concepts/kata/solutions.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Solutions 3 | tags: [concept] 4 | --- 5 | 6 | Each time a warrior completes a kata within a given language, their solution is added to the list of successful solutions for that particular language. After completing a kata you are immediately taken to this page, often giving you an Aha! moment when you realize how others have completed the same task. This moment can be incredibly enlightening if you come across solutions that had a different approach than yours. 7 | 8 | ## Who can see solutions? 9 | 10 | Code Warriors are able to view the solutions to a kata under one of the following two conditions: 11 | 12 | 1. They have completed the kata: Once you have completed all of the tests and submitted your final version, you will be taken to the solutions page. 13 | 2. They have forfeited their honor: If you choose to give up on the kata, you can click the `Unlock Solutions` button within the kata trainer. This will forfeit any honor and rank progression that you could earn on the kata. You will then be taken to the solutions page. 14 | 15 | ## Solution Groupings 16 | 17 | A basic algorithm is used to try to match new solutions to existing ones, so that the list does not become littered with duplicate solutions. Basic syntax structures, comments, and in some cases, alias method names, will be removed so that solutions can be compared. 18 | 19 | When two or more solutions are grouped, then the first submitted one is used as a representative solution from this group and presented on the `Solutions` page. 20 | 21 | ## Solution page 22 | 23 | TBD 24 | 25 | ## Voting 26 | 27 | TBD 28 | 29 | ## Comments 30 | 31 | TBD 32 | 33 | ## Forking solutions 34 | 35 | TBD 36 | 37 | ## Invalid solutions (?) 38 | 39 | TBD 40 | 41 | - Penalty for invalidation 42 | - Automatic invalidation 43 | - Manual verification (?) 44 | 45 | ## Where to see solutions 46 | 47 | TBD 48 | 49 | - `Solutions` tab on kata 50 | - Solution page 51 | - Discourse `View solution` collapsible 52 | - `Solutions` tab in profile (`Refactor` button) 53 | - `Past solutions` tab in trainer 54 | -------------------------------------------------------------------------------- /__tmp__/popups/tips-kata-translations.md: -------------------------------------------------------------------------------- 1 | --- 2 | subject: "Tips: Kata Translations" 3 | on: 4 | paths: 5 | - /translation/new 6 | --- 7 | 8 | Kata translations are a great way of gaining honor, plus you are contributing to the overall community! A few things to remember: 9 | 10 | ### Description - Language Examples 11 | 12 | You may need to edit the description to provide info for the new language you are translating. This description field is **shared across all languages**. 13 | 14 | If the kata has language examples within the description, **DO NOT REPLACE THESE**. Instead you should add examples for the language you are translating directly underneath the other examples. When taking the kata, the other languages will be filtered out automatically. 15 | 16 | **Do not forget to add language examples!**. This is important. Your translation cannot be approved without them. If the kata description is so generic that no specific language examples are included, then you do not need to add any. 17 | 18 | ### Example Test Cases 19 | 20 | Please try to include example test cases, even if they were not included in some of the existing languages. For some rare kata they may not make sense but usually other Codewarriors will appreciate the kata much more if there are example test cases provided for them. 21 | 22 | ### Translations must be approved 23 | 24 | Once you publish your translation either a moderator or the kata author will approve it. A notification will be sent out, but sometimes translators like to leave a comment on the kata as well just so everyone knows. 25 | 26 | ## Description Tips: 27 | 28 | In the kata description you will sometimes need to provide language specific examples. You can use three backticks (fences) to do so. i.e: 29 | 30 | ```` 31 | ```javascript 32 | function example(){ 33 | } 34 | ``` 35 | ```` 36 | 37 | If the kata already has languages examples, do not delete them. Instead append your language example to the bottom of the existing ones, like so: 38 | 39 | ```` 40 | ```javascript 41 | function example(){ 42 | } 43 | ``` 44 | ```ruby 45 | def example 46 | end 47 | ``` 48 | ```` 49 | -------------------------------------------------------------------------------- /content/concepts/kumite.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What is Kumite? 3 | tags: [concept] 4 | --- 5 | 6 | :::note 7 | This page was imported from old Codewars wiki and needs to be reviewied/redacted. 8 | ::: 9 | 10 | In karate, kumite (ko͞omiˌtā) is the practice of taking techniques learned from kata and applying them through the act of freestyle sparring. Continuing with the coding dojo theme, and the already well established concept of a code kata, we wanted to play with the idea of what a code kumite might look like within the Codewars community. It is a social experiment to see how developers could share ideas and then respond to them with code instead of just words. 11 | 12 | ## How does it work? 13 | 14 | Creating a new kumite will involve creating some code, with an optional description and set of test cases that prove it works. Once published, the code provided will be considered the first "move". You and any other user are then able to respond to that move with your own. You do this by "forking" the original move. Your fork can refactor the original code, add features, fix bugs, add additional tests, etc. Any fork can then also be forked, creating a series of moves that happen between 1 or more participants. 15 | 16 | ## What do I use this for? 17 | 18 | Lots of things really. You could show off something you learned, only to have others show you an even more efficient way of doing the same thing. Maybe you have discovered an interesting and experimental design pattern in your favorite language and want to show it off, where others could then expand on the idea. You could use it for teaching - Kata are great for well-defined problems, but when a solution is open to many interpretations you could allow your students to experiment with how they would approach it in their own way. 19 | 20 | One popular use-case for kumite is to use it as a starting point for fleshing out a new kata. You can convert your kumite to a kata. When you convert it, the kumite will no longer be published or searchable. 21 | 22 | We look forward to seeing what the Codewars community comes up with! How would you utilize this format for something interesting? 23 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const colors = require("tailwindcss/colors"); 2 | const plugin = require("tailwindcss/plugin"); 3 | 4 | module.exports = { 5 | mode: "jit", 6 | purge: [ 7 | "./src/**/*.{js,jsx,ts,tsx}", 8 | // Don't look in `content/` for now because this can generate unnecessary classes and also cause issues. 9 | // For example, Prism adds `table` class to a token in TOML, and because some pages uses the word `table`, 10 | // `.table` is generated, and that token gets `display: table`. 11 | // "./content/**/*.mdx", 12 | ], 13 | corePlugins: { 14 | preflight: false, 15 | }, 16 | // Using custom dark variant `html[data-theme="dark"]` to match Docusaurus. 17 | darkMode: false, 18 | theme: { 19 | extend: { 20 | colors: { 21 | brand: "#b1361e", 22 | amber: colors.amber, 23 | fuchsia: colors.fuchsia, 24 | pink: colors.pink, 25 | // Admonitions colors 26 | note: colors.coolGray[600], 27 | "note-content": colors.coolGray[600], 28 | "note-content-dark": colors.coolGray[400], 29 | tip: colors.emerald[700], 30 | "tip-content": colors.emerald[700], 31 | "tip-content-dark": colors.emerald[500], 32 | info: colors.sky[600], 33 | "info-content": colors.sky[700], 34 | "info-content-dark": colors.sky[500], 35 | warning: colors.orange[600], 36 | "warning-content": colors.orange[700], 37 | "warning-content-dark": colors.orange[500], 38 | caution: colors.red[500], 39 | "caution-content": colors.red[700], 40 | "caution-content-dark": colors.red[400], 41 | }, 42 | }, 43 | }, 44 | variants: { 45 | extend: { 46 | backgroundColor: ["dark"], 47 | textColor: ["dark"], 48 | display: ["dark"], 49 | }, 50 | }, 51 | plugins: [ 52 | plugin(({ addVariant, e }) => { 53 | addVariant("dark", ({ modifySelectors, separator }) => { 54 | modifySelectors(({ className }) => { 55 | return `html[data-theme="dark"] .${e( 56 | `dark${separator}${className}` 57 | )}`; 58 | }); 59 | }); 60 | }), 61 | ], 62 | }; 63 | -------------------------------------------------------------------------------- /__tmp__/popups/kumite.md: -------------------------------------------------------------------------------- 1 | --- 2 | subject: "Welcome to Kumite!" 3 | teaser: | 4 | Kumite is a long running experiment on Codewars to see what happens when Codewarriors "spar" with each other. 5 | on: 6 | paths: 7 | - /kumite$ 8 | --- 9 | 10 | ## What is Kumite? 11 | 12 | In karate, kumite (ko͞omiˌtā) is the practice of taking techniques learned from kata and applying them through the act of freestyle sparring. Continuing with the coding dojo theme, and the already well established concept of a code kata, we wanted to play the idea of what a code kumite would look like within the Codewars community. It is a social experiment to see how developers could share ideas and then respond to them with code instead of just words. 13 | 14 | ## How does it work? 15 | 16 | Creating a new kumite will involve creating some code, with an optional description and set of test cases that prove it works. Once published, the code provided will be considered the first "move". You and any other code warrior are then able to respond to that move with your own. You do this by "forking" the original move. Your fork can refactor the original code, add features, fix bugs, add additional tests, etc. Any fork can then also be forked, creating a series of moves that happen between 1 or more participants. 17 | 18 | ## What do I use this for? 19 | 20 | Lots of things really. You could show off something you learned, only to have others show you an even more efficient way of doing the same thing. Maybe you have discovered an interesting and experimental design pattern in your favorite language and want to show it off, where others could then expand on the idea. You could use it for teaching - Kata are great for well defined problems, but when a solution is open to many interpretations you could allow your students to experiment with how they would approach it in their own way. 21 | 22 | One popular use-case for kumite is to use it as a starting point for fleshing out a new kata. You can convert your kumite to a kata. When you convert it, the kumite will no longer be published or searchable. 23 | 24 | We look forward to seeing what the Codewars community comes up with! How would you utilize this format for something interesting? 25 | -------------------------------------------------------------------------------- /content/authoring/guidelines/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Content Authoring Guidelines 3 | tags: [authoring, reference] 4 | slug: /authoring/guidelines 5 | --- 6 | 7 | ## Overview 8 | 9 | This set of pages contains guidelines for kata authors and translators to help them create kata, translations, and kumite which adhere to the community's quality standards. 10 | 11 | The guidelines should be used by kata authors and translators to verify whether new content about to be introduced to Codewars is of sufficient quality. Conformity to these guidelines is a prerequisite for publishing a kata, translation, or kumite. 12 | 13 | Some of these guidelines do not apply to every type of content. There are code-golf kata, puzzle kata, hack-mes, debugging kata, and many other problems which are designed on the grounds of ignoring some of the guidelines. They should be used where applicable, and can be skipped when they are not. But this should not be treated as an excuse for taking shortcuts or skipping the necessary work: the fact that some of the guidelines are not relevant should be clearly visible from the task. 14 | 15 | :::warning Important note 16 | Failure to comply with the guidelines should be considered an issue to be addressed and reported. In case of severe violations, the affected kata or translation may be retired, moved back to beta, or rejected. 17 | 18 | Authors who repeatedly violate or ignore rules and introduce poor-quality content to the system can have their authoring privileges revoked and offending content withdrawn. 19 | ::: 20 | 21 | ## General Guidelines 22 | 23 | - **Conform to quality guidelines when creating new content.** Do not take shortcuts, don't be lazy. Know what are quality requirements for kata, translations, descriptions, and code. Do not push your responsibility to reviewers. 24 | - **Keep responsibility for all content you created.** You should actively maintain all content you introduced into Codewars: fix issues, consider suggestions, answer questions. Be aware that other users are allowed to improve your content. 25 | - Remember that you can always **ask others for help.** Whenever you need someone to proofread your description, answer any questions about how Codewars works, or just give any advice on the content you're working on. 26 | -------------------------------------------------------------------------------- /content/languages/purescript/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: PureScript 3 | description: PureScript on Codewars 4 | slug: /languages/purescript 5 | tags: [purescript] 6 | --- 7 | 8 | 9 | ## Status 10 | 11 | Beta 12 | 13 | ## Versions 14 | 15 | - [0.12.x](https://github.com/purescript/purescript/releases/tag/v0.12.2) 16 | - [0.15.x](https://github.com/codewars/purescript/releases/tag/0.15.4.2) 17 | 18 | ## Test Frameworks 19 | 20 | [spec](https://purescript-spec.github.io/purescript-spec) 21 | 22 | ### Example 23 | 24 | The name of the solution module can be arbitrary. Extra module can be provided in preloaded code. 25 | ```purescript 26 | module Example where 27 | 28 | import Prelude 29 | 30 | add' :: Int -> Int -> Int 31 | add' x y = x + y 32 | ``` 33 | 34 | The name of the test module **must** end with `Spec`. 35 | ```purescript 36 | module ExampleSpec where 37 | 38 | import Prelude 39 | import Test.Spec (Spec, describe, it) 40 | import Test.Spec.Assertions (shouldEqual) 41 | 42 | import Example (add') 43 | 44 | spec :: Spec Unit 45 | spec = 46 | describe "Example" do 47 | describe "add'" do 48 | it "returns sum" do 49 | (add' 1 1) `shouldEqual` 2 50 | ``` 51 | QuickCheck is supported. 52 | ```purescript 53 | module QuickCheckExampleSpec where 54 | 55 | import Prelude 56 | import Test.QuickCheck ((===)) 57 | import Test.Spec (Spec, describe, it) 58 | import Test.Spec.QuickCheck (quickCheck) 59 | 60 | spec :: Spec Unit 61 | spec = 62 | describe "QuickCheck" do 63 | it "works" $ 64 | quickCheck \n -> (n * 2 / 2) === n 65 | ``` 66 | 67 | ## Timeout 68 | 69 | 12 seconds 70 | 71 | ## Packages 72 | 73 | - `prelude` 74 | - `console` 75 | - `debug` 76 | - `effect` 77 | - `bigints` 78 | - `rationals` 79 | - `profunctor-lenses` 80 | - `spec` 81 | - `spec-discovery` 82 | - `spec-quickcheck` 83 | 84 | Packages are managed with [`psc-package`](https://github.com/purescript/psc-package) using package set [`psc-0.12.2-20190119`](https://github.com/purescript/package-sets/tree/psc-0.12.2-20190119). See [`packages.json`](https://github.com/purescript/package-sets/blob/psc-0.12.2-20190119/packages.json) for versions. 85 | 86 | Feel free to [open issues](https://github.com/Codewars/codewars-runner-cli/issues/new) for additional packages. 87 | 88 | ## Services 89 | 90 | None 91 | 92 | ## Language ID 93 | 94 | `purescript` 95 | -------------------------------------------------------------------------------- /content/authoring/guidelines/preloaded.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Writing Preloaded Code 3 | tags: [authoring, reference] 4 | --- 5 | 6 | The preloaded code snippet, created by the kata author or translator, can be used to reduce boilerplate code, but can cause problems when used incorrectly. To ensure the quality of the kata, it should conform to a set of guidelines presented below. 7 | 8 | This article contains a set of guidelines for kata authors and translators to create good code snippets for their kata. They were collected to help ensure that kata and translations are of sufficient quality and kata maintenance will be as easy as possible. 9 | 10 | ## Accessibility of Preloaded Code 11 | 12 | - The preloaded code snippet is code, and, as such, should conform to [Codewars General Coding Guidelines][authoring-guidelines-general]. 13 | - **Do not put any code in preloaded which should not be called by the submitted solution.** Code placed in this snippet can be called (and for some languages even modified or redefined) by the submitted solution, and any data stored here can be read or modified programmatically. It should not contain anything critical used by tests to validate the correctness of the solution. 14 | - **Be aware that the user solution can read the preloaded code snippet**. It should not contain any information which would reveal details of the solution or tests. 15 | - **Do not hide useful information in the preloaded code snippet.** The preloaded code snippet can be used to reduce boilerplate, and its code is available to all other parts of the solution. It may be tempting to put data or types in preloaded code which should be shared among the user solution, sample tests, and submission tests. However, since the contents of the preloaded code are not displayed anywhere in the user interface, important information needed to solve the challenge may be hidden from the user. This is especially problematic for users who would like to work on the kata in their local IDE, but now are missing some pieces necessary to set up their local environment. If you use the preloaded code snippet to reduce boilerplate code, consider adding necessary information to the kata description as well, preferably in a [language conditional block][markdown-extensions]. 16 | 17 | 18 | [authoring-guidelines-general]: /authoring/guidelines/ 19 | [markdown-extensions]: /references/markdown/extensions/ 20 | -------------------------------------------------------------------------------- /docusaurus.config.js: -------------------------------------------------------------------------------- 1 | const { createHighlighter } = require("./src/remark/shiki"); 2 | 3 | /** @type {import('@docusaurus/types').DocusaurusConfig} */ 4 | module.exports = { 5 | title: "The Codewars Docs", 6 | tagline: "Achieve mastery through challenge", 7 | url: "https://docs.codewars.com", 8 | baseUrl: "/", 9 | onBrokenLinks: "throw", 10 | onBrokenMarkdownLinks: "warn", 11 | favicon: "favicon.ico", 12 | organizationName: "codewars", 13 | projectName: "docs", 14 | // https://docusaurus.io/docs/next/api/themes/configuration 15 | themeConfig: { 16 | docs: { 17 | sidebar: { 18 | hideable: true, 19 | }, 20 | }, 21 | colorMode: { 22 | defaultMode: "dark", 23 | }, 24 | algolia: { 25 | // Search only API key 26 | apiKey: "651420d53bdf2d24b6719c6777dc69a4", 27 | indexName: "codewars-docs", 28 | appId: "2O5VWTLFC8", 29 | contextualSearch: false, 30 | }, 31 | navbar: { 32 | title: null, 33 | hideOnScroll: true, 34 | logo: { 35 | alt: "Codewars Logo", 36 | src: "logo-light.svg", 37 | srcDark: "logo-dark.svg", 38 | href: "https://www.codewars.com/", 39 | }, 40 | items: [ 41 | { 42 | label: "Docs", 43 | activeBaseRegex: "/(?!search)", 44 | position: "left", 45 | to: "/", 46 | }, 47 | { 48 | href: "https://github.com/codewars", 49 | position: "right", 50 | className: "header-github-link", 51 | "aria-label": "GitHub", 52 | }, 53 | ], 54 | }, 55 | footer: { 56 | links: [], 57 | copyright: `Copyright © ${new Date().getFullYear()} Codewars`, 58 | }, 59 | }, 60 | presets: [ 61 | [ 62 | "@docusaurus/preset-classic", 63 | { 64 | docs: { 65 | path: "content", 66 | routeBasePath: "/", 67 | sidebarPath: require.resolve("./sidebars.js"), 68 | editUrl: "https://github.com/codewars/docs/edit/master/", 69 | beforeDefaultRemarkPlugins: [ 70 | createHighlighter({ 71 | themes: ["github-dark-dimmed", "github-light"], 72 | }), 73 | ], 74 | }, 75 | blog: false, 76 | theme: { 77 | customCss: require.resolve("./src/css/custom.css"), 78 | }, 79 | }, 80 | ], 81 | ], 82 | plugins: ["./sitePlugin.js"], 83 | }; 84 | -------------------------------------------------------------------------------- /content/concepts/kata.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What is Kata? 3 | tags: [concept] 4 | --- 5 | 6 | On Codewars, kata are code challenges focused on improving skill and technique. Some train programming fundamentals, while others focus on complex problem solving. Others are puzzles meant to test your creative problem solving, while others are based on real world coding scenarios. 7 | 8 | The term was first coined by [Dave Thomas](https://en.wikipedia.org/wiki/Dave_Thomas_%28programmer%29), co-author of the book [The Pragmatic Programmer](https://en.wikipedia.org/wiki/The_Pragmatic_Programmer) as an acknowledgment to the Japanese concept of kata in the martial arts. Dave's version of the concept defines a code kata as an exercise in programming which helps a programmer sharpen their skills through practice and repetition. 9 | 10 | ## Working with kata 11 | 12 | Codewars supports users in many ways so their training with kata is maximally effective: 13 | 14 | - They can set up one of available [training routines][training-routines]. 15 | - Users can run [test cases][kata-tests] against their solution and solve kata using Test Driven Development approach. 16 | - Users can take a part in a [discourse][kata-discussion] on every kata, to ask for help, or help others. 17 | - Kata can be bookmarked or grouped into [collections][kata-collections] for easier management, categorization, or sharing with others. 18 | - Users can view [solutions][kata-solutions] of other people after they manage to solve the kata or unlock them. 19 | 20 | ## Contributing to the site 21 | 22 | Users can also contribute to existing kata in various ways: 23 | 24 | - After a kata is solved, users can cast their [satisfaction vote][kata-satisfaction-rating] for a kata to let others know how they like it. 25 | - Users can solve [beta kata][kata-beta-process] to evaluate them before they get accepted. 26 | - Authors can create new kata and put them in [beta][kata-beta-process]. 27 | - Translators can [create new language versions][kata-translations] (translations) of kata. 28 | 29 | 30 | [training-routines]: /concepts/kata/training-routines/ 31 | [kata-tests]: /concepts/kata/tests/ 32 | [kata-discussion]: /concepts/kata/discourse/ 33 | [kata-collections]: /concepts/kata/collections/ 34 | [kata-solutions]: /concepts/kata/solutions/ 35 | [kata-satisfaction-rating]: /concepts/kata/satisfaction-rating/ 36 | [kata-beta-process]: /concepts/kata/beta-process/ 37 | [kata-translations]: /concepts/kata/translations/ 38 | -------------------------------------------------------------------------------- /content/languages/rust/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Rust 3 | description: Rust on Codewars 4 | slug: /languages/rust 5 | tags: [rust] 6 | --- 7 | 8 | 9 | ## Versions 10 | 11 | - 1.66 (`edition = "2021"`) 12 | 13 | The following profiles are used to get decent performance in tests: 14 | 15 | ```toml 16 | [profile.dev] 17 | opt-level = 1 18 | [profile.dev.package."*"] 19 | opt-level = 3 20 | 21 | [profile.test] 22 | opt-level = 1 23 | [profile.test.package."*"] 24 | opt-level = 3 25 | ``` 26 | 27 | ## Test Frameworks 28 | 29 | Rust kata use the built-in Rust support for testing, with test functions marked with `#[test]`. 30 | 31 | ## Example 32 | 33 | Solution and tests are concatenated to `src/lib.rs`. 34 | 35 | ```rust 36 | pub fn add(x: i32, y: i32) -> i32 { x + y } 37 | ``` 38 | 39 | All the tests _should_ be in a child module named `tests`: 40 | ```rust 41 | #[cfg(test)] 42 | mod tests { 43 | use super::*; 44 | #[test] 45 | fn adds_i32() { 46 | assert_eq!(add(1, 1), 2); 47 | } 48 | } 49 | ``` 50 | 51 | The optional preloaded code is a child module `preloaded` at `src/preloaded.rs`. 52 | Rust's module system is explicit, so you need to declare it with `mod preloaded;` to use it. 53 | 54 | See the unit testing chapter in [the book](https://doc.rust-lang.org/book/ch11-01-writing-tests.html) and 55 | [Rust By Example](https://doc.rust-lang.org/rust-by-example/testing/unit_testing.html) for more. 56 | 57 | [codewars/rust-devcontainer](https://github.com/codewars/rust-devcontainer) can be used if you'd like to solve locally. 58 | 59 | ## Timeout 60 | 12 seconds 61 | 62 | ## Packages 63 | 64 | ### 1.66 65 | 66 | ```toml 67 | [dependencies] 68 | bit-set = "0.5.3" 69 | chrono = "0.4.23" 70 | either = "1.8.0" 71 | fancy-regex = "0.10.0" 72 | futures = "0.3.25" 73 | im = "15.1.0" 74 | itertools = "0.10.5" 75 | lazy_static = "1.4.0" 76 | num = { version = "0.4.0", features = ["rand"] } 77 | once_cell = "1.16.0" 78 | rand = "0.8.5" 79 | regex = "1.7.0" 80 | serde = { version = "1.0.150", features = ["derive"] } 81 | serde_json = "1.0.89" 82 | text_io = "0.1.12" 83 | thiserror = "1.0.37" 84 | tokio = { version = "1.23.0", features = ["full"] } 85 | tokio-util = { version = "0.7.4", features = ["full"] } 86 | 87 | [dev-dependencies] 88 | quickcheck = "1.0.3" 89 | quickcheck_macros = "1.0.0" 90 | float_eq = "1.0.1" 91 | ``` 92 | 93 | ## Services 94 | 95 | None 96 | 97 | ## Language ID 98 | 99 | `rust` 100 | -------------------------------------------------------------------------------- /content/languages/factor/testest.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - factor 4 | - reference 5 | - testing 6 | --- 7 | 8 | # testest 9 | 10 | To run Factor tests, Codewars currently uses a custom test vocabulary, published and available in [this GitHub repository][test-framework-repo]. 11 | 12 | ## Basic Usage 13 | 14 | ```factor 15 | USING: solution-vocabulary tools.testest ; 16 | IN: solution-vocabulary.tests 17 | 18 | : run-tests ( -- ) 19 | "Example Tests" describe#{ 20 | "Example test case" it#{ 21 | <{ 1 1 add -> 2 }> 22 | }# 23 | 24 | "Another test case" it#{ 25 | <{ 3 double -> 6 }> 26 | <{ 0 double -> 0 }> 27 | }# 28 | }# 29 | 30 | MAIN: run-tests 31 | ``` 32 | 33 | ## Words and Syntax 34 | 35 | #### `describe#{` 36 | 37 | Starts a new block of tests, taking a string off the stack as the title of the block. Terminated with the `}#` word. 38 | 39 | #### `it#{` 40 | 41 | Starts a new test group, taking a string off the stack as the title of the block. Terminated with the `}#` word. 42 | 43 | #### `<{ ...inputs -> ...expected }>` 44 | 45 | Creates a unit test, by executing the values in `...inputs`, then executing the values in `...expected` and comparing the resulting stacks. If they match, the test is passed, otherwise the test is failed. On failure, the stacks are packed into a tuple (under `got` and `expected` slots, respectively) and pushed onto the stack to be available for the `test-failed.` quotation. 46 | 47 | #### `test-passed.` 48 | 49 | `test-passed.` is a symbol which is bound to a quotation with stack effect `( -- )`. When a unit test passes, this quotation will be called. This can be used to create [custom result messages](/languages/factor/authoring#custom-result-messages). 50 | 51 | #### `test-failed.` 52 | 53 | `test-passed.` is a symbol which is bound to a quotation with stack effect `( assert-sequence -- )`. When a unit test fails, the values on the left and right side of the test will be collected into sequences, and stored in tuple under slots `got` and `expected` respectively. This tuple will be pushed onto the stack, and then this quotation will be called. This can be used to create [custom result messages](/languages/factor/authoring#custom-result-messages). 54 | 55 | ## Acknowledgements 56 | 57 | `testest` was authored by [@nomennescio](https://github.com/nomennescio). 58 | 59 | [test-framework-repo]: https://github.com/codewars/testest 60 | 61 | 62 | 67 | -------------------------------------------------------------------------------- /content/concepts/kata/discourse.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Kata Discourse 3 | tags: [concept] 4 | --- 5 | 6 | 7 | _TBD: this page was imported from old CW wiki and needs to be reviewied/redacted._ 8 | 9 | Each kata has its own discourse page where you can discuss. This is also a place for you to log any issues, suggestions or questions. 10 | 11 | > TODO: complete 12 | 13 | ## Comment Labels 14 | 15 | There are 3 different labels that you can set on your comment. If you are just having normal conversation, you don't have to set a label - but please do if any of the following are relevant. 16 | 17 | ### Issues 18 | 19 | If you find an issue with the kata, such as broken test cases, buggy output or incorrect descriptions, please apply the `Issue` label to the comment. This will notify the author of any issues, as well as making it more obvious that there are problems with the content. 20 | Logging issues is OK for things like needing random test cases, or changes that are critical to completing the kata. _Keep an eye out for duplicates:_ please don't file the same issue as someone else. 21 | If you want to try to bump the issue, reply to the existing one instead - though commenting for the purpose of bring attention to the issue isn't necessary if it was recently created. 22 | 23 | ### Suggestions 24 | 25 | A suggestion is something that could be improved but isn't required to be. During the beta process suggestions are less common, though still relevant. Please see note above about the post-beta process. Use suggestions when the kata could be improved but there isn't a critical issue preventing warriors from completing it. 26 | 27 | ### Questions 28 | 29 | If you are struggling to complete the kata, you can go discuss it. Label your comment as a question so that others can more easily spot it as such. 30 | 31 | ## Spoiler Comments 32 | 33 | When you create a comment, there is an option for marking it as a spoiler. You should mark any comment as a spoiler if it contains code within it that might give the solution away to other users. 34 | 35 | If you don't remember to do it, other users can mark the comment as a spoiler later - but please try to remember to mark this yourself when appropriate. 36 | 37 | ## Resolving Comments 38 | 39 | Comments with labels can be resolved to indicate they are no longer relevant/active. The author of the original comment can do this, as well as the kata author, warriors with the "Resolve Comment" permission, and site admins. 40 | 41 | Resolving comments are important, especially during the beta process, because a kata cannot be approved unless all issues are resolved. 42 | -------------------------------------------------------------------------------- /content/curation/guidelines/translation.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Translation Reviewing Guidelines 3 | --- 4 | 5 | This article contains a set of guidelines, which can be used by reviewers to determine whether a pending translation meets quality requirements to be approved and become available for users to train on. They were collected to help ensure that translations are of sufficient quality and users' experience will be as good as possible. 6 | 7 | :::note 8 | The guidelines are to be followed by every user reviewing and potentially approving a translation, including the author of the translated kata. 9 | ::: 10 | 11 | ## Review 12 | 13 | - **The translation must be reviewed before it's approved.** If the reviewer is not familiar with the language of the translation, they should ask other users for help. 14 | - **The review should be as complete as possible,** including all applicable steps mentioned in [Curating a Translation HOWTO][howto-review-translation] 15 | - **Conformity to [translation authoring guidelines][guidelines-authoring-translation] should be verified.** All applicable guidelines should be followed by the translator. 16 | - Reviewers and users other than the original translator are allowed to **fix issues in pending translations.** 17 | 18 | 19 | ## Approval 20 | 21 | - A translation can be approved only if the review confirms that it is of sufficient quality, it holds to all applicable quality guidelines, and all reported issues have been addressed. 22 | - **Suggestion posts announcing the translation should be marked as resolved**. 23 | - **Approvers should keep responsibility for the issues in translations they approved.** You should actively maintain all problems which slipped through your review and ended up in an approved translation: fix issues, consider suggestions, answer questions. 24 | 25 | 26 | ## Rejection 27 | 28 | - If a translation has too many issues or cannot be easily fixed, and there's justified concern that it could be approved prematurely while not keeping up to quality standards, **it should be rejected**. 29 | - **Reason why the translation was rejected should be stated** in the translation comments section. 30 | - Translation does not have to be rejected and can be left in pending state if it has some issues, all of them are reported, but the translation cannot be approved without editing (for example, due to description merge conflict). 31 | 32 | ## Maintenance 33 | 34 | - After a translation is approved, it becomes **the responsibility of the translator and the kata author** to fix any potential issues which might come up later when users attempt to submit their solution. 35 | 36 | 37 | [guidelines-authoring-translation]: /authoring/guidelines/translation/ 38 | [howto-review-translation]: /curation/translation/#review 39 | -------------------------------------------------------------------------------- /content/curation/references/approval-retirement-criteria.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Criteria for Kata Approval and Retirement 3 | sidebar_label: Criteria for Approval and Retirement 4 | tags: [reference] 5 | --- 6 | 7 | ## Eligibility for Approval 8 | 9 | As an author gets more katas approved, they become established as an experienced kata maker, and less votes will be needed for their future kata to be approved. The following table lists the requirements for a beta kata to be able to be approved: 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
Average assessed rankRequired satisfaction %Required votes
(by number of author's approved kata)
<10<20<3030+
White80+121086
Yellow80+10875
Blue75+8654
Purple70+5433
62 | 63 | To determine whether a kata is eligible for approval, the following procedure is used: 64 | 65 | 1. There should be no pending issues. 66 | 1. `votes count` is calculated as the total amount of satisfaction votes cast on a kata. 67 | 1. `votes score` is calculated as the sum of votes multiplied by the [voting power](/gamification/privileges/) of the user. 68 | 1. `required votes` and minimum satisfaction rating are determined from the table above. 69 | 1. The kata is approvable when the requirement for minimum satisfaction rating is met and one of the following conditions is satisfied: `votes count >= required votes` or `votes count >= 3 AND votes score >= required votes`. 70 | 71 | To be able to approve a kata, the user needs to have [`Approve Kata` privilege](/gamification/privileges/). 72 | 73 | ## Auto-Retire 74 | 75 | Low-quality kata are automatically retired. Current rules are: 76 | 77 | 1. If 4 or more votes and satisfaction percent is `0` (4+ consecutive "Not Satisfied" as the only votes) 78 | 1. If a kata collected enough votes to be approved (see above) and the satisfaction rate is less than or equal to half of the required satisfaction. 79 | 1. If a kata needs 10 or more "Very Satisfied" votes in a row to reach the level of satisfaction required for approval. 80 | 81 | This feature needs improvement and any feedback is appreciated. Please comment on [#1672](https://github.com/codewars/codewars.com/issues/1672). 82 | -------------------------------------------------------------------------------- /content/authoring/guidelines/coding.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: General Kata Coding Guidelines 3 | tags: [authoring, reference] 4 | --- 5 | 6 | 7 | Coding guidelines can be a controversial topic for programmers. Programmers like them, and programmers hate them. Programmers fight for them, and they fight against them. Coding guidelines can be very helpful, but can be also very difficult to define, establish, follow, and enforce. 8 | 9 | Kata code is not only used to verify the correctness of user solutions by the code runner; it also needs to be usable, understandable and maintainable by other users in the Codewars community. As such, all code in a kata, whether visible or invisible to the user, should adhere to a high standard of quality to ensure it can support these goals. 10 | 11 | To ensure kata maintenance is possible and pleasant, kata code must follow the guidelines below. 12 | 13 | :::note 14 | There are no code quality guidelines that apply to every scenario. Some kata styles such as debugging kata or code golf exercises may involve breaching a commonly-held guideline. Sometimes guidelines are difficult to enforce, for example on code that has already been written and poses a big effort to fix. In justified cases, some coding guidelines may be omitted. 15 | ::: 16 | 17 | - All code components should follow general [Content Quality Guidelines](/authoring/guidelines/). 18 | - Once again, **write maintainable code.** Remember that you do not write code for yourself, or the code runner, but other users. When writing code, don't play smart and don't be funny. 19 | - **Every code snippet in a kata should follow the coding guidelines.** The fact that some snippets are not directly visible to the user is not a reason to treat it without appropriate attention. 20 | - **Stick to rules commonly recognized for your [language](/languages/)**. Know and follow its naming conventions, coding rules, and best practices. 21 | - **Respect widely-recognized standards and conventions related to software design and programming.** Avoid antipatterns and bad practices. 22 | - **Be familiar with concepts you want to handle and know how to work with them.** 23 | - When writing tests, you should know how unit testing is done, or how to generate random numbers. 24 | - Be aware of common pitfalls, like floating-point values and comparisons, overflow of arithmetic operations, concatenation of immutable strings, undefined behavior, race conditions, etc. 25 | - When your task deals with specific concepts such as concurrency or cryptography, know how they work and how to use them properly. 26 | - **Write comments** where you think they can be helpful. For example, you might include a name, explanation or references for the algorithm used by your reference solution. Explain the structure of tests. Describe your generators of random inputs. This will help maintainers and translators understand and stick to the original idea of your code. 27 | -------------------------------------------------------------------------------- /content/languages/javascript/codewars-test.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Codewars Test Framework 3 | tags: [javascript, reference, testing] 4 | --- 5 | 6 | 7 | 10 | 11 | > **DEPRECATED** Use [Mocha](/languages/javascript/mocha/) instead 12 | 13 | ## Basic Setup 14 | 15 | ```javascript 16 | describe("Example Tests", function () { 17 | it("Example Test Case", function () { 18 | Test.assertEquals(add(1, 1), 2, "optional message"); 19 | }); 20 | }); 21 | ``` 22 | 23 | ## Assertions 24 | 25 | ### `assertEquals` 26 | 27 | `Test.assertEquals(actual, expected[, msg])` 28 | 29 | Checks that the actual value equals (`===`) the expected value. 30 | 31 | ### `assertNotEquals` 32 | 33 | `Test.assertNotEquals(actual, unexpected[, msg])` 34 | 35 | Checks that the actual value does not equal (`!==`) the unexpected value. 36 | 37 | ### `assertDeepEquals` 38 | 39 | `Test.assertDeepEquals(actual, expected[, msg])` 40 | 41 | Checks that the actual value equals the expected value by performing deep comparison. 42 | 43 | ### `assertNotDeepEquals` 44 | 45 | `Test.assertNotDeepEquals(actual, unexpected[, msg])` 46 | 47 | Checks that the actual value does not equal the unexpected value by performing deep comparison. 48 | 49 | ### `assertApproxEquals` 50 | 51 | `Test.assertApproxEquals(actual, expected[, msg])` 52 | 53 | Compares two floating point values and checks whether they are approximately equal to each other. 54 | 55 | ### `assertNotApproxEquals` 56 | 57 | `Test.assertNotApproxEquals(actual, expected[, msg])` 58 | 59 | Compares two floating point values and checks whether they are sufficiently different from each other. 60 | 61 | ### `assertContains` 62 | 63 | `Test.assertContains(actual, expected[, msg])` 64 | 65 | Checks that the actual value contains the expected element. 66 | 67 | ### `assertNotContains` 68 | 69 | `Test.assertNotContains(actual, unexpected[, msg])` 70 | 71 | Checks that the actual value does not contain the unexpected element. 72 | 73 | ### `expectError` 74 | 75 | `Test.expectError([msg, ]fn)` 76 | 77 | Checks that `fn` throws. 78 | 79 | ### `expectNoError` 80 | 81 | `Test.expectNoError([msg, ]fn)` 82 | 83 | Checks that `fn` does not throw. 84 | 85 | ### `expect` 86 | 87 | `Test.expect(passed[, msg])` 88 | 89 | Core assertion method testing if `passed` is truthy. 90 | 91 | ## Utilities 92 | 93 | ### `randomize` 94 | 95 | `Test.randomize(array)` 96 | 97 | Returns a shuffled array. 98 | 99 | ### `randomNumber` 100 | 101 | `Test.randomNumber()` 102 | 103 | Returns a random integer. 104 | 105 | ### `randomToken` 106 | 107 | `Test.randomToken()` 108 | 109 | Returns a random string of characters. 110 | 111 | ### `sample` 112 | 113 | `Test.sample(array)` 114 | 115 | Returns a single, randomly chosen item from an array. 116 | -------------------------------------------------------------------------------- /content/community/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Codewars Community 3 | slug: /community 4 | --- 5 | 6 | Codewars gathers users with many different skills and levels of experience. Their knowledge is an invaluable resource and they can make your training easier, and extremely effective. 7 | 8 | ## Kata Discourse 9 | 10 | If you want to discuss some particular kata, you can use its discourse page to do so. 11 | 12 | It's a good place to ask for explanations, search for help about your solution, add your opinion on it, or report problems. You can label your post with one of the following possible labels when appropriate: 13 | 14 | - **Question** - if the description is not clear, you need help, got stuck, or you cannot get your solution to work, 15 | - **Suggestion** - if you have an idea how the author could change the kata, its description, or tests, to make it better, 16 | - **Issue** - if you think the kata is broken, and the author needs to fix it in some way. 17 | 18 | See this `[detailed documentation (TODO: direct link to Labels reference? same link than the one at the end of the "Communication" part)]` about the different kinds of labels and their use. 19 | 20 | Discourse posts support [Markdown formatting](/references/markdown/), so you can use some styling, or present your code neatly with [code formatting blocks](/references/markdown/extensions/#sequential-code-blocks). 21 | 22 | You should also mark your posts with the **Spoiler** flag if they contain some code (even not fully working one), or reveal some significant details of the solution. 23 | 24 | ## Communication 25 | 26 | Remember that your posts will be read by other people, and to be able to help you or answer your questions, they have to be able to understand you properly. Do all you can to express yourself clearly, describe your point with all necessary details, use appropriate labels and code formatting when needed. 27 | 28 | There's a set of rules you should follow to keep interaction with other users a good experience for both sides. You can find them in _(TODO: where? Code of Conduct, some discourse guidelines?)_. 29 | 30 | ## Discord 31 | 32 | You can also join the official [Codewars Discord](https://discord.gg/gy2PBSuTyx) server where the community hangs out and helps each other. The following are some channels we have: 33 | 34 | - [`#beginners`](https://discord.com/channels/846624424199061524/846953079710023699): A channel dedicated to new Codewars users. We'll help you get comfortable within the community. 35 | - [`#help-solve`](https://discord.com/channels/846624424199061524/846628654716551198): Get help solving a kata. 36 | - [`#help-author`](https://discord.com/channels/846624424199061524/846628678602588200): Get help authoring a kata, ask for early feedback. 37 | - [`#random`](https://discord.com/channels/846624424199061524/846624870187401227): A general off-topic channel. 38 | 39 | We also have channels for sub-communities within Codewars such as channels for programming languages. 40 | -------------------------------------------------------------------------------- /content/community/moderation/keeping-codewars-safe.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Keeping Codewars Safe 3 | sidebar_label: Suspension and Bans 4 | tags: [moderation] 5 | slug: /community/moderation/keeping-codewars-safe 6 | --- 7 | 8 | 9 | In March 2024, we updated our suspension tooling to provide more transparency to users experiencing account suspensions. This update removes our previous process. 10 | 11 | **What does this new tool allow Codewars to do?** 12 | 13 | * Suspend a user for a variable time for breaches of our terms, privacy policy, or code of conduct. 14 | * Ban a user from our platform for violating our terms, privacy policy, or code of conduct. 15 | 16 | 17 | ### Who can perform these actions: 18 | 19 | Suspensions (temporary) can be activated on any Codewars account by a member of a trusted party (Codewars volunteer moderation team), Codewars support team, experience and community team, or engineering team. 20 | 21 | 22 | ## Suspension: 23 | 24 | Users who breach our terms or code of conduct will receive an email from Codewars stating the reason for their suspension and the length of the suspension they have received. Users can also view a summary of this information from the top of their profile page (when logged in). 25 | 26 | **Who can view this information?** Administrators (staff), auditors, and moderators can view a summary of a user's suspension cause. Administrators and auditors can view the detailed cause behind a suspension. 27 | 28 | 29 | 30 | **What behaviors result in suspension?** 31 | 32 | Suspensions are enforced to keep Codewars users safe and ensure the integrity of our kata and rewards system. They include but are not limited to cheating, plagiarism, excessive use of AI-generated solutions, hateful speech, violence or threats of violence, and retaliation against staff or moderators. 33 | 34 | 35 | 36 | We may change our categories occasionally and will aim to inform you of these changes promptly. We encourage you to regularly re-read our terms and conditions, privacy policy, and code of conduct. 37 | 38 | 39 | 40 | In some cases, Codewars will consider off-platform behavior in our decisions. Off-platform reviews include but are not limited to, actions and discussions in the Codewars Discord server, GitHub, and other social media accounts. 41 | 42 | 43 | 44 | ## Ban: 45 | 46 | Users may be banned from Codewars services (platform and Discord) for, among other things, repeated suspensions, retaliation, failure to comply with an ongoing investigation(s), violence, extreme hate, etc. 47 | 48 | Moderators cannot ban (permanently suspend) users at this time. However, they can escalate issues to any admin for review. 49 | 50 | Banned users are unable to access Codewars' services. Bans can only be lifted upon appeal. 51 | 52 | 53 | 54 | ## Appeal process: 55 | 56 | Users wishing to appeal any moderation decision made by Codewars or a trusted party, please email info@codewars.com within five working days of the action. 57 | -------------------------------------------------------------------------------- /content/languages/php/phpunit.md: -------------------------------------------------------------------------------- 1 | --- 2 | tags: 3 | - php 4 | - reference 5 | - testing 6 | --- 7 | 8 | # PHPUnit 9 | 10 | All [PHPUnit](https://phpunit.readthedocs.io/) tests start with a subclass of `TestCase`. You can then add one or more test case methods to that class, each of which must be public and start with `test`. In Codewars' PHP versions 7.4+, PHPUnit requires the name of the test class to end with `Test`. 11 | 12 | ## Basic Setup 13 | 14 | ### Solution 15 | 16 | ```php 17 | function add(int $a, int $b): int { 18 | return $a + $b; 19 | } 20 | ``` 21 | 22 | ### Tests 23 | 24 | ```php 25 | class AddTest extends TestCase { 26 | public function testAdd() { 27 | $expected = 3; 28 | $actual = add(1, 2); 29 | $this->assertSame($expected, $actual); 30 | } 31 | } 32 | ``` 33 | 34 | ## Assertions 35 | 36 | ### Argument order 37 | 38 | PHPUnit's assertions follow the parameter order `($expected, $actual)`, unlike most testing libraries which have `$actual` first. 39 | 40 | ### Primitive equality 41 | 42 | [`assertEquals`](https://phpunit.readthedocs.io/en/9.5/assertions.html#assertequals) has surprising behavior on primitives due to casting and loose equality. Here are sample comparisons that `assertEquals` considers equal: 43 | 44 | ``` 45 | $this->assertEquals("1", "001"); 46 | $this->assertEquals(1, "001"); 47 | $this->assertEquals(42, true); 48 | $this->assertEquals("42", true); 49 | $this->assertEquals(0, false); 50 | $this->assertEquals([["foo" => 1]], [["foo" => "1"]]); 51 | ``` 52 | 53 | [`assertSame`](https://phpunit.readthedocs.io/en/9.5/assertions.html#assertsame) fails all of the above checks, as one would likely want. `assertEquals` should be avoided due to its surprising behavior. 54 | 55 | ### Object equality 56 | 57 | It's tempting to use `assertSame` across the board, but its identity check is too strict for most object comparisons: 58 | 59 | ```php 60 | $expected = new stdClass; 61 | $expected->foo = "foo"; 62 | $expected->bar = "42"; 63 | $actual = new stdClass; 64 | $actual->foo = "foo"; 65 | $actual->bar = "42"; 66 | $this->assertSame($expected, $actual); // fails 67 | ``` 68 | 69 | Here, using [`assertObjectsEqual`](https://phpunit.readthedocs.io/en/9.5/assertions.html#assertobjectequals), which calls a class' `equals(self $other): bool` method, might be a more appropriate approach. 70 | 71 | ### Float equality 72 | 73 | For float comparisons, [`assertEqualsWithDelta`](https://phpunit.readthedocs.io/en/9.5/assertions.html#assertequalswithdelta) has similar unpredictable behavior as `assertEquals`: 74 | 75 | ```php 76 | $this->assertEqualsWithDelta(0.99, "1", 0.1); // passes 77 | $this->assertEqualsWithDelta(99999, true, 0.1); // passes 78 | ``` 79 | 80 | Type-checking the arguments to `assertEqualsWithDelta` before calling it or implementing a custom delta assertion based on `assertTrue` may be a safer bet. 81 | 82 | 83 | 88 | -------------------------------------------------------------------------------- /content/concepts/kata/tests.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Tests 3 | tags: [concept] 4 | --- 5 | 6 | 7 | Each kata has two sets of tests associated with it, used for two different purposes. 8 | 9 | ## Sample tests and TDD 10 | 11 | Sample tests provide some preliminary test cases to guide users working on their solution. Sample tests are optional and author may choose to not provide them, although it's considered a good authoring practice to include at least a few of them. 12 | 13 | When sample tests are present, it's worth to take a good look at them. Reading them you can find out what is the required interface of your solution, and how it will be called (for example what name should your function have and how parameters are passed to it). It's possible that they will contain some hints on possible inputs, edge cases, etc. 14 | 15 | As a user is working on their solution, they are encouraged to modify sample tests and add their own test cases, using [Test Driven Development](https://en.wikipedia.org/wiki/Test-driven_development) approach. This way they go through the problem step by step, improving the solution gradually. Sample tests can be run against the solution to verify if implementation conforms to requirements. If test turns red, there's still something to fix. If test output is all green, user can think of adding some more test cases, one by one, to sample tests. User can continue adding test cases until all requirements of the kata are covered, they cannot think of any more of cases, or they are confident their solution is ready. 16 | 17 | After each test run, current state of user's tests and solution is stored locally in their browser, and it's loaded every time kata trainer is loaded. If needed, they can be reset to their initial form provided by kata author. 18 | 19 | Sample tests may be attempted as many times as needed without any negative impact. When all sample tests pass and solution is ready, user may choose to attempt it against full test suite. 20 | 21 | ## Full tests 22 | 23 | Kata is not considered solved until user's solution passes attempt against full test suite. Full tests are meant to be thorough and exhaustive, and it's possible they contain some test cases the solution did not account for: be it some edge conditions, large inputs, invalid inputs, or performance tests. They also cannot be viewed by a user if kata was not completed by them in attempted language. 24 | 25 | If sample test pass but full attempt does not, it means that solution is still not complete and has to be improved. Test output panel should give some hints on what went wrong, and when it happens, user should reproduce failing condition, add failing test case to their sample tests, and improve the solution. 26 | 27 | Sometimes it is important to get tests correct on the first try, for example when you care for "successful on first attempt" stat which is available to Codewars RED users. 28 | 29 | ## Tests output (?) 30 | 31 | TBD: 32 | 33 | - what's presented there, 34 | - printing and debugging, 35 | - handling unhelpful output 36 | 37 | ## Test frameworks (?) 38 | 39 | TBD: 40 | 41 | - follow up on TDD for users who want to add sample tests 42 | -------------------------------------------------------------------------------- /content/gamification/privileges.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Privileges 3 | tags: [concept] 4 | --- 5 | 6 | Users earn new privileges as their Honor grows. These can be divided in a couple of groups: 7 | 8 | - Authoring activities: a user is able to create new kata or translations. 9 | - Beta process: a user can vote on ranking and satisfaction of beta kata. Votes of more privileged users have more power than the others. 10 | - Content curation: a user can approve kata and translations after reviewing them, or edit kata to fix issues. 11 | - Moderation: a user is able to mark comments as spoilers, unmark them, or mark issues as resolved. 12 | 13 | Privileges are earned by reaching a certain level of Honor. 14 | ## Required Honor Points 15 | 16 | | Privilege | Required Honor | Description | 17 | | ----------------------------------------- | -------------: | ------------------------------------------------------------ | 18 | | Vote Kata | 25 | Vote on how satisfied you were with a kata | 19 | | Mark comment as spoiler | 50 | Mark another's comment as a spoiler | 20 | | Estimate ranking of own beta kata | 75 | Estimate on what rank you think your beta kata should be | 21 | | Assess Rank | 100 | Vote on what rank you think a beta kata should be | 22 | | Create Kata | 300 | Contribute your own kata to the community | 23 | | Unmark comment as spoiler | 500 | Unmark another's comment as being a spoiler | 24 | | Vote 2x power | 1,000 | Your vote counts 2x towards getting a kata out of beta | 25 | | Vote 3x power | 2,000 | Your vote counts 3x towards getting a kata out of beta | 26 | | Vote 4x power | 3,000 | Your vote counts 4x towards getting a kata out of beta | 27 | | Coauthor Kata **†** / Approve Translation | 4,000 | Ability to edit other author's kata and approve translations | 28 | | Resolve comment | 5,000 | Ability to resolve other's comments | 29 | | Approve Kata | 6,000 | Ability to approve a beta kata and assign its rank | 30 | | Edit locked test cases | 10,000 | Ability to edit test cases when they're locked | 31 | 32 | **†** You can edit a kata created by others if: 33 | 34 | - You have contributed to the kata in the past (you do not need to have a coauthoring privilege in this case) **OR** 35 | - You have been granted coauthoring privilege **and** at least one of the following are true: 36 | - The kata is in beta and waiting for approval 37 | - The kata is in beta and the author have allowed contribution 38 | - The kata is approved and unresolved issue/suggestion created over a week ago exists 39 | -------------------------------------------------------------------------------- /content/meta/docs.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Writing Codewars Docs 3 | --- 4 | 5 | The Codewars Docs is built with [Docusaurus][docusaurus], and the docs are written in Markdown. 6 | Each page has "Edit this page" link that allows you to contribute on GitHub. 7 | 8 | Plain Markdown is great for writing, but sometimes we need extra features to make the docs more helpful. 9 | Docusaurus provides some [Markdown extensions][markdown-features], and has support for [MDX][mdx] to extend Markdown with React components. 10 | 11 | This page summarizes the features we use, and is also used to test the styling. See [Docusaurus docs][docusaurus-docs] for more details. 12 | 13 | ## Admonitions 14 | 15 | Use the following syntax to add admonitions: 16 | 17 | ```markdown 18 | :::type title? 19 | 20 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 21 | 22 | ::: 23 | ``` 24 | 25 | `type` is required. `title` is optional and defaults to uppercased `type`. 26 | 27 | ### Types 28 | 29 | :::note 30 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation. 31 | ::: 32 | 33 | :::tip 34 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation. 35 | ::: 36 | 37 | :::info 38 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation. 39 | ::: 40 | 41 | :::warning 42 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation. 43 | ::: 44 | 45 | :::caution 46 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation. 47 | ::: 48 | 49 | ## Anchored 50 | 51 | Use `Anchored` component to add a link to a specific section within a page other than the headings. This can be useful when you'd like to point users to a specific section within a doc. 52 | 53 | ### Example 54 | 55 | ```markdown 56 | import A from "@components/Anchored"; 57 | 58 | >
The best kind of learning is learning by doing. 59 | > 60 | > —Peter Norvig 61 | > [Teach Yourself Programming in Ten Years](https://norvig.com/21-days.html) 62 | ``` 63 | 64 | import A from "@components/Anchored"; 65 | 66 | > The best kind of learning is learning by doing. 67 | > 68 | > —Peter Norvig 69 | > [Teach Yourself Programming in Ten Years](https://norvig.com/21-days.html) 70 | 71 | Hovering over the quote shows a small asterisk (\*) on the left, which you can use to get the link to this quote. 72 | The sentence is styled differently when [targeted](#.learn-by-doing). 73 | 74 | [docusaurus]: https://docusaurus.io/ 75 | [docusaurus-docs]: https://docusaurus.io/docs 76 | [mdx]: https://mdxjs.com/ 77 | [markdown-features]: https://docusaurus.io/docs/markdown-features 78 | -------------------------------------------------------------------------------- /__tmp__/wiki/snippets-random-testing-in-javascript.md: -------------------------------------------------------------------------------- 1 | Unlike Haskell, JavaScript doesn't provide an automatic framework like QuickCheck, although there is an [implementation for node](https://github.com/mcandre/node-quickcheck). Until the Codewars plattform provides an built-in way, you can use the following functions to create random tests in JavaScript. 2 | 3 | Note that both expect your solution to be pure (don't change the argument, for example if it's an object or an array) and cannot check side-effects, so you probably edit the functions for your needs. Also note that `randomAssertSimilar` is rather verbose. 4 | 5 | `generator` should return an array. 6 | 7 | Feel free to edit this page for any improvements. 8 | 9 | **NOTE:** The functions haven't been tested thoroughly. Use them with care and feel free to edit them if they contain any errors. 10 | 11 | ```javascript 12 | /** 13 | * @brief Tests a user defined function against a reference function. 14 | * @param generator is a generator for random arguments, it must return an array 15 | * @param userSolution is the solution provided by the user 16 | * @param referenceSolution is the solution provided by the original kata author 17 | * @param tests is the number of tests (optional) 18 | * 19 | * The `referenceSolution` should be pure, it shouldn't modify it's arguments, 20 | * since `userSolution` will work on the same array afterwards. 21 | * 22 | * The values are compared via equality (===), and the number of shown tests is 23 | * limited to three. 24 | */ 25 | var randomAssertEquals = function(generator, userSolution, referenceSolution, tests){ 26 | tests = tests || 100; 27 | var i = 0, user, reference, values; 28 | while( tests --> 0){ 29 | values = generator(); 30 | reference = referenceSolution.apply(this, values); 31 | user = userSolution.apply(this, values); 32 | if(i++ < 3){ 33 | Test.assertEquals(user, reference, "didn't work on the following argument array: " + values); 34 | } else if(reference !== user){ 35 | Test.assertEquals(user, reference, "didn't work on the following argument array: " + values); 36 | } 37 | } 38 | } 39 | 40 | /** 41 | * @brief Tests a user defined function against a reference function. 42 | * @param generator is a generator for random arguments, it must return an array 43 | * @param userSolution is the solution provided by the user 44 | * @param referenceSolution is the solution provided by the original kata author 45 | * @param tests is the number of tests (optional) 46 | * 47 | * The `referenceSolution` should be pure, it shouldn't modify it's arguments, 48 | * since `userSolution` will work on the same array afterwards. 49 | * 50 | * The values are compared via assertSimilar. 51 | */ 52 | var randomAssertSimilar = function(generator, userSolution, referenceSolution, tests){ 53 | tests = tests || 100; 54 | var user, reference, values; 55 | while( tests --> 0){ 56 | values = generator(); 57 | reference = referenceSolution.apply(this, values); 58 | user = userSolution.apply(this, values); 59 | Test.assertSimilar(user, reference, "didn't work on the following argument array: " + values); 60 | } 61 | } 62 | ``` -------------------------------------------------------------------------------- /__tmp__/wiki/tutorial-how-to-translate-a-kata.md: -------------------------------------------------------------------------------- 1 | ## Simple text tutorial 2 | 3 | >**Writing a translation** 4 | > 5 | >Now you found a kata in JavaScript. You liked it, and want to translate it into Python. There should be a "+" sign next to the language icons after you solved it. Click on it and you'll land on the list of current translations. After you've checked that there isn't a pending translation in Python, you click on "Translate this kata". 6 | > 7 | >This will open translation kumite editor. Choose the language in the drop-down menu before you write any code. Then fill the (initial) solution and (example) tests. Save your progress often to prevent data loss. Whenever you're ready, publish your translation. 8 | > 9 | >——[The conjured Codewars codex - 4.11.3 ](http://bkaestner.github.io/codewars-rules/) 10 | 11 | 12 | *** 13 | 14 | ## Step-By-Step Photo Tutorial 15 | 16 | When you **finished** a kata, you can translate it to other languages. 17 | 18 | >You may check **whether the author is still active or not** at first. 19 | >An author of the kata is most likely to *approve* or *decline* the translation. However any high level Code Warrior on the site who has completed the kata and has 4000+ honor will be able to approve translation, so if the author is not around you may want to add a comment letting other users know there is a translation that can be approved. Only the author will get a notification email about the translation. 20 | 21 | ![author](http://i.imgur.com/P45WQRM.png) 22 | 23 | ### Select `Add New` to see the current list of translations: 24 | 25 | ![add new](http://i.imgur.com/ru0yme2.png) 26 | 27 | ### Check the pending translations list 28 | 29 | > At this example, you could see that there is already a unapproved python translation 30 | 31 | ![py ver](http://i.imgur.com/vbmDsYv.png) 32 | 33 | ### Translate the kata to other language 34 | 35 | ![other lang](http://i.imgur.com/In8TPkk.png) 36 | 37 | ### Choose a language 38 | 39 | ![choose lang](http://i.imgur.com/1Exci59.png) 40 | 41 | ### Save your unfinished kata whenever you like. 42 | 43 | ![save](http://i.imgur.com/hKnBMOn.png) 44 | 45 | You can find the draft at you `Profile page` 46 | 47 | ![draft tab](http://i.imgur.com/6xwLVud.png) 48 | 49 | *** 50 | 51 | ### Run 52 | 53 | When you finished all the translation(include the `test example` and `solution setup`), you could `save` and `run` the code to check if there is any bug. 54 | 55 | ![test example](http://i.imgur.com/OJeMFUl.png) 56 | ![run](http://i.imgur.com/RYZued0.png) 57 | 58 | ### publish 59 | 60 | ![result](http://i.imgur.com/9t5zaW9.png) 61 | 62 | ### Edit the published `Kumite` 63 | 64 | ![edit draft](http://i.imgur.com/OJhjyyt.png) 65 | 66 | ### Comment 67 | 68 | At last, leave a comment at the original kata 69 | ![link](http://i.imgur.com/HsAnkdq.png) 70 | ![edit comment](http://i.imgur.com/gVWWcbx.png) 71 | ![comment](http://i.imgur.com/HiR6uaM.png) 72 | 73 | 74 | *** 75 | ### Approved 76 | When your translation is approved it will be marked as closed. Don't worry about it. The new languages will appear in the languages list. 77 | 78 | ![approved](http://i.imgur.com/QmSB2qR.png) 79 | ![closed](http://i.imgur.com/E7FI4ey.png) 80 | ![new lang](http://i.imgur.com/jwmbBYu.png) -------------------------------------------------------------------------------- /content/community/following.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Following Other Users 3 | tags: [concept] 4 | slug: /community/following 5 | --- 6 | 7 | You can follow any user, be it a friend, a colleague, your students, or just anyone you'd like to track their Codewars career. 8 | Following someone opens for you a couple of new possibilities. 9 | 10 | To follow a user, you need to visit their profile page, and click the `Follow` button: 11 | 12 | ![Follow Button](./img/follow_light.png#gh-light-mode-only) 13 | ![Follow Button](./img/follow_dark.png#gh-dark-mode-only) 14 | 15 | If you have already followed the user, the `Follow` button is replaced by `Unfollow` one. You can use it to stop following someone. 16 | 17 | ## Followers boards 18 | 19 | On your profile page, you can find the `Social` tab, which contains a couple of leaderboards. One of them, titled **"Following"**, contains a list and honor ranking of all users followed by you. Another one, titled **"Followers"**, provides a similar list of your followers. 20 | 21 | ![Followers Boards](./img/followers-board_light.png#gh-light-mode-only) 22 | ![Followers Boards](./img/followers-board_dark.png#gh-dark-mode-only) 23 | 24 | ## Filtering solutions 25 | 26 | When viewing the solutions of a kata, you can choose to see only those from users you are following. This is a great way to easily find solutions from warriors you respect or know personally. 27 | 28 | ![Solution](./img/solutions_light.png#gh-light-mode-only) 29 | ![Solution](./img/solutions_dark.png#gh-dark-mode-only) 30 | 31 | ## Allies 32 | 33 | When two users follow each other, they become allies. All your allies are collected in dedicated leaderboards, displayed on your dashboard, or on `Social` tab of your profile. When viewing these boards, you will see all of your allies and be able to keep track of their honor and overall rank progression. 34 | 35 | ![Allies board on user dashboard](./img/allies-board_light.png#gh-light-mode-only) 36 | ![Allies board on user dashboard](./img/allies-board_dark.png#gh-dark-mode-only) 37 | 38 | You automatically become allies with members of the same [clan](#clans), and with users who join Codewars using your referral code. 39 | 40 | ## Clans {#clans} 41 | 42 | The clan field makes users with the same clan to follow each other automatically to become allies. 43 | There's no difference from allies explained above. 44 | 45 | This is a quick way to quickly build up your allies list so that your colleagues and friends can easily keep track of each other's progression and view their solutions. 46 | 47 | Joining a clan is as simple as setting the clan name in your profile. 48 | If you want to switch clans, you simply need to change the name. 49 | If you want to leave a clan, set its name empty. 50 | 51 | ![Joining a Clan](./img/join-clan_light.png#gh-light-mode-only) 52 | ![Joining a Clan](./img/join-clan_dark.png#gh-dark-mode-only) 53 | 54 | If you change or leave your clan, you are still allies with all its members. 55 | If you wish to not be associated with them anymore, you will have to manually unfollow everyone from the previous clan. 56 | 57 | #### How to create a clan? 58 | 59 | A new clan is created once a first member joins it. If you want to create a new clan, just enter a unique clan name in your profile, and it's done. 60 | --------------------------------------------------------------------------------