@@ -88,7 +88,7 @@ def parse(location):
8888 ('homepage' , 'homepage_url' ),
8989 ])
9090
91- # mapping of top level package .json items to a function accepting as arguments
91+ # mapping of top level composer .json items to a function accepting as arguments
9292 # the package.json element value and returning an iterable of key, values Package Object to update
9393 field_mappers = OrderedDict ([
9494 ('authors' , author_mapper ),
@@ -103,7 +103,7 @@ def parse(location):
103103 data = json .load (loc , object_pairs_hook = OrderedDict )
104104
105105 if not data .get ('name' ) or not data .get ('description' ):
106- # a package .json without name and description is not a usable PHP composer package
106+ # a composer .json without name and description is not a usable PHP composer package
107107 return
108108
109109 package = PHPComposerPackage ()
@@ -177,14 +177,13 @@ def licensing_mapper(licenses, package):
177177 return package
178178
179179
180- def author_mapper (author , package ):
180+ def author_mapper (authors_content , package ):
181181 """
182- Update package author and return package.
182+ Update package authors and return package.
183183 https://getcomposer.org/doc/04-schema.md#authors
184- The "author" is one person.
185184 """
186185 authors = []
187- for name , email , url in parse_person (author ):
186+ for name , email , url in parse_person (authors_content ):
188187 authors .append (models .Party (type = models .party_person , name = name , email = email , url = url ))
189188 package .authors = authors
190189 return package
@@ -281,7 +280,7 @@ def repository_mapper(repos, package):
281280
282281def parse_repo_url (repo_url ):
283282 """
284- Validate a repo_ulr and handle shortcuts for GitHub, GitHub gist,
283+ Validate a repo_url and handle shortcuts for GitHub, GitHub gist,
285284 Bitbucket, or GitLab repositories:
286285
287286 See https://getcomposer.org/doc/04-schema.md#repositories
@@ -304,13 +303,11 @@ def parse_repo_url(repo_url):
304303
305304 is_vcs_url = repo_url .startswith (VCS_URLS )
306305 if is_vcs_url :
307- # TODO: ensure the .git suffix is present if needed
308306 return repo_url
309307
310308 if repo_url .startswith ('git@' ):
311309 left , right = repo_url .split ('@' , 1 )
312310 host , repo = right .split (':' , 1 )
313- # may be we should
314311 if any (h in host for h in ['github' , 'bitbucket' , 'gitlab' ]):
315312 return 'https://%(host)s/%(repo)s' % locals ()
316313 else :
@@ -328,7 +325,6 @@ def parse_repo_url(repo_url):
328325 hoster , repo = repo_url .split (':' , 1 )
329326 return hoster_urls [hoster ] % locals ()
330327 elif len (repo_url .split ('/' )) == 2 :
331- # implicit github
332328 return 'https://github.com/%(repo_url)s' % locals ()
333329 return repo_url
334330
@@ -391,4 +387,4 @@ def parse_person(persons):
391387 url = person .get ('homepage' )
392388 yield name and name .strip (), email and email .strip ('<> ' ), url and url .strip ('() ' )
393389 else :
394- raise Exception ('Incorrect PHP composer package .json person: %(person)r' % locals ())
390+ raise Exception ('Incorrect PHP composer composer .json person: %(person)r' % locals ())
0 commit comments