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

""" string should be allowed to be multiline #770

Closed
LefterisJP opened this issue Nov 16, 2022 · 3 comments · Fixed by #771
Closed

""" string should be allowed to be multiline #770

LefterisJP opened this issue Nov 16, 2022 · 3 comments · Fixed by #771
Labels
bug Something isn't working

Comments

@LefterisJP
Copy link

I just updated to ruff 0.0.122 from ruff 0.0.105 and got a few new errors which should not have been thrown.

This is an example:

update_4 = """INSERT INTO assets(identifier, name, type) VALUES("eip155:1/erc20:0xC2FEC534c461c45533e142f724d0e3930650929c", "AKB token", "C");INSERT INTO evm_tokens(identifier, token_kind, chain, address, decimals, protocol) VALUES("eip155:1/erc20:0xC2FEC534c461c45533e142f724d0e3930650929c", "A", 1, "0xC2FEC534c461c45533e142f724d0e3930650929c", 18, NULL);INSERT INTO common_asset_details(identifier, symbol, coingecko, cryptocompare, forked, started, swapped_for) VALUES("eip155:1/erc20:0xC2FEC534c461c45533e142f724d0e3930650929c", "AKB", NULL, "AIDU", NULL, 123, NULL);
*
INSERT INTO assets(identifier, name, type) VALUES("121-ada-FADS-as", "A name", "F"); INSERT INTO common_asset_details(identifier, symbol, coingecko, cryptocompare, forked, started, swapped_for) VALUES("121-ada-FADS-as", "SYMBOL", "", "", "BTC", NULL, NULL);
*
UPDATE assets SET name="Ευρώ" WHERE identifier="EUR";
INSERT INTO assets(identifier, name, type) VALUES("EUR", "Ευρώ", "A"); INSERT INTO common_asset_details(identifier, symbol, coingecko, cryptocompare, forked, started, swapped_for) VALUES("EUR", "Ευρώ", "EUR", NULL, NULL, NULL, NULL, NULL);
    """  # noqa: E501

We basically split a """ string into multiple lines. And the noqa: E501 at the end should work for the entire string (this is how it works for flake8 also).

While ruff seems to complain about the length of each individual line.

@LefterisJP
Copy link
Author

A sidenote. I also got this hit: PyCQA/flake8-bugbear#278

But I think this is valid, though I would ignore this flag. It's a buggy warning imo. You can have an abstract class without abstract methods which is inherited by yet another class which does have them.

@charliermarsh charliermarsh added the bug Something isn't working label Nov 16, 2022
@charliermarsh
Copy link
Member

Yeah that use of noqa should work. Seems like a bug! Will fix.

@charliermarsh
Copy link
Member

I think the issue here was specific to the first line of a multi-line string being too long (off-by-one for zero- vs. one-indexing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants