---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs
---
Q003 [*] Change outer quotes to avoid escaping inner quotes
 --> doubles_escaped.py:1:26
  |
1 | this_should_raise_Q003 = 'This is a \'string\''
  |                          ^^^^^^^^^^^^^^^^^^^^^^
2 | this_should_raise_Q003 = 'This is \\ a \\\'string\''
3 | this_is_fine = '"This" is a \'string\''
  |
help: Change outer quotes to avoid escaping inner quotes
  |
  - this_should_raise_Q003 = 'This is a \'string\''
1 + this_should_raise_Q003 = "This is a 'string'"
2 | this_should_raise_Q003 = 'This is \\ a \\\'string\''
  |

Q003 [*] Change outer quotes to avoid escaping inner quotes
 --> doubles_escaped.py:2:26
  |
1 | this_should_raise_Q003 = 'This is a \'string\''
2 | this_should_raise_Q003 = 'This is \\ a \\\'string\''
  |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | this_is_fine = '"This" is a \'string\''
4 | this_is_fine = "This is a 'string'"
  |
help: Change outer quotes to avoid escaping inner quotes
  |
1 | this_should_raise_Q003 = 'This is a \'string\''
  - this_should_raise_Q003 = 'This is \\ a \\\'string\''
2 + this_should_raise_Q003 = "This is \\ a \\'string'"
3 | this_is_fine = '"This" is a \'string\''
  |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:10:5
   |
 8 | this_should_raise = (
 9 |     'This is a'
10 |     '\'string\''
   |     ^^^^^^^^^^^^
11 | )
   |
help: Change outer quotes to avoid escaping inner quotes
   |
9  |     'This is a'
   -     '\'string\''
10 +     "'string'"
11 | )
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:14:1
   |
13 | # Same as above, but with f-strings
14 | f'This is a \'string\''  # Q003
   | ^^^^^^^^^^^^^^^^^^^^^^^
15 | f'This is \\ a \\\'string\''  # Q003
16 | f'"This" is a \'string\''
   |
help: Change outer quotes to avoid escaping inner quotes
   |
13 | # Same as above, but with f-strings
   - f'This is a \'string\''  # Q003
14 + f"This is a 'string'"  # Q003
15 | f'This is \\ a \\\'string\''  # Q003
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:15:1
   |
13 | # Same as above, but with f-strings
14 | f'This is a \'string\''  # Q003
15 | f'This is \\ a \\\'string\''  # Q003
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 | f'"This" is a \'string\''
17 | f"This is a 'string'"
   |
help: Change outer quotes to avoid escaping inner quotes
   |
14 | f'This is a \'string\''  # Q003
   - f'This is \\ a \\\'string\''  # Q003
15 + f"This is \\ a \\'string'"  # Q003
16 | f'"This" is a \'string\''
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:23:5
   |
21 | foo = (
22 |     f'This is a'
23 |     f'\'string\''  # Q003
   |     ^^^^^^^^^^^^^
24 | )
   |
help: Change outer quotes to avoid escaping inner quotes
   |
22 |     f'This is a'
   -     f'\'string\''  # Q003
23 +     f"'string'"  # Q003
24 | )
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:46:1
   |
45 | # Same as above, but with t-strings
46 | t'This is a \'string\''  # Q003
   | ^^^^^^^^^^^^^^^^^^^^^^^
47 | t'This is \\ a \\\'string\''  # Q003
48 | t'"This" is a \'string\''
   |
help: Change outer quotes to avoid escaping inner quotes
   |
45 | # Same as above, but with t-strings
   - t'This is a \'string\''  # Q003
46 + t"This is a 'string'"  # Q003
47 | t'This is \\ a \\\'string\''  # Q003
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:47:1
   |
45 | # Same as above, but with t-strings
46 | t'This is a \'string\''  # Q003
47 | t'This is \\ a \\\'string\''  # Q003
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48 | t'"This" is a \'string\''
49 | f"This is a 'string'"
   |
help: Change outer quotes to avoid escaping inner quotes
   |
46 | t'This is a \'string\''  # Q003
   - t'This is \\ a \\\'string\''  # Q003
47 + t"This is \\ a \\'string'"  # Q003
48 | t'"This" is a \'string\''
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:55:5
   |
53 | foo = (
54 |     t'This is a'
55 |     t'\'string\''  # Q003
   |     ^^^^^^^^^^^^^
56 | )
57 | t'\'foo\' {'nested'}'  # Q003
   |
help: Change outer quotes to avoid escaping inner quotes
   |
54 |     t'This is a'
   -     t'\'string\''  # Q003
55 +     t"'string'"  # Q003
56 | )
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:57:1
   |
55 |     t'\'string\''  # Q003
56 | )
57 | t'\'foo\' {'nested'}'  # Q003
   | ^^^^^^^^^^^^^^^^^^^^^
58 | t'\'foo\' {t'nested'}'  # Q003
59 | t'\'foo\' {t'\'nested\''} \'\''  # Q003
   |
help: Change outer quotes to avoid escaping inner quotes
   |
56 | )
   - t'\'foo\' {'nested'}'  # Q003
57 + t"'foo' {'nested'}"  # Q003
58 | t'\'foo\' {t'nested'}'  # Q003
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:58:1
   |
56 | )
57 | t'\'foo\' {'nested'}'  # Q003
58 | t'\'foo\' {t'nested'}'  # Q003
   | ^^^^^^^^^^^^^^^^^^^^^^
59 | t'\'foo\' {t'\'nested\''} \'\''  # Q003
   |
help: Change outer quotes to avoid escaping inner quotes
   |
57 | t'\'foo\' {'nested'}'  # Q003
   - t'\'foo\' {t'nested'}'  # Q003
58 + t"'foo' {t'nested'}"  # Q003
59 | t'\'foo\' {t'\'nested\''} \'\''  # Q003
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:59:1
   |
57 | t'\'foo\' {'nested'}'  # Q003
58 | t'\'foo\' {t'nested'}'  # Q003
59 | t'\'foo\' {t'\'nested\''} \'\''  # Q003
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60 |
61 | t'normal {t'nested'} normal'
   |
help: Change outer quotes to avoid escaping inner quotes
   |
58 | t'\'foo\' {t'nested'}'  # Q003
   - t'\'foo\' {t'\'nested\''} \'\''  # Q003
59 + t"'foo' {t'\'nested\''} ''"  # Q003
60 |
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:59:12
   |
57 | t'\'foo\' {'nested'}'  # Q003
58 | t'\'foo\' {t'nested'}'  # Q003
59 | t'\'foo\' {t'\'nested\''} \'\''  # Q003
   |            ^^^^^^^^^^^^^
60 |
61 | t'normal {t'nested'} normal'
   |
help: Change outer quotes to avoid escaping inner quotes
   |
58 | t'\'foo\' {t'nested'}'  # Q003
   - t'\'foo\' {t'\'nested\''} \'\''  # Q003
59 + t'\'foo\' {t"'nested'"} \'\''  # Q003
60 |
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:62:1
   |
61 | t'normal {t'nested'} normal'
62 | t'\'normal\' {t'nested'} normal'  # Q003
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63 | t'\'normal\' {t'nested'} "double quotes"'
64 | t'\'normal\' {t'\'nested\' {'other'} normal'} "double quotes"'  # Q003
   |
help: Change outer quotes to avoid escaping inner quotes
   |
61 | t'normal {t'nested'} normal'
   - t'\'normal\' {t'nested'} normal'  # Q003
62 + t"'normal' {t'nested'} normal"  # Q003
63 | t'\'normal\' {t'nested'} "double quotes"'
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:64:15
   |
62 | t'\'normal\' {t'nested'} normal'  # Q003
63 | t'\'normal\' {t'nested'} "double quotes"'
64 | t'\'normal\' {t'\'nested\' {'other'} normal'} "double quotes"'  # Q003
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65 | t'\'normal\' {t'\'nested\' {'other'} "double quotes"'} normal'  # Q00l
   |
help: Change outer quotes to avoid escaping inner quotes
   |
63 | t'\'normal\' {t'nested'} "double quotes"'
   - t'\'normal\' {t'\'nested\' {'other'} normal'} "double quotes"'  # Q003
64 + t'\'normal\' {t"'nested' {'other'} normal"} "double quotes"'  # Q003
65 | t'\'normal\' {t'\'nested\' {'other'} "double quotes"'} normal'  # Q00l
   |

Q003 [*] Change outer quotes to avoid escaping inner quotes
  --> doubles_escaped.py:65:1
   |
63 | t'\'normal\' {t'nested'} "double quotes"'
64 | t'\'normal\' {t'\'nested\' {'other'} normal'} "double quotes"'  # Q003
65 | t'\'normal\' {t'\'nested\' {'other'} "double quotes"'} normal'  # Q00l
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Change outer quotes to avoid escaping inner quotes
   |
64 | t'\'normal\' {t'\'nested\' {'other'} normal'} "double quotes"'  # Q003
   - t'\'normal\' {t'\'nested\' {'other'} "double quotes"'} normal'  # Q00l
65 + t"'normal' {t'\'nested\' {'other'} "double quotes"'} normal"  # Q00l
   |
