src/metpy/io/text.py
Function parse_wpc_surface_bulletin
has a Cognitive Complexity of 31 (exceeds 15 allowed). Consider refactoring. Wontfix
Wontfix
def parse_wpc_surface_bulletin(bulletin, year=None):
"""Parse a coded surface bulletin from NWS WPC into a Pandas DataFrame.
Parameters
----------
- 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 deeply nested control flow statements. Wontfix
Wontfix
if len(item) <= 4 and item[0] in {'8', '9', '1'}:
strength = int(item)
else:
parsed_text.append((valid_time, feature.rstrip('S'), strength,
Point(_decode_coords(item))))