Skip to content

Commit

Permalink
Merge pull request #688 from prospector-dev/all-profile
Browse files Browse the repository at this point in the history
Be able to render profile on all textual output
  • Loading branch information
sbrunner authored Oct 22, 2024
2 parents 4759399 + 0ae719e commit 3ca5440
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions prospector/formatters/base_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ def render_summary(self) -> str:
output.append(f" {label.rjust(label_width)}: {value}")

return "\n".join(output)

def render_profile(self) -> str:
output = ["Profile", "=======", "", self.profile.as_yaml().strip()]

return "\n".join(output)
3 changes: 3 additions & 0 deletions prospector/formatters/pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def render(self, summary: bool = True, messages: bool = True, profile: bool = Fa
}
)

if profile:
output.append("")
output.append(self.render_profile())
if summary:
output.append("")
output.append(self.render_summary())
Expand Down
5 changes: 0 additions & 5 deletions prospector/formatters/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ def render_messages(self) -> str:

return "\n".join(output)

def render_profile(self) -> str:
output = ["Profile", "=======", "", self.profile.as_yaml().strip()]

return "\n".join(output)

def render(self, summary: bool = True, messages: bool = True, profile: bool = False) -> str:
output = []
if messages and self.messages: # if there are no messages, don't render an empty header
Expand Down
3 changes: 3 additions & 0 deletions prospector/formatters/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def render(self, summary: bool = True, messages: bool = True, profile: bool = Fa
"message": message.message.strip(),
}
)
if profile:
output.append("")
output.append(self.render_profile())
if summary:
output.append("")
output.append(self.render_summary())
Expand Down

0 comments on commit 3ca5440

Please sign in to comment.