Skip to content

raku

GitHub stars GitHub release (latest SemVer) GitHub last commit GitHub commit activity GitHub contributors

raku documentation

rakudo - GitHub

Configuration in MegaLinter

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_CLI_LINT_MODE Override default CLI lint mode
- file: Calls the linter for each file
- project: Call the linter from the root of the project
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_PRE_COMMANDS List of bash commands to run before the linter None
RAKU_RAKU_POST_COMMANDS List of bash commands to run after the linter None
RAKU_RAKU_UNSECURED_ENV_VARIABLES List of env variables explicitly not filtered before calling RAKU_RAKU and its pre/post commands None
RAKU_RAKU_CONFIG_FILE raku configuration file nameUse LINTER_DEFAULT to let the linter find it META6.json
RAKU_RAKU_RULES_PATH Path where to find linter configuration file Workspace folder, then MegaLinter default rules
RAKU_RAKU_DISABLE_ERRORS Run linter but consider errors as warnings false
RAKU_RAKU_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0
RAKU_RAKU_CLI_EXECUTABLE Override CLI executable ['raku']

IDE Integration

Use raku in your favorite IDE to catch errors before MegaLinter !

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

MegaLinter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default MegaLinter Flavor 117 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

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

How the linting is performed

  • raku is called one time by identified file (file CLI lint mode)

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"