Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added flag -c contributors logging #35

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

DaniilLutfulin
Copy link
Collaborator

No description provided.

@zmm zmm added this to the 0.1 milestone Mar 26, 2024
@zmm zmm added good first issue Good for newcomers feature labels Mar 26, 2024
@zmm
Copy link
Member

zmm commented Apr 11, 2024

Попробовал экспорт, в таблице оказываются не все пользователи. Дал вам админские права на репо - посмотрите вот тут на список участников https://github.com/OSLL/github_repo_commitment_calc/settings/access?query= и попробуйте разобратся, почему не все они оказываются у нас в итоговом файле

@@ -71,8 +72,11 @@ def main():
git_logger.log_issues(client, repositories, csv_name, token, start, finish)
if (args.e):
export_sheets.write_data_to_table(csv_name, args.google_token, args.table_id, args.sheet_id)
if args.invites:
git_logger.log_invitations(client, repositories, csv_name)
if (args.c):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

скобки не нужны тут

if args.c:

git_logger.log_invitations(client, repositories, csv_name)
if (args.c):
git_logger.log_contributors(client, repositories, csv_name)
if (args.e):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

скобки не нужны тут

if args.e:

writer.writerow(info)


def log_repository_contributors(repository: Repository, csv_name):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тайп хинты это здорово
может их указывать для всех аргументов функций, а не только для некоторых?)

'node_id': contributor.node_id,
'type': contributor.type,
'bio': EMPTY_FIELD if contributor.bio is None else contributor.bio,
'site_admin': contributor.site_admin
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше в конце ставить запятую

объясняю почему

было так

a = [
  1,
  2,
  3
]

стало так

a = [
  1,
  2,
  3,
  4
]

по диффу изменилось 2 строки. 1 добавилась, а другая изменилась, хотя мы только добавили строку.

преждевременная запятая способствует более чистому диффу)

'node_id',
'type',
'bio',
'site_admin'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

про запятую подумайте :)

@@ -488,3 +488,59 @@ def log_commits(client: Github, repositories, csv_name, start, finish, branch):
sleep(timedelta)
except Exception as e:
print(e)

def log_contributors_to_csv(info, csv_name):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

может стоит добавить тайп хинты?)

info_tmp = {
'repository name': repository.full_name,
'login': contributor.login,
'name': EMPTY_FIELD if contributor.name is None else contributor.name,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в оракле есть функция nvl https://oracleplsql.ru/nvl-function.html
кажется тут она напрашивается, чтобы вызвать её столько раз сколько нужно, а то для каждого nullable поля писать такой тернарный оператор долго :)

}
log_contributors_to_csv(info_tmp, csv_name)
print(info_tmp)
sleep(timedelta)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это из-за ограничений апи нужно?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+посмотрел по коду и понял, что это константа, может стоит капсом назвать её?

)
)
for repo in get_next_repo(client, repositories):

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

удалить?

try:
log_repository_contributors(repo, csv_name)
sleep(timedelta)
except Exception as e:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а нам точно все исключение нужно перехватывать?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в ридми нет инфы про то, как должен выглядеть список репозиториев
я по дурости сунул туда ссылки на репозитории
а надо не ссылки

так надо thehighestmath/python-code-check-system
а так не надо https://github.com/thehighestmath/python-code-check-system

можете, пожалуйста, добавить это в ридми?

@thehighestmath
Copy link
Collaborator

+прошу Вас добавить .gitignore, чтобы случайный git add . не добавил pycache

@thehighestmath
Copy link
Collaborator

thehighestmath commented Jul 5, 2024

feature-request, хотя это можно в отдельной задаче сделать
а можно ещё добавить количество коммитов, а то смотрю на результат и не совсем понятно насколько большой вклад каждого участника

repository name                         ,login           ,name                ,email       ,url                                ,permissions ,id       ,node_id              ,type ,bio         ,site_admin
thehighestmath/python-code-check-system ,thehighestmath  ,Kirill Kryzhanovsky ,Empty field ,https://github.com/thehighestmath  ,admin       ,42893255 ,MDQ6VXNlcjQyODkzMjU1 ,User ,Empty field ,False
thehighestmath/python-code-check-system ,ArOb-1          ,Artem_dev           ,Empty field ,https://github.com/ArOb-1          ,write       ,75028771 ,MDQ6VXNlcjc1MDI4Nzcx ,User ,Empty field ,False
thehighestmath/python-code-check-system ,GarryKoker      ,Egor                ,Empty field ,https://github.com/GarryKoker      ,write       ,59351926 ,MDQ6VXNlcjU5MzUxOTI2 ,User ,Empty field ,False
thehighestmath/python-code-check-system ,dependabot[bot] ,Empty field         ,Empty field ,https://github.com/apps/dependabot ,none        ,49699333 ,MDM6Qm90NDk2OTkzMzM= ,Bot  ,Empty field ,False

image

@thehighestmath
Copy link
Collaborator

@DaniilLutfulin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Режим -c - вывод списка контрибьюторов
3 participants