Consider merging collapsible if statements
680 color="gray",
681 )
682
683 if hline is not None: 684 if not isinstance(hline, _pd.Series):
685 if grayscale:
686 hlcolor = "black"
Consider merging collapsible if statements
347 # use a more precise date string for the x axis locations in the toolbar
348 # ax.fmt_xdata = _mdates.DateFormatter('%Y-%m-%d')
349
350 if hline is not None: 351 if not isinstance(hline, _pd.Series):
352 if grayscale:
353 hlcolor = "black"
Consider merging collapsible if statements
188 # rotate and align the tick labels so they look better
189 fig.autofmt_xdate()
190
191 if hline is not None: 192 if not isinstance(hline, _pd.Series):
193 if grayscale:
194 hlcolor = "gray"
Description
Nested if
statements can be collapsed into a single if
statement by separating their condition using and
operator.
Merging collapsible if
statements increases the code's readability.
Bad practice
if condition1:
if condition2:
dosomething()
Preferred
if condition1 and condition2:
dosomething()
Exception:
DeepSource will not raise this issue when the nested if
statements have comments in between them, as it could be explaining why the nested if
is in place.