Check Code
Published 15 January 2025
Description
The check -code
command runs static code analysis over your SQL migrations from filesystem:
Locations.
See Code Analysis for more information.
Usage examples
flyway check -code
Parameters
Optional
Parameter | Namespace | Description |
---|---|---|
rulesLocation |
check | Where Flyway looks for rules. |
majorRules |
check | List of rules considered to be major. |
majorTolerance |
check | The number of major rules violations to be tolerated before throwing an error. |
minorRules |
check | List of rules considered to be minor. |
minorTolerance |
check | The number of minor rules violations to be tolerated before throwing an error. |
reportFilename |
(root) | The output path of the generated report. |
workingDirectory |
(root) | The directory to consider the current working directory. All relative paths will be considered relative to this. |
{environment parameters} | (root) | Environment configuration for the source and/or target environments. |
Universal commandline parameters are listed here.
Note:
- Static code analysis will not interrupt the execution of subsequent Flyway verb operations if they are chained. This means that even if a
majorTolerance
orminorTolerance
error occurs, Flyway will continue processing the remaining verb operations.
JSON output format
{
"htmlReport": "report.html",
"jsonReport": "report.json",
"individualResults": [
{
message: null,
stackTrace: null,
results: [
{
filepath: "C:\\flywayProject\migrations\V001__AddTable.sql",
violations: [
"line_no:": 5,
"line_pos": 10,
"description": "violation description",
"code": "violation code"
]
},
],
timestamp: "2022-07-22T08-08-33Z",
database: "testdb",
operation: "code",
flywayVersion: undefined,
warnings: undefined,
}
]
}
Error codes
This command can produce the following error codes: