-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enforce configs for any INI file (#304)
* docs: ideas for INI and TOML (keys and sections, present/absent)
- Loading branch information
1 parent
266c599
commit 80c840b
Showing
24 changed files
with
287 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Keys should be present | ||
["setup.cfg".flake8] | ||
ignore__present = "str" | ||
max-line-length__present = "int" | ||
exclude__present = "str" | ||
max-complexity__present = "int" | ||
inline-quotes__present = "str" | ||
|
||
# Keys should be absent | ||
["setup.cfg".some-section] | ||
ignore__present = true | ||
max-line-length__present = true | ||
exclude__present = true | ||
max-complexity__present = true | ||
inline-quotes__present = true | ||
|
||
# Section should be absent | ||
["setup.cfg".darglint] | ||
__present = false | ||
blabla = "{{ nit.section_absent() }}" | ||
|
||
# Section should be absent | ||
["setup.cfg"."tox:tox"] | ||
__present = false | ||
["setup.cfg"."gh-actions"] | ||
__present = false | ||
|
||
# Section should be present | ||
["tox.ini"."tox"] | ||
__present = true | ||
["tox.ini".gh-actions] | ||
__present = true | ||
|
||
# Keys should be present using Jinja | ||
["setup.cfg".flake82] | ||
ignore = "{{ nit.present(str, validators=[comma_separated_str]) }}" | ||
max-line-length = "{{ nit.present(int, validators=[range(80, 120)]) }}" | ||
exclude = "{{ nit.present(str, validators=[comma_separated_str]) }}" | ||
max-complexity = "{{ nit.present(int) }}" | ||
inline-quotes = "{{ nit.present(str, choices=['double', 'single']) }}" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Keys are absent | ||
["pyproject.toml".tool.poetry.dev-dependencies] | ||
pep257__present = false | ||
pycodestyle__present = false | ||
pur__present = false | ||
pep257 = "{{ nit.absent() }}" # Jinja | ||
pycodestyle = "{{ nit.absent() }}" # Jinja | ||
pur = "{{ nit.absent() }}" # Jinja | ||
|
||
# Keys are absent | ||
["pyproject.toml".tool.poetry.dependencies] | ||
pep257__present = false | ||
pycodestyle__present = false | ||
pur__present = false | ||
pep257 = "{{ nit.absent() }}" # Jinja | ||
pycodestyle = "{{ nit.absent() }}" # Jinja | ||
pur = "{{ nit.absent() }}" # Jinja | ||
|
||
# TODO: pre-processing with Jinja to generate multiple sections with the same config? ["pyproject.toml".tool.poetry.{{ ['dependencies', 'dev-dependencies'] }}] | ||
|
||
# Keys are present, with the expected types | ||
["pyproject.toml".build-system] | ||
requires__present = "List[str]" | ||
build-backend__present = "str" | ||
requires = "{{ nit.present(List[str]) }}" # Jinja | ||
build-backend = "{{ nit.present(str) }}" # Jinja | ||
|
||
# Integer key exists | ||
["pyproject.toml".tool.black] | ||
line-length__present = "int" | ||
line-length = "{{ nit.present(int) }}" # Jinja | ||
|
||
# Section exists with anything inside | ||
["pyproject.toml".tool.black2] | ||
__present = true | ||
blabla = "{{ nit.section_present() }}" # Jinja |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
nitpick.plugins.ini module | ||
========================== | ||
|
||
.. automodule:: nitpick.plugins.ini | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.