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

Line numbers are reported pre-formatting #241

Open
lczech opened this issue Jul 11, 2024 · 1 comment
Open

Line numbers are reported pre-formatting #241

lczech opened this issue Jul 11, 2024 · 1 comment

Comments

@lczech
Copy link

lczech commented Jul 11, 2024

The line numbers for warnings are reported on the old (pre-formatting) file. That means it is either hard to figure out where the issue is, or I need to run snakefmt again, to get the correct numbers reported in the re-formatted file.

Example:

# some things here to cause blank lines to be inserted
def my_function():
    return 1
rule call_variants:
    input:
        some_file,
        # some comment

First time running snakefmt:

[WARNING] In file "test.smk":  Keyword "input" at line 5 has comments under a value.
	PEP8 recommends block comments appear before what they describe
(see https://www.python.org/dev/peps/pep-0008/#id30)
[INFO] Writing formatted content to test.smk
[INFO] All done 🎉

which lists line 5 (input:) as where the issue is. However, the file was reformatted, and now looks like this:

# some things here to cause blank lines to be inserted
def my_function():
    return 1


rule call_variants:
    input:
        some_file,
        # some comment

So the reported line should be 7 instead, to match with the new file content. This is reported when running snakefmt again on the file, but that seems cumbersome.

@mbhall88
Copy link
Member

I'll take a look at whether it is possible to know the future line number at the time of logging this message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants