noogle/codemod
Johannes Kirschbauer 1717019d0b extend codemod
2024-03-07 18:04:56 +01:00
..
src extend codemod 2024-03-07 18:04:56 +01:00
test redesign with subpages 2024-01-07 17:20:35 +01:00
.envrc redesign with subpages 2024-01-07 17:20:35 +01:00
.gitignore redesign with subpages 2024-01-07 17:20:35 +01:00
Cargo.lock redesign with subpages 2024-01-07 17:20:35 +01:00
Cargo.toml redesign with subpages 2024-01-07 17:20:35 +01:00
flake-module.nix update to upstream master @ ce223671c8bb53623f634a3961ffc0c8b621e337 2024-01-09 19:04:23 +01:00
README.md redesign with subpages 2024-01-07 17:20:35 +01:00

Doc-comments Codemod

A simple codemod based on rnix. It migrates all comments automatically into the new markdown format.

Features

  • Fully automatic.
  • Changes all files from all directories (if needed).
  • Markdown output.
  • Re-aligns the indentation.

Example

input

  /* Throw if pred is false, else return pred.
     Intended to be used to augment asserts with helpful error messages.

     Example:
       assertMsg false "nope"
       stderr> error: nope
           
       assert assertMsg ("foo" == "bar") "foo is not bar, silly"; ""
       stderr> error: foo is not bar, silly

     Type:
       assertMsg :: Bool -> String -> Bool
  */
  assertMsg =

->

output

  /**
    Throw if pred is false, else return pred.
    Intended to be used to augment asserts with helpful error messages.

    # Example

    ```nix
    assertMsg false "nope"
               stderr> error: nope
    
               assert assertMsg ("foo" == "bar") "foo is not bar, silly"; ""
               stderr> error: foo is not bar, silly
    ```

    # Type

    ```
    assertMsg :: Bool -> String -> Bool
    ```
  */
  assertMsg =

Development

Enter the devshell

nix develop .#codemod