Skip to content

Enable map configurations (config v2). - #610

Merged
asottile merged 2 commits into
masterfrom
config_v2
Sep 7, 2017
Merged

asottile merged 2 commits into
masterfrom
config_v2

Conversation

@asottile

@asottile asottile commented Sep 5, 2017

Copy link
Copy Markdown
Member

This resolves #414

I've also added the following to aid in migration:

  • pre-commit migrate-config
    • attempts to intelligently upgrade the configuration to the new map format
  • pre-commit autoupdate - by default calls migrate_config(...)

For now I have opted to not issue a deprecation warning, I'll follow up with that in a later release.

@asottile

asottile commented Sep 6, 2017

Copy link
Copy Markdown
Member Author

This is mostly ready for review, I need to make migrate-config handle yaml that looks like this:

---
-   repo: ...
    ...

And should probably handle this case better:

current

+repos:
 # this is a pre-commit config
 -   repo: ...
     ...

better

 # this is a pre-commit config
+repos:
 -   repo: ...
     ...

@asottile

asottile commented Sep 6, 2017

Copy link
Copy Markdown
Member Author

Now handles both of those cases!

@chriskuehl chriskuehl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice!

Comment thread pre_commit/clientlib.py
CONFIG_SCHEMA = schema.Map(
'Config', None,

schema.RequiredRecurse('repos', schema.Array(CONFIG_REPO_DICT)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

weird blank line?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this matches the other ones in the file, I plan to add more keys here so it'll look more natural eventually

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Configuration v2

2 participants