Skip to content

Fix python bandit config file use + count errors + black install #682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .automation/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def generate_flavor(flavor, flavor_info):
pip_install_command = ""
if len(pip_packages) > 0:
pip_install_command = (
"RUN pip3 install --no-cache-dir \\\n '"
"RUN pip3 install --no-cache-dir --upgrade \\\n '"
+ "' \\\n '".join(list(dict.fromkeys(pip_packages)))
+ "'"
)
Expand Down
64 changes: 32 additions & 32 deletions .automation/generated/flavors-stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
97937
],
[
"2021-08-23T01:26:28",
98630
"2021-08-23T08:42:54",
98785
]
],
"ci_light": [
Expand Down Expand Up @@ -215,8 +215,8 @@
2064
],
[
"2021-08-23T01:26:28",
2074
"2021-08-23T08:42:54",
2076
]
],
"dart": [
Expand Down Expand Up @@ -325,8 +325,8 @@
768
],
[
"2021-08-23T01:26:28",
786
"2021-08-23T08:42:54",
794
]
],
"documentation": [
Expand Down Expand Up @@ -435,8 +435,8 @@
8527
],
[
"2021-08-23T01:26:28",
8564
"2021-08-23T08:42:54",
8566
]
],
"dotnet": [
Expand Down Expand Up @@ -545,8 +545,8 @@
220213
],
[
"2021-08-23T01:26:28",
220548
"2021-08-23T08:42:54",
220621
]
],
"go": [
Expand Down Expand Up @@ -655,8 +655,8 @@
2935
],
[
"2021-08-23T01:26:28",
2946
"2021-08-23T08:42:54",
2950
]
],
"java": [
Expand Down Expand Up @@ -765,8 +765,8 @@
17554
],
[
"2021-08-23T01:26:28",
17599
"2021-08-23T08:42:54",
17619
]
],
"javascript": [
Expand Down Expand Up @@ -875,8 +875,8 @@
28305
],
[
"2021-08-23T01:26:28",
28408
"2021-08-23T08:42:54",
28532
]
],
"php": [
Expand Down Expand Up @@ -985,8 +985,8 @@
1408
],
[
"2021-08-23T01:26:28",
1418
"2021-08-23T08:42:54",
1422
]
],
"python": [
Expand Down Expand Up @@ -1095,8 +1095,8 @@
16489
],
[
"2021-08-23T01:26:28",
16540
"2021-08-23T08:42:54",
16596
]
],
"ruby": [
Expand Down Expand Up @@ -1205,8 +1205,8 @@
1077
],
[
"2021-08-23T01:26:28",
1087
"2021-08-23T08:42:54",
1089
]
],
"rust": [
Expand Down Expand Up @@ -1315,8 +1315,8 @@
785
],
[
"2021-08-23T01:26:28",
795
"2021-08-23T08:42:54",
797
]
],
"salesforce": [
Expand Down Expand Up @@ -1425,8 +1425,8 @@
5729
],
[
"2021-08-23T01:26:28",
5752
"2021-08-23T08:42:54",
5762
]
],
"scala": [
Expand Down Expand Up @@ -1535,8 +1535,8 @@
724
],
[
"2021-08-23T01:26:28",
734
"2021-08-23T08:42:54",
736
]
],
"swift": [
Expand Down Expand Up @@ -1645,8 +1645,8 @@
613
],
[
"2021-08-23T01:26:28",
614
"2021-08-23T08:42:54",
616
]
],
"terraform": [
Expand Down Expand Up @@ -1755,8 +1755,8 @@
4496
],
[
"2021-08-23T01:26:28",
4508
"2021-08-23T08:42:54",
4514
]
]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'cpplint' \
'cfn-lint' \
'pylint' \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- mega-linter-title-end -->

![GitHub release](https://img.shields.io/github/v/release/nvuillam/mega-linter?sort=semver)
[![Docker Pulls](https://img.shields.io/badge/docker%20pulls-411.0k-blue)](https://nvuillam.github.io/mega-linter/flavors/)
[![Docker Pulls](https://img.shields.io/badge/docker%20pulls-411.5k-blue)](https://nvuillam.github.io/mega-linter/flavors/)
[![Downloads/week](https://img.shields.io/npm/dw/mega-linter-runner.svg)](https://npmjs.org/package/mega-linter-runner)
[![GitHub stars](https://img.shields.io/github/stars/nvuillam/mega-linter?maxAge=2592000)](https://GitHub.com/nvuillam/mega-linter/stargazers/)
[![Mega-Linter](https://github.com/nvuillam/mega-linter/workflows/Mega-Linter/badge.svg?branch=master)](https://github.com/nvuillam/mega-linter/actions?query=workflow%3AMega-Linter+branch%3Amaster)
Expand Down
24 changes: 13 additions & 11 deletions docs/descriptors/python_bandit.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@ If you find it too harsh, you may define `PYTHON_BANDIT_DISABLE_ERRORS: true` in
- Enable bandit by adding `PYTHON_BANDIT` in [ENABLE_LINTERS variable](https://nvuillam.github.io/mega-linter/configuration/#activation-and-deactivation)
- Disable bandit by adding `PYTHON_BANDIT` in [DISABLE_LINTERS variable](https://nvuillam.github.io/mega-linter/configuration/#activation-and-deactivation)

| Variable | Description | Default value |
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|
| PYTHON_BANDIT_ARGUMENTS | User custom arguments to add in linter CLI call<br/>Ex: `-s --foo "bar"` | |
| PYTHON_BANDIT_FILTER_REGEX_INCLUDE | Custom regex including filter<br/>Ex: `(src\|lib)` | Include every file |
| PYTHON_BANDIT_FILTER_REGEX_EXCLUDE | Custom regex excluding filter<br/>Ex: `(test\|examples)` | Exclude no file |
| PYTHON_BANDIT_FILE_EXTENSIONS | Allowed file extensions. `"*"` matches any extension, `""` matches empty extension. Empty list excludes all files<br/>Ex: `[".py", ""]` | `[".py"]` |
| PYTHON_BANDIT_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<br/>Ex: `["Dockerfile(-.+)?", "Jenkinsfile"]` | Include every file |
| PYTHON_BANDIT_PRE_COMMANDS | List of bash commands to run before the linter | None |
| PYTHON_BANDIT_POST_COMMANDS | List of bash commands to run after the linter | None |
| PYTHON_BANDIT_DISABLE_ERRORS | Run linter but consider errors as warnings | `false` |
| PYTHON_BANDIT_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | `0` |
| Variable | Description | Default value |
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| PYTHON_BANDIT_ARGUMENTS | User custom arguments to add in linter CLI call<br/>Ex: `-s --foo "bar"` | |
| PYTHON_BANDIT_FILTER_REGEX_INCLUDE | Custom regex including filter<br/>Ex: `(src\|lib)` | Include every file |
| PYTHON_BANDIT_FILTER_REGEX_EXCLUDE | Custom regex excluding filter<br/>Ex: `(test\|examples)` | Exclude no file |
| PYTHON_BANDIT_FILE_EXTENSIONS | Allowed file extensions. `"*"` matches any extension, `""` matches empty extension. Empty list excludes all files<br/>Ex: `[".py", ""]` | `[".py"]` |
| PYTHON_BANDIT_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<br/>Ex: `["Dockerfile(-.+)?", "Jenkinsfile"]` | Include every file |
| PYTHON_BANDIT_PRE_COMMANDS | List of bash commands to run before the linter | None |
| PYTHON_BANDIT_POST_COMMANDS | List of bash commands to run after the linter | None |
| PYTHON_BANDIT_CONFIG_FILE | bandit configuration file name</br>Use `LINTER_DEFAULT` to let the linter find it | `.bandit.yml` |
| PYTHON_BANDIT_RULES_PATH | Path where to find linter configuration file | Workspace folder, then Mega-Linter default rules |
| PYTHON_BANDIT_DISABLE_ERRORS | Run linter but consider errors as warnings | `false` |
| PYTHON_BANDIT_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | `0` |

## IDE Integration

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- mega-linter-title-end -->

![GitHub release](https://img.shields.io/github/v/release/nvuillam/mega-linter?sort=semver)
[![Docker Pulls](https://img.shields.io/badge/docker%20pulls-411.0k-blue)](https://nvuillam.github.io/mega-linter/flavors/)
[![Docker Pulls](https://img.shields.io/badge/docker%20pulls-411.5k-blue)](https://nvuillam.github.io/mega-linter/flavors/)
[![Downloads/week](https://img.shields.io/npm/dw/mega-linter-runner.svg)](https://npmjs.org/package/mega-linter-runner)
[![GitHub stars](https://img.shields.io/github/stars/nvuillam/mega-linter?maxAge=2592000)](https://GitHub.com/nvuillam/mega-linter/stargazers/)
[![Mega-Linter](https://github.com/nvuillam/mega-linter/workflows/Mega-Linter/badge.svg?branch=master)](https://github.com/nvuillam/mega-linter/actions?query=workflow%3AMega-Linter+branch%3Amaster)
Expand Down
2 changes: 1 addition & 1 deletion flavors/ci_light/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'yamllint'
#PIP__END

Expand Down
2 changes: 1 addition & 1 deletion flavors/dart/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/documentation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/dotnet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'cpplint' \
'snakemake' \
'snakefmt' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/javascript/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'pylint' \
'black' \
'flake8' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/ruby/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/salesforce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/scala/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/swift/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion flavors/terraform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir \
RUN pip3 install --no-cache-dir --upgrade \
'snakemake' \
'snakefmt' \
'sqlfluff' \
Expand Down
2 changes: 1 addition & 1 deletion mega-linter-runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[![Downloads/total](https://img.shields.io/npm/dt/mega-linter-runner.svg)](https://npmjs.org/package/mega-linter-runner)
[![GitHub stars](https://img.shields.io/github/stars/nvuillam/mega-linter?maxAge=2592000)](https://GitHub.com/nvuillam/mega-linter/stargazers/)
<!-- readme-header-start -->
[![Docker Pulls](https://img.shields.io/badge/docker%20pulls-411.0k-blue)](https://nvuillam.github.io/mega-linter/flavors/)
[![Docker Pulls](https://img.shields.io/badge/docker%20pulls-411.5k-blue)](https://nvuillam.github.io/mega-linter/flavors/)
[![Mega-Linter](https://github.com/nvuillam/mega-linter/workflows/Mega-Linter/badge.svg?branch=master)](https://nvuillam.github.io/mega-linter)
[![codecov](https://codecov.io/gh/nvuillam/mega-linter/branch/master/graph/badge.svg)](https://codecov.io/gh/nvuillam/mega-linter)
[![Secured with Trivy](https://img.shields.io/badge/Trivy-secured-green?logo=docker)](https://github.com/aquasecurity/trivy)
Expand Down
3 changes: 3 additions & 0 deletions megalinter/descriptors/python.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ linters:
cli_lint_mode: list_of_files
cli_config_arg_name: "--configfile"
cli_version_arg_name: "--version"
config_file_name: ".bandit.yml"
cli_lint_errors_count: regex_count
cli_lint_errors_regex: ">> Issue: \\["
version_extract_regex: "(?<=bandit )\\d+(\\.\\d+)+"
test_folder: python_bandit
examples:
Expand Down
Loading