-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move ScannerUI outside of core.ui
This fixes import loop errors when trying to import Commit.
- Loading branch information
1 parent
ddd988f
commit b6469b6
Showing
17 changed files
with
56 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from ggshield.core.scanner_ui.plain_text_scanner_ui import PlainTextScannerUI | ||
from ggshield.core.scanner_ui.rich_scanner_ui import ( | ||
RichMessageOnlyScannerUI, | ||
RichProgressScannerUI, | ||
) | ||
from ggshield.core.ui import get_ui | ||
from ggshield.core.ui.rich import RichGGShieldUI | ||
|
||
from .scanner_ui import ScannerUI | ||
|
||
|
||
def create_scanner_ui(total: int) -> ScannerUI: | ||
""" | ||
Creates a ScannerUI instance. This is used to show progress on scanning | ||
Scannables. | ||
""" | ||
if isinstance(get_ui(), RichGGShieldUI): | ||
return RichProgressScannerUI(get_ui(), total) | ||
else: | ||
return PlainTextScannerUI() | ||
|
||
|
||
def create_message_only_scanner_ui(): | ||
""" | ||
Creates a ScannerUI instance without a progress bar. This is used when the scan | ||
itself is part of a larger scan. For example when scanning a commit range, each | ||
commit gets a message-only ScannerUI. Progress of the commit range scan is | ||
represented by a progress bar created using `create_progress()`. | ||
""" | ||
if isinstance(get_ui(), RichGGShieldUI): | ||
return RichMessageOnlyScannerUI(get_ui()) | ||
else: | ||
return PlainTextScannerUI() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters