#6874 pylint 1.7.1 fails
Closed: fixed 3 years ago Opened 3 years ago by cheimes.

AttributeError: 'Module' object has no attribute 'source_file'

Node objects no longer have a source_file attribute. node.path seems to work.

Traceback (most recent call last):
  File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File ".../pylint/lint.py", line 208, in run
    result = self._run_linter(file_or_module[0])
  File ".../pylint/lint.py", line 237, in _run_linter
    linter.check(file_or_module)
  File ".../pylint/lint.py", line 726, in check
    self._do_check(files_or_modules)
  File ".../pylint/lint.py", line 855, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File ".../pylint/lint.py", line 934, in check_astroid_module
    walker.walk(ast_node)
  File ".../pylint/utils.py", line 970, in walk
    cb(astroid)
  File ".../pylint_plugins.py", line 325, in visit_module
    self._get_forbidden_import_rule(node))
  File ".../pylint_plugins.py", line 314, in _get_forbidden_import_rule
    path = node.source_file
AttributeError: 'Module' object has no attribute 'source_file'

Additional warnings and failures

pylint 1.7 has additional checkers

************* Module ipaclient.plugins.automount
lib/python2.7/site-packages/ipaclient/plugins/automount.py:106: [C1801(len-as-condition), automountlocation_tofiles.output_for_cli] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipaclient/plugins/automount.py:171: [C1801(len-as-condition), automountlocation_import.forward] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipaclient/plugins/automount.py:230: [C1801(len-as-condition), automountlocation_import.forward] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipaclient/plugins/automount.py:278: [C1801(len-as-condition), automountlocation_import.output_for_cli] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipaclient/plugins/automount.py:288: [C1801(len-as-condition), automountlocation_import.output_for_cli] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipaclient/plugins/automount.py:297: [C1801(len-as-condition), automountlocation_import.output_for_cli] Do not use `len(SEQUENCE)` as condition value)
************* Module ipaclient.csrgen
lib/python2.7/site-packages/ipaclient/csrgen.py:441: [W1646(invalid-str-codec), OpenSSLAdaptor.sign_csr] non-text encoding used in str.decode)
************* Module ipaclient.remote_plugins.schema
lib/python2.7/site-packages/ipaclient/remote_plugins/schema.py:244: [R1705(no-else-return), _SchemaCommandPlugin.NO_CLI] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipaclient/remote_plugins/schema.py:576: [E1101(no-member), get_package] Instance of 'module' has no 'register' member)
************* Module ipalib.text
lib/python2.7/site-packages/ipalib/text.py:137: [W1641(eq-without-hash), LazyText] Implementing __eq__ without also implementing __hash__)
lib/python2.7/site-packages/ipalib/text.py:193: [C0205(single-string-used-for-slots), Gettext] Class __slots__ should be a non-string iterable)
lib/python2.7/site-packages/ipalib/text.py:256: [R1705(no-else-return), Gettext.as_unicode] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/text.py:271: [C0205(single-string-used-for-slots), FixMe] Class __slots__ should be a non-string iterable)
lib/python2.7/site-packages/ipalib/text.py:411: [R1705(no-else-return), NGettext.__call__] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/text.py:445: [R1705(no-else-return), ConcatenatedLazyText.__add__] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/text.py:451: [R1705(no-else-return), ConcatenatedLazyText.__radd__] Unnecessary "else" after "return")
************* Module ipalib.config
lib/python2.7/site-packages/ipalib/config.py:276: [E1137(unsupported-assignment-operation), Env.__setitem__] 'self.__d' does not support item assignment)
lib/python2.7/site-packages/ipalib/config.py:382: [C1801(len-as-condition), Env._merge_from_file] Do not use `len(SEQUENCE)` as condition value)
************* Module ipalib.plugable
lib/python2.7/site-packages/ipalib/plugable.py:166: [R1705(no-else-return), Plugin.__summary_getter] Unnecessary "else" after "return")
************* Module ipalib.aci
lib/python2.7/site-packages/ipalib/aci.py:43: [W1641(eq-without-hash), ACI] Implementing __eq__ without also implementing __hash__)
lib/python2.7/site-packages/ipalib/aci.py:167: [C1801(len-as-condition), ACI.validate] Do not use `len(SEQUENCE)` as condition value)
************* Module ipalib.util
lib/python2.7/site-packages/ipalib/util.py:145: [R1705(no-else-return), isvalid_base64] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/util.py:195: [R1705(no-else-return), normalize_zone] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/util.py:952: [R1705(no-else-return), detect_dns_zone_realm_type] Unnecessary "else" after "return")
************* Module ipalib.x509
lib/python2.7/site-packages/ipalib/x509.py:96: [R1705(no-else-return), strip_header] Unnecessary "else" after "return")
************* Module ipalib.parameters
lib/python2.7/site-packages/ipalib/parameters.py:126: [R1705(no-else-return), _is_null] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/parameters.py:219: [C1801(len-as-condition), DefaultFrom.__init__] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/parameters.py:759: [R1705(no-else-return), Param.normalize] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/parameters.py:841: [C1801(len-as-condition), Param.convert] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/parameters.py:1229: [E1130(invalid-unary-operand-type), Decimal._enforce_precision] bad operand type for unary -: precision)
lib/python2.7/site-packages/ipalib/parameters.py:1340: [R1705(no-else-return), Data._rule_pattern] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/parameters.py:1502: [W0235(useless-super-delegation), IA5Str.__init__] Useless super delegation in method '__init__')
lib/python2.7/site-packages/ipalib/parameters.py:1557: [R1705(no-else-return), Enum._rule_values] Unnecessary "else" after "return")
************* Module ipapython.log_manager
lib/python2.7/site-packages/ipapython/log_manager.py:1362: [R1704(redefined-argument-from-local), LogManager.remove_handler] Redefining argument with the local name 'logger')
************* Module ipapython.ipavalidate
lib/python2.7/site-packages/ipapython/ipavalidate.py:34: [R1705(no-else-return), Email] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipavalidate.py:61: [R1705(no-else-return), Plain] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipavalidate.py:79: [R1705(no-else-return), String] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipavalidate.py:100: [R1705(no-else-return), Path] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipavalidate.py:128: [R1705(no-else-return), GoodName] Unnecessary "else" after "return")
************* Module ipapython.dn
lib/python2.7/site-packages/ipapython/dn.py:529: [R1705(no-else-return), cmp_rdns] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/dn.py:877: [C1801(len-as-condition), RDN._get_attr] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipapython/dn.py:882: [C1801(len-as-condition), RDN._set_attr] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipapython/dn.py:890: [C1801(len-as-condition), RDN._get_value] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipapython/dn.py:895: [C1801(len-as-condition), RDN._set_value] Do not use `len(SEQUENCE)` as condition value)
************* Module ipapython.ssh
lib/python2.7/site-packages/ipapython/ssh.py:157: [R1705(no-else-return), SSHPublicKey._parse_openssh] Unnecessary "else" after "return")
************* Module ipalib.rpc
lib/python2.7/site-packages/ipalib/rpc.py:178: [R1705(no-else-return), xml_wrap] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/rpc.py:184: [R1705(no-else-return), xml_wrap] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/rpc.py:217: [R1705(no-else-return), xml_unwrap] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/rpc.py:348: [R1705(no-else-return), _JSONPrimer._enc_datetime] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/rpc.py:359: [R1705(no-else-return), _JSONPrimer._enc_dnsname] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/rpc.py:397: [R1705(no-else-return), json_encode_binary] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/rpc.py:408: [R1705(no-else-return), _ipa_obj_hook] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/rpc.py:492: [R1705(no-else-return), MultiProtocolTransport.getparser] Unnecessary "else" after "return")
************* Module ipalib.frontend
lib/python2.7/site-packages/ipalib/frontend.py:529: [C1801(len-as-condition), Command.args_options_2_params] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/frontend.py:532: [C1801(len-as-condition), Command.args_options_2_params] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/frontend.py:841: [C1801(len-as-condition), Command._on_finalize] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/frontend.py:1338: [R1705(no-else-return), Attribute.obj_full_name] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/frontend.py:1351: [R1705(no-else-return), Attribute.obj] Unnecessary "else" after "return")
************* Module ipalib.cli
lib/python2.7/site-packages/ipalib/cli.py:122: [C1801(len-as-condition), textui.max_col_width] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/cli.py:171: [R1705(no-else-return), textui.encode_binary] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/cli.py:304: [C1801(len-as-condition), textui.print_attribute] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/cli.py:311: [C1801(len-as-condition), textui.print_attribute] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/cli.py:324: [C1801(len-as-condition), textui.print_attribute] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/cli.py:847: [C1801(len-as-condition), help.print_commands] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/cli.py:975: [C1801(len-as-condition), show_api.__traverse_namespace] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/cli.py:997: [E1137(unsupported-assignment-operation), Collector.__setattr__] 'self.__options' does not support item assignment)
lib/python2.7/site-packages/ipalib/cli.py:1069: [C1801(len-as-condition), cli.get_command] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/cli.py:1076: [C1801(len-as-condition), cli.get_command] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipalib/cli.py:1117: [R1705(no-else-return), cli.run] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/cli.py:1213: [R1705(no-else-return), cli.__get_arg_name] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipalib/cli.py:1327: [R1705(no-else-return), IPAHelpFormatter.format_description] Unnecessary "else" after "return")
************* Module ipapython.ipautil
lib/python2.7/site-packages/ipapython/ipautil.py:31: [W1648(bad-python3-import), ] Module moved in Python 3)
lib/python2.7/site-packages/ipapython/ipautil.py:238: [R1705(no-else-return), format_netloc] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipautil.py:286: [R1705(no-else-return), shell_quote] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipautil.py:295: [R1705(no-else-return), _log_arg] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipautil.py:628: [R1705(no-else-return), CIDict.keys] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipautil.py:634: [R1705(no-else-return), CIDict.items] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipautil.py:640: [R1705(no-else-return), CIDict.values] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipautil.py:716: [C1801(len-as-condition), GeneralizedTimeZone.__init__] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipapython/ipautil.py:758: [C1801(len-as-condition), parse_generalized_time] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipapython/ipautil.py:770: [C1801(len-as-condition), parse_generalized_time] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipapython/ipautil.py:781: [C1801(len-as-condition), parse_generalized_time] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipapython/ipautil.py:786: [C1801(len-as-condition), parse_generalized_time] Do not use `len(SEQUENCE)` as condition value)
************* Module ipapython.config
lib/python2.7/site-packages/ipapython/config.py:155: [C1801(len-as-condition), IPAConfig.get_server] Do not use `len(SEQUENCE)` as condition value)
lib/python2.7/site-packages/ipapython/config.py:250: [C1801(len-as-condition), init_config] Do not use `len(SEQUENCE)` as condition value)
************* Module ipapython.ipaldap
lib/python2.7/site-packages/ipapython/ipaldap.py:169: [W1641(eq-without-hash), LDAPEntry] Implementing __eq__ without also implementing __hash__)
lib/python2.7/site-packages/ipapython/ipaldap.py:849: [R1705(no-else-return), LDAPClient.encode] Unnecessary "else" after "return")
lib/python2.7/site-packages/ipapython/ipaldap.py:882: [R1705(no-else-return), LDAPClient.decode] Unnecessary "else" after "return")

https://github.com/freeipa/freeipa/pull/720 is a band-aid for 4.5 and 4.6 until all issues have been addressed.

Metadata Update from @mbasti:
- Issue assigned to mbasti

3 years ago

Metadata Update from @mbasti:
- Issue set to the milestone: FreeIPA 4.6

3 years ago

master:

  • b64ec75 tox: use pylint 1.6.x for now

master:

  • 5f640de Pylint: fix ipa_forbidden_import checker
  • 7eb02a4 pylint: ignore new checks added in 1.7

Metadata Update from @mbasti:
- Issue assigned to stlaz (was: mbasti)

3 years ago

I am currently working on fixing this, please note that there are also false positives on python3 move of stat module which did not really happen:
https://bugzilla.redhat.com/show_bug.cgi?id=1483869

master:

  • e6a9de8 py3: remove Exception.message appearances
  • 2bc5b7f py3: remove relative import

Metadata Update from @tkrizek:
- Issue set to the milestone: FreeIPA 4.6.1 (was: FreeIPA 4.6)

3 years ago

master:

  • a765746 pylint: fix not-context-manager false positives
  • 806784d csrgen: fix incorrect codec for pyasn BitString
  • b57f87c pylint: fix no-member in schema plugin
  • 216d37b dcerpc: refactor assess_dcerpc_exception
  • 3c616d7 dcerpc: disable unbalanced-tuple-unpacking
  • f7fc3a3 parameters: convert Decimal.precision to int
  • 353d493 pylint: Iterate through dictionaries
  • 33f13b6 sudocmd: fix unsupported assignment
  • f2701f3 pylint: make unsupported-assignment-operation check local
  • ae0bd12 install.util: disable no-value-for-parameter
  • fab589d pylint: disable hash for some classes
  • 82d0279 secrets: disable relative-imports for custodia
  • 0ae2473 rpcserver: don't call xmlserver.Command
  • c7f9015 Change the requirements for pylint in wheel
  • 76c6ffe Change Travis CI container to FreeIPA-owned
  • a30095b travis: remove "fast" from "makecache fast"

Metadata Update from @stlaz:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

3 years ago

Metadata Update from @stlaz:
- Issue status updated to: Open (was: Closed)

3 years ago

ipa-4-6:

  • 0565600 Travis: archive logs of py3 jobs
  • ce148ed pylint: fix not-context-manager false positives
  • 47352fb csrgen: fix incorrect codec for pyasn BitString
  • 7c64aca pylint: fix no-member in schema plugin
  • 0b8207d dcerpc: refactor assess_dcerpc_exception
  • f80af62 dcerpc: disable unbalanced-tuple-unpacking
  • 25d8229 parameters: convert Decimal.precision to int
  • 06f3aad pylint: Iterate through dictionaries
  • 568926f sudocmd: fix unsupported assignment
  • 9cf1f1d pylint: make unsupported-assignment-operation check local
  • e67cdb0 install.util: disable no-value-for-parameter
  • 2952af4 pylint: disable hash for some classes
  • 388bc94 secrets: disable relative-imports for custodia
  • dfeadfe rpcserver: don't call xmlserver.Command
  • 0449a4c Change the requirements for pylint in wheel
  • 79d9bdc Change Travis CI container to FreeIPA-owned
  • 4f4b0ef travis: remove "fast" from "makecache fast"

Metadata Update from @stlaz:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata