build(pylint): added .pylintrc to exclude some rules

.pylintrc had rules ignore docs strings for module, function and class. this can be customised by the end user.

!9 #7
This commit is contained in:
2021-08-12 14:02:59 +09:30
parent 389bc08d76
commit 73e061e649
3 changed files with 13 additions and 3 deletions

View File

@ -7,6 +7,7 @@
.PyLint:
variables:
PYLINT_PATH: "/*/python-module/*/*.py"
PYLINT_RC_PATH: "/python/.pylintrc"
stage: validation
before_script:
- if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi
@ -24,11 +25,13 @@
script:
- PYLINT_PATH=$ROOT_DIR$PYLINT_PATH
- echo "[DEBUG] PYLINT_PATH[$PYLINT_PATH]"
- python3 -m pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.json"
- PYLINT_RC_PATH=$ROOT_DIR$PYLINT_RC_PATH
- echo "[DEBUG] PYLINT_RC_PATH[$PYLINT_RC_PATH]"
- python3 -m pylint --rcfile PYLINT_RC_PATH --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.json"
- python3 -m pylint --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html"
- python3 -m pylint --rcfile PYLINT_RC_PATH --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html"
- PyPIScore=$(python3 -m pylint --exit-zero $PYLINT_PATH | sed -n 's/^Your code has been rated at \([-0-9./]*\).*/\1/p')
- PyPIScore=$(python3 -m pylint --rcfile PYLINT_RC_PATH --exit-zero $PYLINT_PATH | sed -n 's/^Your code has been rated at \([-0-9./]*\).*/\1/p')
- *pylint_badge

5
python/.pylintrc Normal file
View File

@ -0,0 +1,5 @@
[MASTER]
disable=
C0114, # missing-module-docstring
C0115, # missing-class-docstring
C0116, # missing-function-docstring

View File

@ -61,6 +61,7 @@ include:
PyLint:
variables:
PYLINT_PATH: "/*/*.py"
PYLINT_RC_PATH: "."
extends:
- .PyLint
image: python:3.6-slim
@ -72,6 +73,7 @@ PyLint:
| var name | Description |
|:----:|:----|
| PYLINT_PATH | *The path you wish the linter to search for python files* |
| PYLINT_RC_PATH | *The path to your `.pylintrc` file.* |
## Job Workflow