tools/analyze-layer-reuse: include image date in update analysis#73
tools/analyze-layer-reuse: include image date in update analysis#73
Conversation
Just makes it easier to understand what we're analyzing.
There was a problem hiding this comment.
Code Review
This pull request adds the creation date of images to the update analysis, which is a useful enhancement for understanding the context of the analysis. The changes are well-implemented across the data structures and both human-readable and JSON outputs. I've left one comment regarding a minor maintainability improvement in the formatting of the human-readable output to avoid variable shadowing, which is a good practice to follow.
| from_created = f" ({analysis.from_created})" if analysis.from_created else "" | ||
| to_created = f" ({analysis.to_created})" if analysis.to_created else "" | ||
| lines.append(f" From: {analysis.from_ref}{from_created}") | ||
| lines.append(f" To: {analysis.to_ref}{to_created}") |
There was a problem hiding this comment.
The local variables from_created and to_created shadow the attributes of the analysis object. This can make the code harder to read and maintain, and could potentially lead to bugs during future refactoring. It's a good practice to use distinct names for local variables to avoid shadowing.
| from_created = f" ({analysis.from_created})" if analysis.from_created else "" | |
| to_created = f" ({analysis.to_created})" if analysis.to_created else "" | |
| lines.append(f" From: {analysis.from_ref}{from_created}") | |
| lines.append(f" To: {analysis.to_ref}{to_created}") | |
| from_created_str = f' ({analysis.from_created})' if analysis.from_created else '' | |
| to_created_str = f' ({analysis.to_created})' if analysis.to_created else '' | |
| lines.append(f' From: {analysis.from_ref}{from_created_str}') | |
| lines.append(f' To: {analysis.to_ref}{to_created_str}') |
Just makes it easier to understand what we're analyzing.