Skip to content

Commit

Permalink
Warn instead of failing on not_skip setting
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Jul 8, 2020
1 parent d4ce124 commit 078f371
Show file tree
Hide file tree
Showing 4 changed files with 367 additions and 401 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ NOTE: isort follows the [semver](https://semver.org/) versioning standard.
- Fixed #1289: Stream usage no longer auto picking up config file from current working directory.
- Fixed #1296: Force_single_line setting removes immediately following comment line.
- Fixed #1295: `ensure_newline_before_comments` doesnt work with `force_sort_within_sections`.
- Setting not_skip will no longer immediately fail but instead give user a warning and direct
to upgrade docs.

### 5.0.4 July 6, 2020
- Fixed #1264: a regression with comment handling and `force_sort_within_sections` config option
Expand Down
2 changes: 1 addition & 1 deletion isort/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ def main(argv: Optional[Sequence[str]] = None, stdin: Optional[TextIOWrapper] =

if deprecated_flags: # pragma: no cover
warn(
f"\n\nThe following deprecated CLI flags where used: {', '.join(deprecated_flags)}!\n"
f"\n\nThe following deprecated CLI flags were used: {', '.join(deprecated_flags)}!\n"
"Please see the 5.0.0 upgrade guide:\n"
"\thttps://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/\n"
)
Expand Down
12 changes: 12 additions & 0 deletions isort/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@

RUNTIME_SOURCE = "runtime"

DEPRECATED_SETTINGS = ("not_skip",)


@dataclass(frozen=True)
class _Config:
Expand Down Expand Up @@ -296,6 +298,16 @@ def __init__(
combined_config.pop("source", None)
combined_config.pop("sources", None)
combined_config.pop("runtime_src_paths", None)

for deprecated_option in DEPRECATED_SETTINGS:
if deprecated_option in combined_config:
warn(
f"\n\nThe following deprecated settings was used: {deprecated_option}!\n"
"Please see the 5.0.0 upgrade guide:\n"
"\thttps://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/\n"
)
combined_config.pop(deprecated_option)

if known_other:
for known_key in known_other:
combined_config.pop(f"{KNOWN_PREFIX}{known_key}", None)
Expand Down
Loading

0 comments on commit 078f371

Please sign in to comment.