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

Add linters to Travis: Python #264

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

digitalfishpond
Copy link
Contributor

Splitting #191 for manageability

@matrixik matrixik mentioned this pull request Oct 23, 2017
@matrixik
Copy link
Member

I think we should configure it with same/similar configuration like in openstack
E.g. max line length is 120 in monasca-api: https://github.com/openstack/monasca-api/blob/master/tox.ini#L147

@matrixik
Copy link
Member

matrixik commented Oct 26, 2017

I think that most standard/popular way of having configuration for Python linters would be setup.cfg file
http://renesd.blogspot.com/2017/02/setupcfg-solution-to-python-config-file.html

Some more info for consideration with pylint:
https://codewithoutrules.com/2016/10/19/pylint/

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
.travis.yml Outdated
script: flake8
- stage: linting-pylint
script: pylint --rcfile=setup.cfg *
- stage: lint-shellcheck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove duplicated shellcheck stage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

setup.cfg Outdated
ignore = D203,H201,H302,H405
# H106: Don’t put vim configuration in source files
# H203: Use assertIs(Not)None to check for None
enable-extensions = H106,H203
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Hxxx are comming from OpenStack hacking https://docs.openstack.org/hacking/latest/ so it also need to be installed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

setup.cfg Outdated
builtins = _

[pylint]
disable = C0103,C0111,F0010
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put comments with description what are you disabling (like in 2-5 lines)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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

Successfully merging this pull request may close these issues.

3 participants