snakemake / snakefmt

The uncompromising Snakemake code formatter
MIT License
147 stars 28 forks source link

Intendeation in run directive breaking code - simple declarations #197

Open gordonkoehn opened 1 year ago

gordonkoehn commented 1 year ago

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):
        ...
mbhall88 commented 1 year ago

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

gordonkoehn commented 1 year ago

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 :)