Showing 13 of 32 total issues
Function check_sixtrack_output_data
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def check_sixtrack_output_data(jobname: str, basedir: Path):
"""Presence checks for SixDesk tracking output data.
This checks recursively all directories in `track`.
Will be busy for a while.
- 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 write_bash
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def write_bash(
job_df: DataFrame,
output_dir: Path = None,
executable: str = "madx",
cmdline_arguments: dict = None,
- 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 convert_paths_in_dict_to_strings
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def convert_paths_in_dict_to_strings(dict_: dict) -> dict:
"""Converts all Paths in the dict to strings, including those in iterables."""
dict_ = dict_.copy()
for key, value in dict_.items():
if isinstance(value, 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 _create_stats_df
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _create_stats_df(df: pd.DataFrame, parameter: str, global_index: Any = None) -> TfsDataFrame:
""" Calculates the stats over a given parameter.
Note: Could be refactored to use `group_by`.
Args:
- 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 remove_twiss_fail_check
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def remove_twiss_fail_check(jobname: str, basedir: Path):
""" Comments out the "Twiss fail" check from mad6t.sh """
LOG.info("Applying twiss-fail hack.")
for mad6t_path in (
get_mad6t_mask_path(jobname, basedir),
- 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. Open
if not len(angle_dirs):
raise OSError(f"No angle-dirs present in {str(turn_dir)}.")
Avoid deeply nested control flow statements. Open
for angle_dir in angle_dirs:
if not angle_dir.is_dir():
continue
htcondor_files = list(angle_dir.glob("htcondor.*"))
Avoid deeply nested control flow statements. Open
if not turn_dir.is_dir():
continue
Function write_bash
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def write_bash(
Function map_kwargs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def map_kwargs(add_dict: Dict[str, Any]) -> Dict[str, Any]:
"""
Maps the kwargs for the job-file.
Some arguments have pre-defined choices and defaults, the remaining ones are just passed on.
- 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 _plot_seeds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _plot_seeds(ax, df_da: TfsDataFrame, da_col: str, interpolated: bool) -> Tuple[list, list]:
"""Add the Seed lines to the polar plots, if df_da is given.
Args:
ax: Axes to plot in
- 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 fix_pythonfile_call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fix_pythonfile_call(jobname: str, basedir: Path):
""" Removes '<' in the `binary file` line in mad6t.sh so __file__ works. """
LOG.info("Applying python-file call fix.")
for mad6t_path in (
get_mad6t_mask_path(jobname, basedir),
- 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 submit_sixtrack
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def submit_sixtrack(jobname: str, basedir: Path, python: Path = None,
sixdesk: Path = SIXDESK_UTILS, ssh: str = None, resubmit: bool = False):
""" Generate simulation files and check if runnable and submit. """
re_str = "Re-" if resubmit else ""
LOG.info(f"{re_str}Submitting to sixtrack.")
- 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"