pylint warnings

Issue #436 resolved
Frank Dellaert created an issue

Wondering whether we can get rid of

# pylint: disable=invalid-name, no-name-in-module, no-member

by being even smarter about python wrapper

Tagging @thduynguyen and @matt_broadway

Comments (4)

  1. matthew.broadway

    these look more like bugs/limitations of pylint.

    no-name-in-module is because the gtsam module imports everything from the shared library file. It was decided that pylint shouldn't load shared libraries by default for security reasons: https://stackoverflow.com/questions/28437071/pylint-1-4-reports-e1101no-member-on-all-c-extensions

    individual users should be able to put the following in their .pylintrc or pass --extension-pkg-whitelist=gtsam (or the more heavy handed --unsafe-load-any-extension=y) at the command line, but for some reason this didn't work for me.

    [MASTER]
    extension-pkg-whitelist=gtsam
    

    I didn't get any no-member warnings in my testing

    invalid-name is because the camel case naming convention that GTSAM uses isn't pep8 (which requires snake case). Perhaps the wrapper could automatically convert names from camel case to snake case? but then users may have a harder time googling for help since googling the snake case name may not give results with the camel case name.

    I can think of a few options

    • continue as-is and write the # pylint: declaration in each file
    • add the options to a .pylintrc file and ask users to copy it to their home (if this can be made to work)
    • might be possible to define __all__ = [...] in __init__.py with all the names from the gtsam shared library and/or dummy assignments in __init__.py like Rot2 = None but this didn't seem to work for my either
    • run pylint from a script or makefile which disables these warnings from the command line
    • write a plugin for pylint (this has been suggested for other projects with similar problems)
    • maybe use another linter like pycodestyle and pyflakes

    if a plugin was created, it could be more specific about only ignoring warnings originating from the gtsam module. https://pylint.readthedocs.io/en/stable/how_tos/transform_plugins.html

  2. Frank Dellaert reporter

    I'm think we will continue as-is and write the # pylint: disable= declaration in each file. Will close issue.

  3. Log in to comment