libgit2 / libgit2/pygit2

Replace members by getters

Ouverte
#969 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Python
Étoiles
1.7k
Forks
408
Merge moyen
2 j 57 min
PR mergées (30 j)
7

Description

For consistency and better performance (not creating objects that may not be used).

$ grep MEMBER src/*
src/diff.c:    MEMBER(DiffFile, id, T_OBJECT, "Oid of the item."),
src/diff.c:    MEMBER(DiffFile, path, T_STRING, "Path to the entry."),
src/diff.c:    MEMBER(DiffFile, raw_path, T_OBJECT, "Path to the entry (bytes)."),
src/diff.c:    MEMBER(DiffFile, size, T_LONG, "Size of the entry."),
src/diff.c:    MEMBER(DiffFile, flags, T_UINT, "Combination of GIT_DIFF_FLAG_* flags."),
src/diff.c:    MEMBER(DiffFile, mode, T_USHORT, "Mode of the entry."),
src/diff.c:    MEMBER(DiffDelta, status, T_UINT, "A GIT_DELTA_* constant."),
src/diff.c:    MEMBER(DiffDelta, flags, T_UINT, "Combination of GIT_DIFF_FLAG_* flags."),
src/diff.c:    MEMBER(DiffDelta, similarity, T_USHORT, "For renamed and copied."),
src/diff.c:    MEMBER(DiffDelta, nfiles, T_USHORT, "Number of files in the delta."),
src/diff.c:    MEMBER(DiffDelta, old_file, T_OBJECT, "\"from\" side of the diff."),
src/diff.c:    MEMBER(DiffDelta, new_file, T_OBJECT, "\"to\" side of the diff."),
src/note.c:    MEMBER(Note, id, T_OBJECT, "id of the note object."),
src/note.c:    MEMBER(Note, annotated_id, T_OBJECT, "id of the annotated object."),
src/reference.c:    MEMBER(RefLogEntry, oid_new, T_OBJECT, "New oid."),
src/reference.c:    MEMBER(RefLogEntry, oid_old, T_OBJECT, "Old oid."),
src/reference.c:    MEMBER(RefLogEntry, message, T_STRING, "Message."),
src/utils.h:#define MEMBER(type, attr, attr_type, docstr)\
src/utils.h:#define RMEMBER(type, attr, attr_type, docstr)\

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par les définitions de MEMBER et RMEMBER dans src/utils.h, puis examinez leurs utilisations dans src/diff.c, src/note.c et src/reference.c. Remplacez les membres indiqués par des getters tout en préservant les attributs documentés et en évitant de créer des objets inutilisés ; vérifiez que les bindings concernés se comportent de manière cohérente.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
c, python
Domaine
devtools
Type d'issue
Refactorisation
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.