pylhc/lsa_to_madx.py

Summary

Maintainability
A
0 mins
Test Coverage
F
59%

File lsa_to_madx.py has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

"""
LSA to MAD-X
------------

This script is meant to convert various ``LSA`` knobs to their ``MAD-X`` equivalent scripts.
Severity: Minor
Found in pylhc/lsa_to_madx.py - About 2 hrs to fix

    Function main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Wontfix

    def main():
        options = _get_args()
        lsa_optics = options.optics
    
        if not options.knobs and not options.file:
    Severity: Minor
    Found in pylhc/lsa_to_madx.py - About 1 hr to fix

    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 _get_trim_variable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Wontfix

    def _get_trim_variable(lsa_knob: str) -> str:
        """
        Generates the ``MAD-X`` trim variable name from an ``LSA`` knob.
        Handles the variable name character limit of ``MAD-X``.
        """
    Severity: Minor
    Found in pylhc/lsa_to_madx.py - About 45 mins to fix

    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 get_madx_script_from_definition_dataframe has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Wontfix

    def get_madx_script_from_definition_dataframe(deltas_df: tfs.TfsDataFrame, lsa_knob: str, trim: float = 1.0,
                                                  by_reference: bool = True, verbose: bool = False
                                                  ) -> str:
        """
        Given the extracted definition dataframe of an LSA knob - as returned by
    Severity: Minor
    Found in pylhc/lsa_to_madx.py - About 45 mins to fix

    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 get_madx_script_from_definition_dataframe has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Wontfix

    def get_madx_script_from_definition_dataframe(deltas_df: tfs.TfsDataFrame, lsa_knob: str, trim: float = 1.0,
    Severity: Minor
    Found in pylhc/lsa_to_madx.py - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status