#136 Don't add contributor's name if email is not found
Opened 7 years ago by batman. Modified 7 years ago
batman/pagure-importer error  into  master

@@ -114,12 +114,13 @@ 

      project_commits = project.get_commits()

      contributors = []

      for commit in project_commits:

-         contributor = {'fullname': commit.author.name,

-                        'emails': commit.commit.author.email,

-                        'name': commit.author.login}

-         if contributor not in contributors:

-             contributors.append(contributor)

-             click.echo('contributor added: ' + contributor['name'])

+         if commit.author is not None and commit.author.email is not None:

if you add a try except block around this code it should work. I think it is acceptable to ignore the exception here.

+             contributor = {'fullname': commit.author.name,

+                         'emails': commit.commit.author.email,

+                         'name': commit.author.login}

+             if contributor not in contributors:

+                 contributors.append(contributor)

+                 click.echo('contributor added: ' + contributor['name'])

  

      with open('contributors.json', 'w') as f:

          f.write(json.dumps(contributors))

All we look for while going through the commits of a
project is the emails and if we don't find that. There
is no point of entering their name

instead of having the continue you could test that commit.author or commit.author.email is not None

rebased

7 years ago

rebased

7 years ago

I think commit.author.email fails with fedora-infra/bodhi. pygithub is throwing an exception.
To be safe we could add a try except block around these tests

rebased

7 years ago

did you try it on bodhi ?

did you try it on bodhi ?

Yeah, it fails :/

if you add a try except block around this code it should work. I think it is acceptable to ignore the exception here.

Metadata