Skip to content
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

Use --py3k for code-analysis using zc.recipe.command #36

Open
idgserpro opened this issue May 22, 2018 · 0 comments
Open

Use --py3k for code-analysis using zc.recipe.command #36

idgserpro opened this issue May 22, 2018 · 0 comments

Comments

@idgserpro
Copy link
Member

If plone/plone.recipe.codeanalysis#219 isn't accepted, do you think it's feasible to create a hacky command in qa.cfg using a zc.recipe.command? A variable namedpylint-py3k-pre-commit-hook can be created in qa.cfg (false by default) and a little zc.recipe.command snippet:

[buildout]
index = https://pypi.org/simple/
package-min-coverage = 80
pylint-py3k-pre-commit-hook = false
parts +=
    code-analysis
    i18ndude
    pylint-py3k
    pylint-py3k-pre-commit-hook

(...)

[pylint-py3k]
recipe = zc.recipe.egg
eggs =
    pylint
    ${buildout:eggs}

[pylint-py3k-pre-commit-hook]
recipe = plone.recipe.command
stop-on-error = yes
command =
    pre_commit_file="${buildout:directory}/.git/hooks/pre-commit"
    if ${buildout:pylint-py3k-pre-commit-hook}; then
        if ! grep -q 'py3k' "$pre_commit_file"; then
            echo "\nbin/pylint --py3k --disable=no-absolute-import ${code-analysis:directory}" >> "$pre_commit_file"
        fi
    fi
    # XXX: Else is getting 'not found' when executed. Don't know why so I'm using two ifs.
    if ! ${buildout:pylint-py3k-pre-commit-hook}; then
        sed -i '/py3k/d' "$pre_commit_file"
    fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant