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

Enable ISC rule + autoformat #1856

Merged
merged 2 commits into from
Oct 30, 2023
Merged

Enable ISC rule + autoformat #1856

merged 2 commits into from
Oct 30, 2023

Conversation

artem-shelkovnikov
Copy link
Member

Enabling an "ISC" linter rule.

ISC rule is "Implicit String Concat": https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc

Subrules are:

  • ISC001 | implicitly concatenated string literals on one line
  • ISC002 | implicitly concatenated string literals over continuation line
  • ISC003 | explicitly concatenated string should be implicitly concatenated

This ruleset is there to make sure that string concatenation is expressed properly.

Example from documentation:

$ cat example.py
s = ('111111111111111111111'
     '222222222222222222222')
$ black example.py
reformatted example.py
All done! ✨ 🍰 ✨
1 file reformatted.
$ cat example.py
s = "111111111111111111111" "222222222222222222222"
$ flake8 example.py
example.py:1:28: ISC001 implicitly concatenated string literals on one line
$ edit example.py # Remove the " " and save
$ cat example.py
s = "111111111111111111111222222222222222222222"
$ black example.py
All done! ✨ 🍰 ✨
1 file left unchanged.
$ flake8 example.py
$

Violations:

tests/sources/fixtures/postgresql/fixture.py:62:17: ISC003 Explicitly concatenated string should be implicitly concatenated

Copy link
Contributor

@navarone-feekery navarone-feekery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but there seems to be a merge conflict, let me know if it will need re-approval

@artem-shelkovnikov artem-shelkovnikov merged commit 14da488 into main Oct 30, 2023
@artem-shelkovnikov artem-shelkovnikov deleted the artem/linter-isc-rule branch October 30, 2023 13:47
@github-actions
Copy link

💔 Failed to create backport PR(s)

The backport operation could not be completed due to the following error:
There are no branches to backport to. Aborting.

The backport PRs will be merged automatically after passing CI.

To backport manually run:
backport --pr 1856 --autoMerge --autoMergeMethod squash

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

Successfully merging this pull request may close these issues.

2 participants