conan-io / hooks

Official Conan client hooks
MIT License
33 stars 46 forks source link

[bug][recipe linter] Reports missing-function-docstring for init, imports, and deploy #191

Open cguldner opened 4 years ago

cguldner commented 4 years ago

When running the recipe_linter.py checker, it seems to not report the missing-function-docstring for most of the builtin Conan functions. But with Conan 1.24, init was added as a function, and that should probably be added to the list

Also, imports and deploy are reporting this as well.

uilianries commented 4 years ago

Hi @cguldner ! Could please add a log with that error?

cguldner commented 4 years ago

@uilianries I'm not sure it will tell you much, but here:

[HOOK - recipe_linter.py] pre_export(): Lint recipe '/path/conanfile.py'
[HOOK - recipe_linter.py] pre_export(): recipes/conanfile.py:36:4: C0116: Missing function or method docstring (missing-function-docstring)
[HOOK - recipe_linter.py] pre_export(): recipes/conanfile.py:46:4: C0116: Missing function or method docstring (missing-function-docstring)
[HOOK - recipe_linter.py] pre_export(): recipes/conanfile.py:75:4: C0116: Missing function or method docstring (missing-function-docstring)

The functions on those lines are init, imports, and deploy

uilianries commented 4 years ago

@cguldner Thanks! Yes, it helps, now it's clear.

uilianries commented 4 years ago

@cguldner Could you please share your conanfile.py for reproducibility ?

cguldner commented 4 years ago

@uilianries Here's a simplified version


import os
from conans import ConanFile

class Conan(ConanFile):
    name = "conan"
    version = "1.0"
    python_requires = "base/1.0@user/channel"
    python_requires_extend = "base.BaseConan"

    def _base_conan(self):
        return self.python_requires["base"].module.BaseConan

    def init(self):
        base = self._base_conan()
        self.settings = set(base.settings + self.settings)
        self.generators = set(base.generators + self.generators)
        self.options = dict(base.options, **self.options)
        self.license = base.license

    def imports(self):
        self.copy("*", dst=os.environ.get("INSTALL_PREFIX"))

    def deploy(self):
        self.copy("*", dst=os.environ.get("INSTALL_PREFIX"))

And the corresponding log

[HOOK - recipe_linter.py] pre_export(): Lint recipe '/accts/cguldner/spoc/oms_devkit/recipes/oms_subsystem_api.py'
[HOOK - recipe_linter.py] pre_export(): recipes/oms_subsystem_api.py:1:0: C0114: Missing module docstring (missing-module-docstring)
[HOOK - recipe_linter.py] pre_export(): recipes/oms_subsystem_api.py:10:0: C0115: Missing class docstring (missing-class-docstring)
[HOOK - recipe_linter.py] pre_export(): recipes/oms_subsystem_api.py:19:4: C0116: Missing function or method docstring (missing-function-docstring)
[HOOK - recipe_linter.py] pre_export(): recipes/oms_subsystem_api.py:26:4: C0116: Missing function or method docstring (missing-function-docstring)
[HOOK - recipe_linter.py] pre_export(): recipes/oms_subsystem_api.py:29:4: C0116: Missing function or method docstring (missing-function-docstring)
[HOOK - recipe_linter.py] pre_export(): Linter detected '0' errors
uilianries commented 4 years ago

@cguldner Thanks a lot