Skip to content

raku

raku documentation

rakudo - GitHub

Configuration in Mega-Linter

Variable Description Default value
RAKU_RAKU_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
RAKU_RAKU_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src|lib)
Include every file
RAKU_RAKU_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test|examples)
Exclude no file
RAKU_RAKU_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".raku", ".rakumod", ".rakutest", ".pm6", ".pl6", ".p6"]
RAKU_RAKU_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
Include every file
RAKU_RAKU_CONFIG_FILE raku configuration file name
Use LINTER_DEFAULT to let the linter find it
META6.json
RAKU_RAKU_RULES_PATH Path where to find linter configuration file Workspace folder, then Mega-Linter default rules
RAKU_RAKU_DISABLE_ERRORS Run linter but consider errors as warnings false

IDE Integration

Use raku in your favorite IDE to catch errors before Mega-Linter !

IDE Extension Name Install
Atom language-perl6 Visit Web Site
comma Native Support Visit Web Site
Visual Studio Code Perl6 Language Support Install in VsCode

Mega-Linter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default Mega-Linter Flavor 83 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .raku, .rakumod, .rakutest, .pm6, .pl6, .p6

Example calls

raku -I ./lib -c myfile.raku

Help content

/opt/rakudo-pkg/share/perl6/runtime/perl6.moarvm [switches] [--] [programfile] [arguments]

With no arguments, enters a REPL (see --repl-mode option).
With a "[programfile]" or the "-e" option, compiles the given program
and, by default, also executes the compiled code.

  -                    read program source from STDIN or start REPL if a TTY
  -c                   check syntax only (runs BEGIN and CHECK blocks)
  --doc                extract documentation and print it as text
  -e program           one line of program, strict is enabled by default
  -h, --help           display this help text
  -n                   run program once for each line of input
  -p                   same as -n, but also print $_ at the end of lines
  -I path              adds the path to the module search path
  -M module            loads the module prior to running the program
  --target=stage       specify compilation stage to emit
  --optimize=level     use the given level of optimization (0..3)
  --rakudo-home=path   Override the path of the Rakudo runtime files
  -o, --output=name    specify name of output file
  -v, --version        display version information
  -V                   print configuration summary
  --stagestats         display time spent in the compilation stages
  --ll-exception       display a low level backtrace on errors
  --doc=module         use Pod::To::[module] to render inline documentation
  --repl-mode=interactive|non-interactive
                       when running without "-e" or filename arguments,
                       a REPL is started. By default, if STDIN is a TTY,
                       "interactive" REPL is started that shows extra messages and
                       prompts, otherwise a "non-interactive" mode is used where
                       STDIN is read entirely and evaluated as if it were a program,
                       without any extra output (in fact, no REPL machinery is even
                       loaded). This option allows to bypass TTY detection and
                       force one of the REPL modes.
  --profile[=name]     write profile information to a file
                       Extension controls format:
                           .json outputs in JSON
                           .sql  outputs in SQL
                           any other extension outputs in HTML
  --profile-compile[=name]
                       write compile-time profile information to a file
                       Extension controls format:
                         .json outputs in JSON
                         .sql  outputs in SQL
                         any other extension outputs in HTML
  --profile-kind[=name]
                       choose the type of profile to generate
                         instrumented - performance measurements (default)
                         heap - record heap snapshots after every garbage
                         collector run
  --profile-filename=name
                       provide a different filename for profile.
                       Extension controls format:
                         .json outputs in JSON
                         .sql  outputs in SQL
                         any other extension outputs in HTML
                       This option will go away in a future Rakudo release
  --profile-stage=stage
                       write profile information for the given compilation
                       stage to a file. Use --profile-compile to set name
                       and format
  --full-cleanup       try to free all memory and exit cleanly
  --debug-port=port    listen for incoming debugger connections
  --debug-suspend      pause execution at the entry point
  --tracing            output a line to stderr on every interpreter instr (only if
                       enabled in MoarVM)

Note that only boolean single-letter options may be bundled.

The following environment variables are respected:

  RAKULIB     Modify the module search path
  PERL6LIB    Modify the module search path # to be deprecated
  RAKUDO_HOME Override the path of the Rakudo runtime files
  NQP_HOME    Override the path of the NQP runtime files


Installation on mega-linter Docker image

  • Dockerfile commands :
RUN curl -L https://github.com/nxadm/rakudo-pkg/releases/download/v2020.10-02/rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk > rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk \
    && apk add --no-cache --allow-untrusted rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk \
    && rm rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk \
    && /opt/rakudo-pkg/bin/add-rakudo-to-path \
    && source /root/.profile \
    && /opt/rakudo-pkg/bin/install-zef-as-user

ENV PATH="~/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:$PATH"

Example success log

Results of raku linter (version 2020.11)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/raku_raku/
-----------------------------------------------

[SUCCESS] .automation/test/raku/raku_good_1.raku
    Syntax OK

Example error log

Results of raku linter (version 2020.11)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/raku_raku/
-----------------------------------------------

[ERROR] .automation/test/raku/raku_bad_1.raku
    ===SORRY!=== Error while compiling .automation/test/raku/raku_bad_1.raku
    Variable '$foo' is not declared.  Did you mean '@foo'?
    at .automation/test/raku/raku_bad_1.raku:4
    ------> <BOL>⏏$foo[1] = 42