mirror of
https://github.com/google/comprehensive-rust.git
synced 2024-11-28 10:03:09 +02:00
Format Python files with YAPF (#1360)
This commit is contained in:
parent
0022898ada
commit
c4ce2ab8a9
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -16,9 +16,9 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Gettext
|
||||
- name: Install formatting dependencies
|
||||
run: |
|
||||
sudo apt install gettext
|
||||
sudo apt install gettext yapf3
|
||||
|
||||
- name: Install nightly rustfmt
|
||||
run: |
|
||||
|
10
.github/workflows/prevent-msgid.py
vendored
10
.github/workflows/prevent-msgid.py
vendored
@ -4,13 +4,17 @@ for filename in os.popen("git diff --name-only").read().split():
|
||||
if not filename.endswith(".po"):
|
||||
continue
|
||||
|
||||
if "POT-Creation-Date" in os.popen(f"git diff --unified=0 {filename}").read():
|
||||
print(f"Assuming {filename} was changed automatically, skipping msgid check")
|
||||
if "POT-Creation-Date" in os.popen(
|
||||
f"git diff --unified=0 {filename}").read():
|
||||
print(
|
||||
f"Assuming {filename} was changed automatically, skipping msgid check"
|
||||
)
|
||||
continue
|
||||
|
||||
changed_lines = {
|
||||
i + 1
|
||||
for i, line in enumerate(os.popen(f"git blame {filename}").readlines())
|
||||
for i, line in enumerate(
|
||||
os.popen(f"git blame {filename}").readlines())
|
||||
if line.startswith("00000000")
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""mdbook preprocessor which will help show the presentation aspect ratio.
|
||||
|
||||
The preprocessor adds a large red rectangle on every page. The
|
||||
@ -31,6 +30,7 @@ import json
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
|
||||
def update_book_items(items):
|
||||
aspect_ratio_helper = textwrap.dedent("""
|
||||
<style>
|
||||
@ -74,6 +74,7 @@ def update_book_items(items):
|
||||
chapter['content'] = aspect_ratio_helper + chapter['content']
|
||||
update_book_items(chapter['sub_items'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "supports":
|
||||
@ -82,4 +83,3 @@ if __name__ == '__main__':
|
||||
context, book = json.load(sys.stdin)
|
||||
update_book_items(book['sections'])
|
||||
print(json.dumps(book))
|
||||
|
||||
|
@ -6,6 +6,9 @@
|
||||
},
|
||||
"exec": {
|
||||
"commands": [{
|
||||
"command": "yapf3",
|
||||
"exts": ["py"]
|
||||
}, {
|
||||
"command": "rustfmt --edition 2021",
|
||||
"exts": ["rs"]
|
||||
}, {
|
||||
|
Loading…
Reference in New Issue
Block a user