Skip to content

Commit

Permalink
feat: add descriptor pre / post commands (#3468)
Browse files Browse the repository at this point in the history
* feat: add descriptor pre / post commands

* [MegaLinter] Apply linters fixes

---------

Co-authored-by: bdovaz <[email protected]>
  • Loading branch information
bdovaz and bdovaz authored Apr 5, 2024
1 parent 998a4e3 commit 740d926
Show file tree
Hide file tree
Showing 64 changed files with 2,437 additions and 275 deletions.
38 changes: 38 additions & 0 deletions .automation/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,12 +954,50 @@ def generate_descriptor_documentation(descriptor):
"| ----------------- | -------------- | -------------- |",
]
descriptor_md += [
f"| {descriptor.get('descriptor_id')}_PRE_COMMANDS | List of bash commands to run before the linters | None |",
f"| {descriptor.get('descriptor_id')}_POST_COMMANDS | List of bash commands to run after the linters | None |",
f"| {descriptor.get('descriptor_id')}_FILTER_REGEX_INCLUDE | Custom regex including filter | |",
f"| {descriptor.get('descriptor_id')}_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |",
"",
]
add_in_config_schema_file(
[
[
f"{descriptor.get('descriptor_id')}_PRE_COMMANDS",
{
"$id": f"#/properties/{descriptor.get('descriptor_id')}_PRE_COMMANDS",
"type": "array",
"title": f"Pre commands for {descriptor.get('descriptor_id')} descriptor",
"examples": [
[
{
"command": "composer install",
"continue_if_failed": False,
"cwd": "workspace",
}
]
],
"items": {"$ref": "#/definitions/command_info"},
},
],
[
f"{descriptor.get('descriptor_id')}_POST_COMMANDS",
{
"$id": f"#/properties/{descriptor.get('descriptor_id')}_POST_COMMANDS",
"type": "array",
"title": f"Post commands for {descriptor.get('descriptor_id')} descriptor",
"examples": [
[
{
"command": "npm run test",
"continue_if_failed": False,
"cwd": "workspace",
}
]
],
"items": {"$ref": "#/definitions/command_info"},
},
],
[
f"{descriptor.get('descriptor_id')}_FILTER_REGEX_INCLUDE",
{
Expand Down
8 changes: 7 additions & 1 deletion .automation/test/pre-post-test/.mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ PRE_COMMANDS:
POST_COMMANDS:
- command: npm run test
cwd: "workspace"
MARKDOWN_PRE_COMMANDS:
- command: echo 'descriptor pre-command has been run'
cwd: "root"
MARKDOWN_POST_COMMANDS:
- command: echo 'descriptor post-command has been run'
cwd: "root"
MARKDOWN_MARKDOWNLINT_PRE_COMMANDS:
- command: echo 'linter pre-command has been run'
cwd: "root"
MARKDOWN_MARKDOWNLINT_POST_COMMANDS:
- command: echo 'linter pre-command has been run'
- command: echo 'linter post-command has been run'
cwd: "root"
10 changes: 6 additions & 4 deletions docs/descriptors/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ description: actionlint is available to analyze ACTION files in MegaLinter

## Configuration in MegaLinter

| Variable | Description | Default value |
|-----------------------------|-------------------------------|---------------|
| ACTION_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| ACTION_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|-----------------------------|-------------------------------------------------|---------------|
| ACTION_PRE_COMMANDS | List of bash commands to run before the linters | None |
| ACTION_POST_COMMANDS | List of bash commands to run after the linters | None |
| ACTION_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| ACTION_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ description: ansible-lint is available to analyze ANSIBLE files in MegaLinter

## Configuration in MegaLinter

| Variable | Description | Default value |
|------------------------------|-------------------------------|---------------|
| ANSIBLE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| ANSIBLE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|------------------------------|-------------------------------------------------|---------------|
| ANSIBLE_PRE_COMMANDS | List of bash commands to run before the linters | None |
| ANSIBLE_POST_COMMANDS | List of bash commands to run after the linters | None |
| ANSIBLE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| ANSIBLE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/arm.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ description: arm-ttk is available to analyze ARM files in MegaLinter

## Configuration in MegaLinter

| Variable | Description | Default value |
|--------------------------|-------------------------------|---------------|
| ARM_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| ARM_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|--------------------------|-------------------------------------------------|---------------|
| ARM_PRE_COMMANDS | List of bash commands to run before the linters | None |
| ARM_POST_COMMANDS | List of bash commands to run after the linters | None |
| ARM_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| ARM_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |


## Behind the scenes
Expand Down
10 changes: 6 additions & 4 deletions docs/descriptors/bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ description: bash-exec, shellcheck, shfmt are available to analyze BASH files in

## Configuration in MegaLinter

| Variable | Description | Default value |
|---------------------------|-------------------------------|---------------|
| BASH_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| BASH_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|---------------------------|-------------------------------------------------|---------------|
| BASH_PRE_COMMANDS | List of bash commands to run before the linters | None |
| BASH_POST_COMMANDS | List of bash commands to run after the linters | None |
| BASH_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| BASH_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |


## Behind the scenes
Expand Down
10 changes: 6 additions & 4 deletions docs/descriptors/bicep.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ description: bicep_linter is available to analyze BICEP files in MegaLinter

## Configuration in MegaLinter

| Variable | Description | Default value |
|----------------------------|-------------------------------|---------------|
| BICEP_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| BICEP_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|----------------------------|-------------------------------------------------|---------------|
| BICEP_PRE_COMMANDS | List of bash commands to run before the linters | None |
| BICEP_POST_COMMANDS | List of bash commands to run after the linters | None |
| BICEP_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| BICEP_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/c.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ description: cpplint, clang-format are available to analyze C files in MegaLinte

## Configuration in MegaLinter

| Variable | Description | Default value |
|------------------------|-------------------------------|---------------|
| C_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| C_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|------------------------|-------------------------------------------------|---------------|
| C_PRE_COMMANDS | List of bash commands to run before the linters | None |
| C_POST_COMMANDS | List of bash commands to run after the linters | None |
| C_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| C_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/clojure.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ description: clj-kondo, cljstyle are available to analyze CLOJURE files in MegaL

## Configuration in MegaLinter

| Variable | Description | Default value |
|------------------------------|-------------------------------|---------------|
| CLOJURE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CLOJURE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|------------------------------|-------------------------------------------------|---------------|
| CLOJURE_PRE_COMMANDS | List of bash commands to run before the linters | None |
| CLOJURE_POST_COMMANDS | List of bash commands to run after the linters | None |
| CLOJURE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CLOJURE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |


## Behind the scenes
Expand Down
10 changes: 6 additions & 4 deletions docs/descriptors/cloudformation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ description: cfn-lint is available to analyze CLOUDFORMATION files in MegaLinter

## Configuration in MegaLinter

| Variable | Description | Default value |
|-------------------------------------|-------------------------------|---------------|
| CLOUDFORMATION_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CLOUDFORMATION_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|-------------------------------------|-------------------------------------------------|---------------|
| CLOUDFORMATION_PRE_COMMANDS | List of bash commands to run before the linters | None |
| CLOUDFORMATION_POST_COMMANDS | List of bash commands to run after the linters | None |
| CLOUDFORMATION_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CLOUDFORMATION_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/coffee.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ description: coffeelint is available to analyze COFFEE files in MegaLinter

## Configuration in MegaLinter

| Variable | Description | Default value |
|-----------------------------|-------------------------------|---------------|
| COFFEE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| COFFEE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|-----------------------------|-------------------------------------------------|---------------|
| COFFEE_PRE_COMMANDS | List of bash commands to run before the linters | None |
| COFFEE_POST_COMMANDS | List of bash commands to run after the linters | None |
| COFFEE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| COFFEE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/copypaste.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ description: jscpd is available to analyze COPYPASTE files in MegaLinter

## Configuration in MegaLinter

| Variable | Description | Default value |
|--------------------------------|-------------------------------|---------------|
| COPYPASTE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| COPYPASTE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|--------------------------------|-------------------------------------------------|---------------|
| COPYPASTE_PRE_COMMANDS | List of bash commands to run before the linters | None |
| COPYPASTE_POST_COMMANDS | List of bash commands to run after the linters | None |
| COPYPASTE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| COPYPASTE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ description: cpplint, clang-format are available to analyze CPP files in MegaLin

## Configuration in MegaLinter

| Variable | Description | Default value |
|--------------------------|-------------------------------|---------------|
| CPP_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CPP_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|--------------------------|-------------------------------------------------|---------------|
| CPP_PRE_COMMANDS | List of bash commands to run before the linters | None |
| CPP_POST_COMMANDS | List of bash commands to run after the linters | None |
| CPP_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CPP_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ description: dotnet-format, csharpier, roslynator are available to analyze CSHAR

## Configuration in MegaLinter

| Variable | Description | Default value |
|-----------------------------|-------------------------------|---------------|
| CSHARP_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CSHARP_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|-----------------------------|-------------------------------------------------|---------------|
| CSHARP_PRE_COMMANDS | List of bash commands to run before the linters | None |
| CSHARP_POST_COMMANDS | List of bash commands to run after the linters | None |
| CSHARP_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CSHARP_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |


## Behind the scenes
Expand Down
10 changes: 6 additions & 4 deletions docs/descriptors/css.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ description: stylelint, scss-lint are available to analyze CSS files in MegaLint

## Configuration in MegaLinter

| Variable | Description | Default value |
|--------------------------|-------------------------------|---------------|
| CSS_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CSS_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|--------------------------|-------------------------------------------------|---------------|
| CSS_PRE_COMMANDS | List of bash commands to run before the linters | None |
| CSS_POST_COMMANDS | List of bash commands to run after the linters | None |
| CSS_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| CSS_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/dart.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ description: dartanalyzer is available to analyze DART files in MegaLinter

## Configuration in MegaLinter

| Variable | Description | Default value |
|---------------------------|-------------------------------|---------------|
| DART_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| DART_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|---------------------------|-------------------------------------------------|---------------|
| DART_PRE_COMMANDS | List of bash commands to run before the linters | None |
| DART_POST_COMMANDS | List of bash commands to run after the linters | None |
| DART_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| DART_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |


## Behind the scenes
Expand Down
10 changes: 6 additions & 4 deletions docs/descriptors/dockerfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ description: hadolint is available to analyze DOCKERFILE files in MegaLinter

## Configuration in MegaLinter

| Variable | Description | Default value |
|---------------------------------|-------------------------------|---------------|
| DOCKERFILE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| DOCKERFILE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|---------------------------------|-------------------------------------------------|---------------|
| DOCKERFILE_PRE_COMMANDS | List of bash commands to run before the linters | None |
| DOCKERFILE_POST_COMMANDS | List of bash commands to run after the linters | None |
| DOCKERFILE_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| DOCKERFILE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

10 changes: 6 additions & 4 deletions docs/descriptors/editorconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ description: editorconfig-checker is available to analyze EDITORCONFIG files in

## Configuration in MegaLinter

| Variable | Description | Default value |
|-----------------------------------|-------------------------------|---------------|
| EDITORCONFIG_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| EDITORCONFIG_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |
| Variable | Description | Default value |
|-----------------------------------|-------------------------------------------------|---------------|
| EDITORCONFIG_PRE_COMMANDS | List of bash commands to run before the linters | None |
| EDITORCONFIG_POST_COMMANDS | List of bash commands to run after the linters | None |
| EDITORCONFIG_FILTER_REGEX_INCLUDE | Custom regex including filter | |
| EDITORCONFIG_FILTER_REGEX_EXCLUDE | Custom regex excluding filter | |

Loading

0 comments on commit 740d926

Please sign in to comment.