On this page:
2.1 raco warn:   Checking Syntax Warnings
2.2 raco fix:   Fixing Syntax Warnings
7.1

2 The Syntax Warning Command Line Interface

This document describes the raco warn and raco fix commands. This commands allow a programmer to check for syntax warnings and, where possible, automatically fix them. The two commands are designed to work together - when raco warn outputs no warnings, raco fix makes no changes to any modules. Additionally, both commands accept the same flags for specifying which modules to check.

2.1 raco warn: Checking Syntax Warnings

The raco warn command searches for syntax warnings in a specified set of modules. Any found warnings are displayed with a message, the offending source code, and a suggested fix (if present). If any warnings are found the command exits as a failure, making it suitable for use in continuous integration systems.

Not all warnings need cause a failure. The raco warn command allows certain warnings to be suppressed by configuration. For every module that raco warn examines, the command looks for a warning configuration value named config provided by that module’s 'warning-config submodule. If this module or the expected binding isn’t present, empty-warning-config is used. This allows for per-module suppression of particular kinds of warnings, see the documentation of warning-config for details. Warnings may also be suppressed via command line flags.

The raco warn command accepts any number of arguments along with the following flags:

2.2 raco fix: Fixing Syntax Warnings

The raco fix command searches for syntax warnings in a specified set of modules and fixes them, if possible. For each module checked, the set of warnings is filtered to only warnings with suggested fixes that won’t interfere with each other. For instance, if two warnings suggest changing the same piece of code, raco fix will either fix one of the warnings if its affected source code fully encompasses the other warning’s source code, or fix neither warning if they only partially overlap. The raco fix command also accepts a run mode argument that can configure how raco fix applies changes, if at all.

The raco fix command accepts any number of arguments along with the following flags:

In addition, the raco fix command looks for warning configuration in the same way as raco warn with the same flags to control this behavior. Warnings can also be suppressed and unsuppressed with direct flags in the same manner as raco warn.