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

pep8 conformance #259

Closed
piyushk opened this issue Mar 18, 2014 · 1 comment
Closed

pep8 conformance #259

piyushk opened this issue Mar 18, 2014 · 1 comment
Assignees

Comments

@piyushk
Copy link
Collaborator

piyushk commented Mar 18, 2014

All packages in this repository should conform to pep8. To enable automated testing:

  • Add a build dependency on roslint:
<build_depend>roslint</build_depend>
  • Enable roslint macros and call them:
find_package(catkin REQUIRED COMPONENTS roslint)
...
# Lint Python modules for PEP8 compatibility
file(GLOB_RECURSE ${PROJECT_NAME}_PY_SCRIPTS
     RELATIVE ${PROJECT_SOURCE_DIR} scripts/*)
file(GLOB_RECURSE ${PROJECT_NAME}_PY_SRC
RELATIVE ${PROJECT_SOURCE_DIR} src/${PROJECT_NAME}/*.py)
roslint_python(${${PROJECT_NAME}_PY_SCRIPTS})
roslint_python(${${PROJECT_NAME}_PY_SRC})
  • Test pep8 conformance using:
catkin_make roslint_<package_name>

To automatically cut down a lot of errors:

sudo pip install autopep8
autopep8 --max-line-length 120 --in-place scripts/*
autopep8 --max-line-length 120 --in-place src/<package-name>/*.py

You can also try the --aggresive for more aggresive correction. See autopep8 --help.

@stonier
Copy link
Member

stonier commented Mar 18, 2014

@piyushk moving this thread to the rocon repo where everyone can refer to as it's relevant for all rocon repos.

robotics-in-concert/rocon#12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants