Projet

Général

Profil

Bug #74065

pylint 2.16 : beaucoup de R1735(use-dict-literal)

Ajouté par Thomas Noël il y a environ un an. Mis à jour il y a environ un an.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
-
Début:
01 février 2023
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

Sur le nouveau pylint 2.16 est relevé l'usage de dict(...), voir ci-dessous.

Soit il faut corriger le code, soit ajouter des #noqa, soit use-dict-literal ignorer dans pylintrc.

Je préfère laisser la main sur ce sujet à quelqu'un de plus légitime que moi sur le code d'Authentic.

************* Module tests.test_idp_saml2
tests/test_idp_saml2.py:220: [R1735(use-dict-literal), SamlSP.get_metadata] Consider using '{"base_url": self.base_url, "binding": self.binding, "keys": self.keys, ... }' instead of a call to 'dict'.
tests/test_idp_saml2.py:543: [R1735(use-dict-literal), test_sso_redirect_post] Consider using '{"binding": 'post'}' instead of a call to 'dict'.
tests/test_idp_saml2.py:552: [R1735(use-dict-literal), test_sso_post_post] Consider using '{"binding": 'post'}' instead of a call to 'dict'.
tests/test_idp_saml2.py:561: [R1735(use-dict-literal), test_sso_redirect_artifact] Consider using '{"binding": 'artifact', "keys": keys}' instead of a call to 'dict'.
tests/test_idp_saml2.py:577: [R1735(use-dict-literal), test_sso_no_name_id_policy_redirect] Consider using '{"name_id_policy": False}' instead of a call to 'dict'.
tests/test_idp_saml2.py:587: [R1735(use-dict-literal), test_sso_nid_username] Consider using '{"default_name_id_format": 'username'}' instead of a call to 'dict'.
tests/test_idp_saml2.py:588: [R1735(use-dict-literal), test_sso_nid_username] Consider using '{"name_id_policy": False}' instead of a call to 'dict'.
tests/test_idp_saml2.py:600: [R1735(use-dict-literal), test_sso_nid_uuid] Consider using '{"default_name_id_format": 'uuid'}' instead of a call to 'dict'.
tests/test_idp_saml2.py:601: [R1735(use-dict-literal), test_sso_nid_uuid] Consider using '{"name_id_policy": False}' instead of a call to 'dict'.
tests/test_idp_saml2.py:637: [R1735(use-dict-literal), test_sso_redirect_artifact_login_hints] Consider using '{"binding": 'artifact', "keys": keys}' instead of a call to 'dict'.
tests/test_idp_saml2.py:650: [R1735(use-dict-literal), test_sso_redirect_artifact_next_url] Consider using '{"binding": 'artifact', "keys": keys}' instead of a call to 'dict'.
************* Module tests.test_utils_evaluate
tests/test_utils_evaluate.py:87: [R1735(use-dict-literal), test_evaluate_condition] Consider using '{"a": True, "b": False}' instead of a call to 'dict'.
tests/test_utils_evaluate.py:88: [R1735(use-dict-literal), test_evaluate_condition] Consider using '{"a": 0}' instead of a call to 'dict'.
************* Module tests.test_data_transfer
tests/test_data_transfer.py:241: [R1735(use-dict-literal), test_role_deserializer_with_attributes] Consider using '{"name": 'is_superuser', "kind": 'string', "value": 'true'}' instead of a call to 'dict'.
tests/test_data_transfer.py:242: [R1735(use-dict-literal), test_role_deserializer_with_attributes] Consider using '{"name": 'emails', "kind": 'json', "value": '["a@a.com"]'}' instead of a call to 'dict'.
************* Module tests.test_import_export_site_cmd
tests/test_import_export_site_cmd.py:93: [W0719(broad-exception-raised), test_import_site_transaction_rollback_on_error.exception_import_site] Raising too general exception: Exception
************* Module tests.idp_oidc.conftest
tests/idp_oidc/conftest.py:88: [R1735(use-dict-literal), make_client] Consider using '{"label": 'cityscape', "kind": 'profile_image', "asked_on_registration": True, ... }' instead of a call to 'dict'.
************* Module src.authentic2.app_settings
src/authentic2/app_settings.py:96: [R1735(use-dict-literal), ] Consider using '{"ATTRIBUTE_BACKENDS": Setting(names=('A2_ATTRIBUTE_BACKENDS', ), default=('authentic2.attributes_ng.sources.format', 'authentic2.attributes_ng.sources.function', 'authentic2.attributes_ng.sources.django_user', 'authentic2.attributes_ng.sources.ldap', 'authentic2.attributes_ng.sources.service_roles'), definition='List of attribute backend classes or modules'), ... }' instead of a call to 'dict'.
************* Module src.authentic2.idp.saml.app_settings
src/authentic2/idp/saml/app_settings.py:21: [R1735(use-dict-literal), AppSettings] Consider using '{"ENABLE": False, "METADATA_OPTIONS": {}, "SECONDS_TOLERANCE": 60}' instead of a call to 'dict'.
************* Module src.authentic2.idp.saml.saml2_endpoints
src/authentic2/idp/saml/saml2_endpoints.py:430: [W0719(broad-exception-raised), build_assertion] Raising too general exception: Exception
************* Module src.authentic2.a2_rbac.management
src/authentic2/a2_rbac/management.py:117: [R1735(use-dict-literal), update_content_types_roles] Consider using '{"name": gettext('Manager')}' instead of a call to 'dict'.
************* Module src.authentic2.a2_rbac.app_settings
src/authentic2/a2_rbac/app_settings.py:21: [R1735(use-dict-literal), AppSettings] Consider using '{"MANAGED_CONTENT_TYPES": None, "ROLE_ADMIN_RESTRICT_TO_OU_USERS": False, ... }' instead of a call to 'dict'.
************* Module src.authentic2.forms.widgets
src/authentic2/forms/widgets.py:176: [R1735(use-dict-literal), PickerWidgetMixin.render] Consider using '{"id": id, "rendered_widget": rendered_widget, "clear_button": CLEAR_BTN_TEMPLATE if self.options.get('clearBtn') else '', ... }' instead of a call to 'dict'.
************* Module src.authentic2.saml.common
src/authentic2/saml/common.py:133: [W0719(broad-exception-raised), create_saml2_server] Raising too general exception: Exception
src/authentic2/saml/common.py:455: [W0719(broad-exception-raised), lookup_federation_by_user] Raising too general exception: Exception
************* Module src.authentic2.saml.x509utils
src/authentic2/saml/x509utils.py:95: [W0719(broad-exception-raised), generate_rsa_keypair] Raising too general exception: Exception
src/authentic2/saml/x509utils.py:98: [W0719(broad-exception-raised), generate_rsa_keypair] Raising too general exception: Exception
************* Module src.authentic2.disco_service.disco_responder
src/authentic2/disco_service/disco_responder.py:196: [R1735(use-dict-literal), disco] Consider using '{"return_url": return_url, "entity_id": entityID}' instead of a call to 'dict'.
************* Module src.authentic2.backends.ldap_backend
src/authentic2/backends/ldap_backend.py:435: [E0601(used-before-assignment), LDAPUser.save] Using variable 'pk' before assignment
************* Module src.authentic2.apps.journal.models
src/authentic2/apps/journal/models.py:65: [C0204(bad-mcs-classmethod-argument), EventTypeDefinitionMeta.__new__] Metaclass class method __new__ should have 'mcs' as first argument
************* Module src.authentic2_auth_oidc.utils
src/authentic2_auth_oidc/utils.py:260: [R1735(use-dict-literal), register_issuer] Consider using '{"ou": ou or get_default_ou(), "name": name, "issuer": openid_configuration['issuer'], ... }' instead of a call to 'dict'.

Fichiers

Révisions associées

Révision 03c44502 (diff)
Ajouté par Paul Marillonnet il y a environ un an

pylint.rc: ignore use-dict-literal (R1735) error (#74065)

Révision 3e32808e (diff)
Ajouté par Paul Marillonnet il y a environ un an

codestyle: fix metaclass constructor's first argument name (#74065)

Révision 70efa06a (diff)
Ajouté par Paul Marillonnet il y a environ un an

pylint: disable error on seemingly used-before-assigned variable (#74065)

Historique

#1

Mis à jour par Paul Marillonnet il y a environ un an

  • Statut changé de Nouveau à En cours
  • Assigné à mis à Paul Marillonnet
#3

Mis à jour par Frédéric Péters il y a environ un an

  • Statut changé de Solution proposée à Solution validée

Pas enthousiaste sur la désactivation globale de use-dict-literal. (parce qu'à la base pas fan de l'emploi de la forme dict(a=b, c=d) pour créer des dictionnaires, et que c'était l'occasion de dégager ça), mais je regardais si pyupgrade pouvait faire le changement automatiquement et ça n'est pas le cas, donc en attendant que peut-être ça vienne, go ainsi plutôt que le taf barbant.

#4

Mis à jour par Paul Marillonnet il y a environ un an

  • Statut changé de Solution validée à Résolu (à déployer)
commit 70efa06a304058011bbe95331869912b70aa2bb5
Author: Paul Marillonnet <pmarillonnet@entrouvert.com>
Date:   Fri Feb 3 09:22:22 2023 +0100

    pylint: disable error on seemingly used-before-assigned variable (#74065)

commit 3e32808e606ef6e85d256b1c1bad17316ba27668
Author: Paul Marillonnet <pmarillonnet@entrouvert.com>
Date:   Fri Feb 3 09:21:43 2023 +0100

    codestyle: fix metaclass constructor's first argument name (#74065)

commit 03c44502d30cb10d306b8eacac14f63caea04f3f
Author: Paul Marillonnet <pmarillonnet@entrouvert.com>
Date:   Fri Feb 3 08:37:43 2023 +0100

    pylint.rc: ignore use-dict-literal (R1735) error (#74065)
#5

Mis à jour par Transition automatique il y a environ un an

  • Statut changé de Résolu (à déployer) à Solution déployée
#6

Mis à jour par Transition automatique il y a environ un an

Automatic expiration

Formats disponibles : Atom PDF