Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file detection issues of Snakemake linter/formatter #713

Merged
merged 8 commits into from Sep 22, 2020
Merged

Fix file detection issues of Snakemake linter/formatter #713

merged 8 commits into from Sep 22, 2020

Conversation

kpj
Copy link
Contributor

@kpj kpj commented Sep 11, 2020

This PR makes the Snakemake linter/formatter work by fixing issues with the file detection.

In particular, it does the following:

  • fix bug in regex
  • initialize FILE_ARRAY_SNAKEMAKE properly

Please let me know if there are any other things to repair 😄

@kpj kpj changed the title Fix file detection issues of Snakemake linter-formatter Fix file detection issues of Snakemake linter/formatter Sep 11, 2020
admiralAwkbar
admiralAwkbar previously approved these changes Sep 11, 2020
Copy link
Collaborator

@admiralAwkbar admiralAwkbar left a comment

very nice catches

@admiralAwkbar
Copy link
Collaborator

@admiralAwkbar admiralAwkbar commented Sep 11, 2020

@kpj Interesting, it didn't seem to exit with error code...
It showed the error found, but I'm guessing it still exited 0

@admiralAwkbar
Copy link
Collaborator

@admiralAwkbar admiralAwkbar commented Sep 11, 2020

@kpj issue was we were locked on 0.1.4 of snakefmt with that error, updated to 0.1.5

@admiralAwkbar
Copy link
Collaborator

@admiralAwkbar admiralAwkbar commented Sep 11, 2020

@kpj so it seems the root of the issue:

  • We used to be able to use --diff and --check
  • That would give us a proper error code when checking the file.
    Now both return a 0 error code
    We need to reach out to snakefmt to see if they can give proper error code when a file is changed, or allow for both flags to be executed again
bash-5.0# snakefmt  --check --diff --config action/lib/.automation/.snakefmt.toml bad.smk
[WARNING] Both --check and --diff/--compact-diff given. Only running --check...
[INFO] 1 file(s) would be changed 😬
bash-5.0# echo $?
1
bash-5.0# snakefmt  --diff --config action/lib/.automation/.snakefmt.toml bad.smk
=====> Diff for bad.smk <=====

  rule all:
      input:
-         file1='result.txt',
?               ^          ^
+         file1="result.txt",
?               ^          ^
+

  rule simulation:
      output:
-         file1="result.txt"
+         file1="result.txt",
?                           +
      shell:
          """
          touch {output}
          """
-

[INFO] All done 🎉
bash-5.0# echo $?
0
bash-5.0#

@kpj
Copy link
Contributor Author

@kpj kpj commented Sep 14, 2020

@kpj issue was we were locked on 0.1.4 of snakefmt with that error, updated to 0.1.5

Yes, I had reported the issue (snakemake/snakefmt#65) and now everything should be fine. Thanks for updating the version 😃

  • We used to be able to use --diff and --check
  • That would give us a proper error code when checking the file.
    Now both return a 0 error code
    We need to reach out to snakefmt to see if they can give proper error code when a file is changed, or allow for both flags to be executed again

You are right, I have submitted another issue: snakemake/snakefmt#68

@admiralAwkbar admiralAwkbar self-assigned this Sep 18, 2020
@admiralAwkbar admiralAwkbar added the Stalled label Sep 18, 2020
@kpj
Copy link
Contributor Author

@kpj kpj commented Sep 22, 2020

Now that snakefmt has been updated to version 0.2.0, formatting works nicely.

Another issue I noticed is that snakemake --lint sometimes crashes because it is not executed in the expected working directory and cannot e.g. read configuration files. However, this seems like something which should be fixed on Snakemake's side, so we cannot do much about it here. What do you think?

Copy link
Collaborator

@admiralAwkbar admiralAwkbar left a comment

solid

@admiralAwkbar admiralAwkbar added bug and removed Stalled labels Sep 22, 2020
@admiralAwkbar admiralAwkbar merged commit 23fca80 into github:master Sep 22, 2020
1 check passed
lib/linter.sh Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants