Skip to content

Latest commit

 

History

History
63 lines (50 loc) · 1.65 KB

README.md

File metadata and controls

63 lines (50 loc) · 1.65 KB

About The Project

An opinionated linter for Transifex Projects

It consists of the following parts:

How to use

Lint specific files

docker run --rm \
    --user ${USER_ID}:${GROUP_ID} \
    --mount src="$(pwd)",target=/src,type=bind \
    transifex/txlint --files \
    file_1.py /path/to/file_2.py

Lint current branch

git diff origin/devel..$(git rev-parse HEAD) --name-only | \
    xargs docker run --rm \
        --user $(id -u):$(id -g) \
        --mount src="$(pwd)",target=/src,type=bind \
        transifex/txlint --files

Makefile integration

pre-commit:
    git diff origin/devel..$(git rev-parse HEAD) --name-only | \
        xargs docker run --rm \
            --user $$(id -u):$$(id -g) \
            --mount src="$(pwd)",target=/src,type=bind \
            transifex/txlint --files

Integrate with Jenkins

  1. Ideally you would have a Makefile containing the previous example:
  2. Add the following stage in your Jenkinsfile :
    stage('Run linter') {
        when {
            anyOf {
                changeRequest()
            }
        }
        steps {
            sh 'make pre-commit'
        }
    }