-
Notifications
You must be signed in to change notification settings - Fork 1
POC to show how we could split the contributing guide into pieces #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
72ca3c6
Split guide into smaller parts
seb4stien 12b128b
Demo
seb4stien 5021299
Split guidelines to ease maintenance
seb4stien 236ca82
Add comments
seb4stien 0071309
Symplify based on review comments
seb4stien bb5d831
Lint
seb4stien 8f2886d
Lint
seb4stien File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,66 @@ | ||
| # Standards | ||
|
|
||
| - [Charm Ubuntu and Python Version](#charm-ubuntu-and-python-version) | ||
| - [CI-CD](#ci-cd) | ||
| - [Downloading Binaries](#downloading-binaries) | ||
| - [Failing Status Checks](#failing-status-checks) | ||
| - [File Encoding](#file-encoding) | ||
| - [Function and Method Ordering](#function-and-method-Ordering) | ||
| - [Handling Typing Issues with python-libjuju](#handling-typing-issues-with-python-libjuju) | ||
| - [Non Compliant Code](#non-compliant-code) | ||
| - [PR comments and requests for changes](#pr-comments-and-requests-for-changes) | ||
| - [Programming Languages and Frameworks](#programming-languages-and-frameworks) | ||
| - [Random values](#random-values) | ||
| - [Repository Setup](#repository-setup) | ||
| - [Static Code Analysis](#static-code-analysis) | ||
| - [Source Code Documentation](#source-code-documentation) | ||
| - [Test Coverage](#test-coverage) | ||
| - [Test Exception Raised](#test-exception-raised) | ||
| - [Test Fixture](#test-fixture) | ||
| - [Test Structure](#test-structure) | ||
| - [Type Hints](#type-hints) | ||
|
|
||
| The [Charm development best practices](https://juju.is/docs/sdk/styleguide) are | ||
| incorporated by reference. | ||
|
|
||
| ## Definitions | ||
|
|
||
| !INCLUDE definitions/*.md | ||
|
|
||
| !INCLUDE principles/100-programming-languages-and-frameworks.md level=2 | ||
|
|
||
| !INCLUDE principles/200-versions.md | ||
|
|
||
| !INCLUDE principles/300-binaries.md | ||
|
|
||
| !INCLUDE ci/100-CI-CD.md | ||
|
|
||
| !INCLUDE implementation/100-random-values.md | ||
|
|
||
| !INCLUDE implementation/200-encoding.md | ||
|
|
||
| !INCLUDE github/100-repository-setup.md | ||
|
|
||
| !INCLUDE github/200-prs.md | ||
|
|
||
| !INCLUDE ci/200-failing-checks.md | ||
|
|
||
| !INCLUDE tests/100-structure.md | ||
|
|
||
| !INCLUDE tests/200-exceptions.md | ||
|
|
||
| !INCLUDE tests/300-fixtures.md | ||
|
|
||
| !INCLUDE tests/400-coverage.md | ||
|
|
||
| !INCLUDE implementation/300-typing.md | ||
|
|
||
| !INCLUDE implementation/400-todos.md | ||
|
|
||
| !INCLUDE tests/500-static-code-analysis.md level=2 | ||
|
|
||
| !INCLUDE implementation/500-function-and-method-ordering.md | ||
|
|
||
| !INCLUDE implementation/600-non-compliant-code.md | ||
|
|
||
| !INCLUDE publication/100-publishing.md |
This file contains hidden or 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 @@ | ||
| #!/usr/bin/env python3 | ||
|
javierdelapuente marked this conversation as resolved.
|
||
|
|
||
| """ | ||
| Parses a markdown template file (custom schema) | ||
| to render a markdown file. | ||
|
|
||
| The markdown template file supports the include of files with this syntax: | ||
| !INCLUDE <filename> level=xxx | ||
|
|
||
| The script will include the content of "filename" in place adapting the | ||
| heading level to xxx if necessary. | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| template = Path("CONTRIBUTING.mdt") | ||
|
|
||
| heading_level = 0 | ||
| in_comment = False | ||
| for template_line in template.read_text().split("\n"): | ||
| if template_line.startswith("#"): | ||
| heading_level = len(template_line.split(" ")[0]) | ||
|
|
||
| if not template_line.startswith("!INCLUDE"): | ||
| print(template_line) | ||
| continue | ||
|
|
||
| include_params = template_line.split(" ") | ||
| include_pattern = include_params[1] | ||
| if len(include_params) > 2 and include_params[2].startswith("level="): | ||
| heading_level = int(include_params[2][6:]) - 1 | ||
|
|
||
| for included_file in sorted(Path(".").rglob(include_pattern)): | ||
| for included_file_line in included_file.read_text().split("\n"): | ||
| if included_file_line.startswith("```"): | ||
| in_comment = not in_comment | ||
|
|
||
| if included_file_line.startswith("#") and not in_comment: | ||
| included_file_line = "#" * heading_level + included_file_line | ||
| print(included_file_line) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.