Skip to content

Instantly share code, notes, and snippets.

@notsobad
Created April 12, 2022 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notsobad/ef2080c7f9578037b4766b2335e5009c to your computer and use it in GitHub Desktop.
Save notsobad/ef2080c7f9578037b4766b2335e5009c to your computer and use it in GitHub Desktop.
Use pylint in merge requests, only check the changed '.py' files in this MR.
stages:
- test
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
pylint-error-only:
stage: test
script:
- pylint -E `git ls-files '*.py'`
pylint-mr:
stage: test
script:
- FLIST=$(git --no-pager diff --name-only $(git merge-base --fork-point origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) $CI_COMMIT_SHA | grep "\.py$")
- echo $FLIST | xargs -r pylint -f parseable -r y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment