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

chore: Refactor statistics file handling and improve logging #121

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion analyser/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from analyser.utils.repository_actions import remove_excluded_files

logger: stdlib.BoundLogger = get_logger()
DEFAULT_FILE_LOCATION = "statistics/repository_statistics.json"


def create_statistics() -> None:
Expand All @@ -27,6 +28,7 @@ def create_statistics() -> None:
list_of_repositories.append(catalogued_repository)

logger.info("List of repositories", list_of_repositories=list_of_repositories)

DataFrame(
[
{
Expand All @@ -38,7 +40,8 @@ def create_statistics() -> None:
}
for repository in list_of_repositories
]
).to_json("statistics/repository_statistics.json", orient="records")
).to_json(DEFAULT_FILE_LOCATION, orient="records")
logger.info("Saved statistics to file", file_location=DEFAULT_FILE_LOCATION)


def create_repository_statistics(repository_name: str, path_to_repo: str) -> CataloguedRepository:
Expand Down
1 change: 1 addition & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ python -m analyser
if [ "$CI" = "true" ]; then
# if running in GitHub Actions, copy the output to the output directory
cp statistics/repository_statistics.json github/workspace/repository_statistics.json
echo "Copied statistics to github/workspace"
fi
Loading