Showing 22 of 22 total issues
Function run
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def run():
'''Run the CLI frontend'''
try:
gscreenshot = Gscreenshot()
except NoSupportedScreenshooterError as gscreenshot_error:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _save_image
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _save_image(self, image: Image.Image, filename: typing.Optional[str]=None,
overwrite: bool=True) -> bool:
'''
Internal method for saving an image to a file
'''
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function selected_cursor_changed
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def selected_cursor_changed(self, widget):
'''Handle a change to the selected cursor'''
try:
cursor_selection = widget.get_model()[widget.get_active()][2]
except IndexError:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, window, builder, capabilities):
self._builder = builder
self._window = window
self._window_is_fullscreen:bool = False
self._was_maximized:bool = False
Function update_available_cursors
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update_available_cursors(self, cursors: dict, selected: typing.Optional[str] = None):
'''
Update the available cursor selection in the combolist
Params: self, {name: PIL.Image}
'''
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function find_executable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_executable(executable, path=None):
"""Tries to find 'executable' in the directories listed in 'path'.
A string listing directories separated by 'os.pathsep'; defaults to
os.environ['PATH']. Returns the complete filename or None if not found.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function build_data_files
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def build_data_files(version):
'''
This is somewhat of a workaround so that the data files that
contain a version number end up with the correct version number
in them since it's easy to forget to update them
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update_gallery_controls
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_gallery_controls(self, screenshots:ScreenshotCollection):
'''
updates the preview controls to match the current state
'''
while Gtk.events_pending():
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function on_button_openwith_clicked
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def on_button_openwith_clicked(self, *_):
'''Handle the "open with" button'''
self._view.flash_status_icon(Gtk.STOCK_EXECUTE)
fname = self._app.save_and_return_path()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function screenshot_full_display
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def screenshot_full_display(self, delay: int=0, capture_cursor: bool=False,
cursor_name: typing.Optional[str]=None,
overwrite: bool=False, count: int=1
) -> typing.Optional[Image.Image]:
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function screenshot_window
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def screenshot_window(self, delay: int=0, capture_cursor: bool=False,
cursor_name: typing.Optional[str]=None,
overwrite: bool=False, count: int=1
) -> typing.Optional[Image.Image]:
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function screenshot_selected
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def screenshot_selected(self, delay: int=0, capture_cursor: bool=False,
cursor_name: typing.Optional[str]=None,
overwrite: bool=False, count: int=1,
region: typing.Optional[typing.Tuple[int, int, int, int]]=None
) -> typing.Optional[Image.Image]:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function grab_selection_
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def grab_selection_(self, delay: int=0, capture_cursor: bool=False,
use_cursor: typing.Optional[PIL.Image.Image]=None,
region: typing.Optional[typing.Tuple[int, int, int, int]]=None):
"""
Internal API method for grabbing a selection. This should not
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function grab_fullscreen_
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def grab_fullscreen_(self, delay: int=0, capture_cursor: bool=False,
use_cursor: typing.Optional[PIL.Image.Image]=None):
'''
Internal API method for grabbing the full screen. This should not
be overridden by extending classes. Implement grab_fullscreen instead.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _parse_selection_output
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _parse_selection_output(self, region_output: typing.List[str]
) -> typing.Tuple[int, int, int, int]:
'''
Parses output from a region selection tool in the format
X=%x,Y=%y,W=%w,H=%h OR X=%x\nY=%x\nW=%w\nH=%h.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return
Function on_button_saveas_clicked
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_button_saveas_clicked(self, *_):
'''Handle the saveas button'''
saved = False
cancelled = False
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function on_button_save_all_clicked
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_button_save_all_clicked(self, *_):
'''Handle the "save all" button'''
saved = False
cancelled = False
save_dialog = FileSaveDialog(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function on_button_open_clicked
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_button_open_clicked(self, *_):
'''Handle the open button'''
success = self._app.open_last_screenshot()
if not success:
dialog = WarningDialog(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function apply_to
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply_to(self, screenshot: Image.Image) -> Image.Image:
'''apply the effect'''
cursor_pos = self._position
cursor_img = self._glyph.copy()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"