[REPO BUG] black vs flake linting might not be aligned.
I have this issue for the following peace of code
class TestMatchedAndNotMatchedConditions(IncrementalBase):
@pytest.fixture(scope="class")
def seeds(self):
return {
"matched_and_not_matched_conditions_expected.csv": fixtures.matched_and_not_matched_conditions_expected,
}
@pytest.fixture(scope="class")
def models(self):
return {
"matched_and_not_matched_conditions.sql": fixtures.matched_and_not_matched_conditions_model,
}
def test_merge(self, project):
self.seed_and_run_twice()
util.check_relations_equal(
project.adapter,
["matched_and_not_matched_conditions", "matched_and_not_matched_conditions_expected"],
)
First run with tox -e linter fails on flake8
Example output:
tests/functional/adapter/incremental/test_incremental_strategies.py:268:101: E501 line too long (116 > 100 characters)
tests/functional/adapter/incremental/test_incremental_strategies.py:274:101: E501 line too long (104 > 100 characters)
linter: exit 1 (0.65 seconds) /Users/dvolodin/Documents/GIT/dbt-databricks> .tox/linter/bin/python -m flake8 --select=E,W,F --ignore=E203,W503 --max-line-length=100 dbt tests pid=97727
linter: FAIL code 1 (0.94=setup[0.04]+cmd[0.25,0.65] seconds)
evaluation failed :( (1.03 seconds)
If I fix to something like this:
@pytest.fixture(scope="class")
def models(self):
return {
"matched_and_not_matched_conditions.sql":
fixtures.matched_and_not_matched_conditions_model,
}
Black complains, because in black rules are more important than line length requirements (doc)
linter: commands[0]> .tox/linter/bin/python -m black --config black.ini --check dbt tests
would reformat /Users/dvolodin/Documents/GIT/dbt-databricks/tests/functional/adapter/incremental/test_incremental_strategies.py
Oh no! 💥 💔 💥
1 file would be reformatted, 148 files would be left unchanged.
linter: exit 1 (0.42 seconds) /Users/dvolodin/Documents/GIT/dbt-databricks> .tox/linter/bin/python -m black --config black.ini --check dbt tests pid=92649
linter: FAIL code 1 (0.47=setup[0.05]+cmd[0.42] seconds)
evaluation failed :( (0.54 seconds)
So it is a deadlock.
I can circumvent this easily, so no need to prioritise the fix. However I thought it does make sense to highlight this issue. Probably it will be useful in some maintainer round discussion as an argument to try other toolset (like ruff).
Thanks for raising this; I've definitely hit this friction before, and it just hasn't reached a high enough priority to fix. I'm not sure that flake is even pulling it's weight anymore. Happy to hear proposals for other linting tools/configs.