snakefmt icon indicating copy to clipboard operation
snakefmt copied to clipboard

Intendeation in run directive breaking code - simple declarations

Open gordonkoehn opened this issue 2 years ago • 2 comments

When running snakefmt on the following rule the alpha and line_style declarations are intended for no reason.

This breaks the code obviously. No idea what could trigger this behaviour.

Is there anything I am doing wrong in the declaration of variables here?

Original:

    run
       ....
                 # Define the list of colors to repeat
                  colors = {"h": "red", "s": "green", "d": "blue", "r": "orange", "m": "purple"}
                  labels = {
                      "h": "Huntress",
                          "s": "Star",
                          "d": "Deep",
                          "r": "Random",
                          "m": "MCMC5",
                      }
            
                  # Define opacity and line style
                  alpha = 0.6
                  line_style = "solid"
            
                  # Plot each entry of distance chain as a line with a color unique to the
                  # initial tree type onto one axis
            
                  # Plot each entry of distance chain as a line with a color unique to the
                  # initial tree type onto one axis
                  for i, distances in enumerate(distances_chains):
        ...

Reformated:

    run
       ....
                 # Define the list of colors to repeat
                  colors = {"h": "red", "s": "green", "d": "blue", "r": "orange", "m": "purple"}
                  labels = {
                      "h": "Huntress",
                          "s": "Star",
                          "d": "Deep",
                          "r": "Random",
                          "m": "MCMC5",
                      }
            
                            # Define opacity and line style
                            alpha = 0.6
                            line_style = "solid"
            
                  # Plot each entry of distance chain as a line with a color unique to the
                  # initial tree type onto one axis
            
                  # Plot each entry of distance chain as a line with a color unique to the
                  # initial tree type onto one axis
                  for i, distances in enumerate(distances_chains):
        ...

gordonkoehn avatar Jul 20 '23 08:07 gordonkoehn

You're not doing anything wrong. We've just had a lot of trouble trying to manage run directives with comments in them. The short term solution would be to move this code into a script directive (I think this is generally the snakemake suggested method). Brice and I are struggling to maintain this repo currently so we may not get around to it for a little while sorry

mbhall88 avatar Jul 24 '23 02:07 mbhall88

Thanks for your response! I see. Thanks for the suggestion.

Keep up the good work! Was really excited to find Snakefmt - will keep watching your repo :)

gordonkoehn avatar Jul 24 '23 13:07 gordonkoehn