From 73e061e649e8fbeee34c6d18cf1f901b394a1f26 Mon Sep 17 00:00:00 2001 From: Jon Lockwood Date: Thu, 12 Aug 2021 14:02:59 +0930 Subject: [PATCH] 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 --- python/.gitlab-ci.yml | 9 ++++++--- python/.pylintrc | 5 +++++ python/README.md | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 python/.pylintrc diff --git a/python/.gitlab-ci.yml b/python/.gitlab-ci.yml index 824025b..5f5acc3 100644 --- a/python/.gitlab-ci.yml +++ b/python/.gitlab-ci.yml @@ -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 diff --git a/python/.pylintrc b/python/.pylintrc new file mode 100644 index 0000000..8318223 --- /dev/null +++ b/python/.pylintrc @@ -0,0 +1,5 @@ +[MASTER] +disable= + C0114, # missing-module-docstring + C0115, # missing-class-docstring + C0116, # missing-function-docstring diff --git a/python/README.md b/python/README.md index 33802ab..17e4d89 100644 --- a/python/README.md +++ b/python/README.md @@ -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