Adapt 'warnings-as-errors' option to allow taking migration test codes as input

This commit is contained in:
David Wobrock committed 2022-03-13 17:26:40 +01:00
1 parent a04ecc078a
commit c7d9129db9
8 files changed
+114 -33

No files matched your search

+1 -1
View File
@@ -29,5 +29,5 @@ Deleted tests/test_project/app_correct/migrations/0003_a_column.py
Among the options that can be given, additionally to the default `makemigrations` options, you can count the options
to configure what should be linted:
* `--database DATABASE` - specify the database for which to generate the SQL. Defaults to *default*.
* `--warnings-as-errors` - handle warnings as errors and therefore return an error status code if we should.
* `--warnings-as-errors [MIGRATION_TEST_CASE ...]` - handle warnings as errors. Optionally specify the selected tests using their code.
* `--exclude-migration-tests MIGRATION_TEST_CODE [...]` - specify backward incompatible migration tests to be ignored using the code (e.g. ALTER_COLUMN).
+21 -21
View File
@@ -19,27 +19,27 @@ The three main usages are:
Below the detailed command line options, which can all also be defined using a config file (`setup.cfg`, `tox.ini`, `pyproject.toml`, `.django_migration_linter.cfg`):
| Parameter | Description |
|-------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
| `--git-commit-id GIT_COMMIT_ID` | If specified, only migrations since this commit will be taken into account. |
| `--ignore-name-contains IGNORE_NAME_CONTAINS` | Ignore migrations containing this name. |
| `--ignore-name IGNORE_NAME [IGNORE_NAME ...]` | Ignore migrations with exactly one of these names. |
| `--include-name-contains INCLUDE_NAME_CONTAINS` | Include migrations containing this name. |
| `--include-name INCLUDE_NAME [INCLUDE_NAME ...]` | Include migrations with exactly one of these names. |
| `--include-apps INCLUDE_APPS [INCLUDE_APPS ...]` | Check only migrations that are in the specified django apps. |
| `--exclude-apps EXCLUDE_APPS [EXCLUDE_APPS ...]` | Ignore migrations that are in the specified django apps. |
| `--exclude-migration-tests MIGRATION_TEST_CODE [...]` | Specify backward incompatible migration tests to be ignored using the code (e.g. ALTER_COLUMN). |
| `--verbosity or -v {0,1,2,3}` | Print more information during execution. |
| `--database DATABASE` | Specify the database for which to generate the SQL. Defaults to *default*. |
| `--cache-path PATH` | specify a directory that should be used to store cache-files in. |
| `--no-cache` | Don't use a cache. |
| `--applied-migrations` | Only lint migrations that are applied to the selected database. Other migrations are ignored. |
| `--unapplied-migrations` | Only lint migrations that are not yet applied to the selected database. Other migrations are ignored. |
| `--project-root-path DJANGO_PROJECT_FOLDER` | An absolute or relative path to the django project. |
| `--include-migrations-from FILE_PATH` | If specified, only migrations listed in the given file will be considered. |
| `--quiet or -q {ok,ignore,warning,error}` | Suppress certain output messages, instead of writing them to stdout. |
| `--warnings-as-errors` | Handle warnings as errors and therefore return an error status code if we should. |
| `--sql-analyser` | Specify the SQL analyser that should be used. Allowed values: 'sqlite', 'mysql', 'postgresql'. |
| Parameter | Description |
|-------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--git-commit-id GIT_COMMIT_ID` | If specified, only migrations since this commit will be taken into account. |
| `--ignore-name-contains IGNORE_NAME_CONTAINS` | Ignore migrations containing this name. |
| `--ignore-name IGNORE_NAME [IGNORE_NAME ...]` | Ignore migrations with exactly one of these names. |
| `--include-name-contains INCLUDE_NAME_CONTAINS` | Include migrations containing this name. |
| `--include-name INCLUDE_NAME [INCLUDE_NAME ...]` | Include migrations with exactly one of these names. |
| `--include-apps INCLUDE_APPS [INCLUDE_APPS ...]` | Check only migrations that are in the specified django apps. |
| `--exclude-apps EXCLUDE_APPS [EXCLUDE_APPS ...]` | Ignore migrations that are in the specified django apps. |
| `--exclude-migration-tests MIGRATION_TEST_CODE [...]` | Specify backward incompatible migration tests to be ignored using the code (e.g. ALTER_COLUMN). |
| `--verbosity or -v {0,1,2,3}` | Print more information during execution. |
| `--database DATABASE` | Specify the database for which to generate the SQL. Defaults to *default*. |
| `--cache-path PATH` | specify a directory that should be used to store cache-files in. |
| `--no-cache` | Don't use a cache. |
| `--applied-migrations` | Only lint migrations that are applied to the selected database. Other migrations are ignored. |
| `--unapplied-migrations` | Only lint migrations that are not yet applied to the selected database. Other migrations are ignored. |
| `--project-root-path DJANGO_PROJECT_FOLDER` | An absolute or relative path to the django project. |
| `--include-migrations-from FILE_PATH` | If specified, only migrations listed in the given file will be considered. |
| `--quiet or -q {ok,ignore,warning,error}` | Suppress certain output messages, instead of writing them to stdout. |
| `--warnings-as-errors [MIGRATION_TEST_CODE [...]]` | Handle warnings as errors and therefore return an error status code if we should. Optionally specify migration test codes to handle as errors. When no test code specified, all warnings are handled as errors. |
| `--sql-analyser` | Specify the SQL analyser that should be used. Allowed values: 'sqlite', 'mysql', 'postgresql'. |
## Django settings configuration