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

Update tutorial.rst #209

Merged
merged 1 commit into from
Mar 3, 2022
Merged
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
8 changes: 4 additions & 4 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ We can also pass a list of repositories (both local and remote), and PyDriller w
Let's make another example: print all the modified files for every commit. This does the magic::

for commit in Repository('path/to/the/repo').traverse_commits():
for modification in commit.modifications:
print('Author {} modified {} in commit {}'.format(commit.author.name, modification.filename, commit.hash))
for file in commit.modified_files:
print('Author {} modified {} in commit {}'.format(commit.author.name, file.filename, commit.hash))

That's it!

Expand All @@ -37,6 +37,6 @@ Behind the scenes, PyDriller opens the Git repository and extracts all the neces
Furthermore, PyDriller can calculate structural metrics of every file changed in a commit. To calculate these metrics, Pydriller relies on `Lizard <https://github.com/terryyin/lizard>`_, a powerful tool that can analyze source code of many different programming languages, both at class and method level! ::

for commit in Repository('path/to/the/repo').traverse_commits():
for mod in commit.modifications:
for file in commit.modified_files:
print('{} has complexity of {}, and it contains {} methods'.format(
mod.filename, mod.complexity, len(mod.methods)))
file.filename, file.complexity, len(file.methods)))