mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Swift: autopep8 all python files
Additionally set up a pre-commit hook and a CI check for that.
This commit is contained in:
14
.github/workflows/swift-codegen.yml
vendored
14
.github/workflows/swift-codegen.yml
vendored
@@ -15,14 +15,18 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/fetch-codeql
|
||||
- uses: bazelbuild/setup-bazelisk@v2
|
||||
- uses: actions/setup-python@v3
|
||||
- uses: pre-commit/action@v3.0.0
|
||||
name: Check that python code is properly formatted
|
||||
with:
|
||||
extra_args: autopep8 --all-files
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
bazel test //swift/codegen/test --test_output=errors
|
||||
- name: Check that QL generated code was checked in
|
||||
run: |
|
||||
bazel run //swift/codegen
|
||||
git add swift
|
||||
git diff --exit-code HEAD
|
||||
- uses: pre-commit/action@v3.0.0
|
||||
name: Check that QL generated code was checked in
|
||||
with:
|
||||
extra_args: swift-codegen --all-files
|
||||
- name: Generate C++ files
|
||||
run: |
|
||||
bazel run //swift/codegen:codegen -- --generate=trap,cpp --cpp-output=$PWD/swift-generated-headers
|
||||
|
||||
@@ -15,6 +15,12 @@ repos:
|
||||
- id: clang-format
|
||||
files: ^swift/.*\.(h|c|cpp)$
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-autopep8
|
||||
rev: v1.6.0
|
||||
hooks:
|
||||
- id: autopep8
|
||||
files: ^swift/codegen/.*\.py
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: codeql-format
|
||||
|
||||
2
swift/codegen/.pep8
Normal file
2
swift/codegen/.pep8
Normal file
@@ -0,0 +1,2 @@
|
||||
[pep8]
|
||||
max_line_length = 120
|
||||
@@ -266,7 +266,6 @@ A:
|
||||
""")
|
||||
|
||||
|
||||
|
||||
def test_class_with_pragmas(load):
|
||||
ret = load("""
|
||||
A:
|
||||
|
||||
@@ -125,6 +125,7 @@ def test_one_table_overridden_underscore_named_field(generate_traps):
|
||||
cpp.Trap("foos", name="Foos", fields=[cpp.Field("whatever", "bar")]),
|
||||
]
|
||||
|
||||
|
||||
def test_one_table_no_tags(generate_tags):
|
||||
assert generate_tags([
|
||||
dbscheme.Table(name="foos", columns=[dbscheme.Column("bla", "int")]),
|
||||
|
||||
@@ -4,4 +4,3 @@ run_codeql_database_create([
|
||||
'swift package clean',
|
||||
'swift build'
|
||||
], lang='swift')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user