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

Fix incompatibility with isort configuration file #263

Merged
merged 1 commit into from Oct 22, 2019

Commits on Oct 16, 2019

  1. Fix incompatibility with isort configuration file

    The checker uses 'isort' to know if an imported library is in the
    standard library or is a third party library. Then, for third party
    libraries, the check will fail if it is not declared in the addon
    manifest's external dependencies.
    
    Some python modules are known to be used by Odoo and do not need to
    be declared in the external dependencies. These libraries are listed
    in a whitelist of the checker.
    
    isort's SortImports class is initialized with an argument
    'known_standard_library' where the whitelist is passed. It forces
    isort to consider them as standard library, thus ignoring the check.
    
    However, when the project's directory contains an '.isort.cfg' file,
    because the project uses isort to actually sort the imports in the code,
    the file usually contains a line such as:
    
    [settings]
    known_third_party = dateutil,openupgradelib,pkg_resources,psycopg2,requests,setuptools,urllib2,yaml
    
    This line is necessary for isort to move the imports at the expected
    place, after the standard imports.
    
    When this file is present, the isort's 'place_module()' method will
    consider it when called by the checker, and will consider the
    whitelisted modules to be third party instead of the "expected" standard
    library.
    
    This commit directly checks if the module is in the whitelist, so we
    avoid the confusion. isort is now only used to distinguish the standard
    and third party which are not in the whitelist.
    
    Fixes OCA#247
    guewen committed Oct 16, 2019
    Configuration menu
    Copy the full SHA
    1393476 View commit details
    Browse the repository at this point in the history