Skip to content

Python API: Passing FluffConfig and exclude_rules to Linter means latter is ignored. #5061

@alanmcruickshank

Description

@alanmcruickshank

Search before asking

  • I searched the issues and found no similar issues.

What Happened

When using the Python API Linter() class, if both config and exclude_rules are set (where the config is a FluffConfig and not a dict), means that the latter is ignored.

Expected Behaviour

Either something helpful on an exception.

Observed Behaviour

The exclude_rules is silently ignored. The is because the __init__() method for the Linter class ends early if a config is provided - and not built to expect that both might be provided.

How to reproduce

linter = Linter(config=config, exclude_rules=exclude_rules_from_config)
result = linter.lint_string(in_str=sql_query, fix=True)

Dialect

bigquery - but I can see that this is an issue with all dialects.

Version

2.2.0

Configuration

default config

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions