From e8cafc430cef8b07f3726e306399e2a41b5548d9 Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 22:54:06 -0800 Subject: [PATCH 01/12] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8308198..9043efc 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,6 @@ This course will walk you through writing your first action and using it with a workflow file. -**Ready to get started? Navigate to the first issue.** \ No newline at end of file +Testing + +**Ready to get started? Navigate to the first issue.** From 6b6a1921f3432b1aeba55afec4839bd20f1b0243 Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:01:08 -0800 Subject: [PATCH 02/12] Create test.py --- test.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 test.py diff --git a/test.py b/test.py new file mode 100644 index 0000000..2079bda --- /dev/null +++ b/test.py @@ -0,0 +1,4 @@ +x = 1 +if x == 1: + # indented four spaces + print("x is 1.") From 79dd72e7ce9fd6758703c5e332c8f466157c3f1d Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:03:24 -0800 Subject: [PATCH 03/12] Update test.py --- test.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/test.py b/test.py index 2079bda..b04a9a1 100644 --- a/test.py +++ b/test.py @@ -1,4 +1,21 @@ -x = 1 -if x == 1: - # indented four spaces - print("x is 1.") +import math, sys; + +def example1(): + ####This is a long comment. This should be wrapped to fit within 72 characters. + some_tuple=( 1,2, 3,'a' ); + some_variable={'long':'Long code lines should be wrapped within 79 characters.', + 'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'], + 'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1, + 20,300,40000,500000000,60000000000000000]}} + return (some_tuple, some_variable) +def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key('')); +class Example3( object ): + def __init__ ( self, bar ): + #Comments should have a space after the hash. + if bar : bar+=1; bar=bar* bar ; return bar + else: + some_string = """ + Indentation in multiline strings should not be touched. +Only actual code should be reindented. +""" + return (sys.path, some_string) From 224764f0f9440926d95d2e63e49e61a8f4a18677 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Mon, 25 Jan 2021 07:03:50 +0000 Subject: [PATCH 04/12] Automated changes --- test.py | 54 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/test.py b/test.py index b04a9a1..1d655b8 100644 --- a/test.py +++ b/test.py @@ -1,21 +1,45 @@ -import math, sys; +import math +import sys + def example1(): - ####This is a long comment. This should be wrapped to fit within 72 characters. - some_tuple=( 1,2, 3,'a' ); - some_variable={'long':'Long code lines should be wrapped within 79 characters.', - 'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'], - 'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1, - 20,300,40000,500000000,60000000000000000]}} + # This is a long comment. This should be wrapped to fit within 72 + # characters. + some_tuple = (1, 2, 3, 'a') + some_variable = { + 'long': 'Long code lines should be wrapped within 79 characters.', + 'other': [ + math.pi, + 100, + 200, + 300, + 9876543210, + 'This is a long string that goes on'], + 'more': { + 'inner': 'This whole logical line should be wrapped.', + some_tuple: [ + 1, + 20, + 300, + 40000, + 500000000, + 60000000000000000]}} return (some_tuple, some_variable) -def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key('')); -class Example3( object ): - def __init__ ( self, bar ): - #Comments should have a space after the hash. - if bar : bar+=1; bar=bar* bar ; return bar - else: - some_string = """ + + +def example2(): return ('' in {'f': 2}) in {'has_key() is deprecated': True} + + +class Example3(object): + def __init__(self, bar): + # Comments should have a space after the hash. + if bar: + bar += 1 + bar = bar * bar + return bar + else: + some_string = """ Indentation in multiline strings should not be touched. Only actual code should be reindented. """ - return (sys.path, some_string) + return (sys.path, some_string) From 2c4a1860a8a7451bc37fbe22037fd836cabd9de9 Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:12:53 -0800 Subject: [PATCH 05/12] Update test.py --- test.py | 54 +++++++++++++++--------------------------------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/test.py b/test.py index 1d655b8..b04a9a1 100644 --- a/test.py +++ b/test.py @@ -1,45 +1,21 @@ -import math -import sys - +import math, sys; def example1(): - # This is a long comment. This should be wrapped to fit within 72 - # characters. - some_tuple = (1, 2, 3, 'a') - some_variable = { - 'long': 'Long code lines should be wrapped within 79 characters.', - 'other': [ - math.pi, - 100, - 200, - 300, - 9876543210, - 'This is a long string that goes on'], - 'more': { - 'inner': 'This whole logical line should be wrapped.', - some_tuple: [ - 1, - 20, - 300, - 40000, - 500000000, - 60000000000000000]}} + ####This is a long comment. This should be wrapped to fit within 72 characters. + some_tuple=( 1,2, 3,'a' ); + some_variable={'long':'Long code lines should be wrapped within 79 characters.', + 'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'], + 'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1, + 20,300,40000,500000000,60000000000000000]}} return (some_tuple, some_variable) - - -def example2(): return ('' in {'f': 2}) in {'has_key() is deprecated': True} - - -class Example3(object): - def __init__(self, bar): - # Comments should have a space after the hash. - if bar: - bar += 1 - bar = bar * bar - return bar - else: - some_string = """ +def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key('')); +class Example3( object ): + def __init__ ( self, bar ): + #Comments should have a space after the hash. + if bar : bar+=1; bar=bar* bar ; return bar + else: + some_string = """ Indentation in multiline strings should not be touched. Only actual code should be reindented. """ - return (sys.path, some_string) + return (sys.path, some_string) From ef5eeefdb74eaaf7d5eb8ef3b8b6abae3b2d50e8 Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:18:40 -0800 Subject: [PATCH 06/12] Update main.yml --- .github/workflows/main.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b68c7e9..20f6ffb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,11 +16,3 @@ jobs: - name: Check for modified files id: git-check run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) - - name: Push changes - if: steps.git-check.outputs.modified == 'true' - run: | - git config --global user.name 'Peter Evans' - git config --global user.email 'peter-evans@users.noreply.github.com' - git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} - git commit -am "Automated changes" - git push From dca837e42fc937e60eb7ff1fc92d081569a0e200 Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:20:41 -0800 Subject: [PATCH 07/12] Update test.py --- test.py | 54 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/test.py b/test.py index b04a9a1..1d655b8 100644 --- a/test.py +++ b/test.py @@ -1,21 +1,45 @@ -import math, sys; +import math +import sys + def example1(): - ####This is a long comment. This should be wrapped to fit within 72 characters. - some_tuple=( 1,2, 3,'a' ); - some_variable={'long':'Long code lines should be wrapped within 79 characters.', - 'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'], - 'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1, - 20,300,40000,500000000,60000000000000000]}} + # This is a long comment. This should be wrapped to fit within 72 + # characters. + some_tuple = (1, 2, 3, 'a') + some_variable = { + 'long': 'Long code lines should be wrapped within 79 characters.', + 'other': [ + math.pi, + 100, + 200, + 300, + 9876543210, + 'This is a long string that goes on'], + 'more': { + 'inner': 'This whole logical line should be wrapped.', + some_tuple: [ + 1, + 20, + 300, + 40000, + 500000000, + 60000000000000000]}} return (some_tuple, some_variable) -def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key('')); -class Example3( object ): - def __init__ ( self, bar ): - #Comments should have a space after the hash. - if bar : bar+=1; bar=bar* bar ; return bar - else: - some_string = """ + + +def example2(): return ('' in {'f': 2}) in {'has_key() is deprecated': True} + + +class Example3(object): + def __init__(self, bar): + # Comments should have a space after the hash. + if bar: + bar += 1 + bar = bar * bar + return bar + else: + some_string = """ Indentation in multiline strings should not be touched. Only actual code should be reindented. """ - return (sys.path, some_string) + return (sys.path, some_string) From 24e4e048364c07c8c1302d2350eefdbefac28e71 Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:22:35 -0800 Subject: [PATCH 08/12] Update test.py --- test.py | 54 +++++++++++++++--------------------------------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/test.py b/test.py index 1d655b8..b04a9a1 100644 --- a/test.py +++ b/test.py @@ -1,45 +1,21 @@ -import math -import sys - +import math, sys; def example1(): - # This is a long comment. This should be wrapped to fit within 72 - # characters. - some_tuple = (1, 2, 3, 'a') - some_variable = { - 'long': 'Long code lines should be wrapped within 79 characters.', - 'other': [ - math.pi, - 100, - 200, - 300, - 9876543210, - 'This is a long string that goes on'], - 'more': { - 'inner': 'This whole logical line should be wrapped.', - some_tuple: [ - 1, - 20, - 300, - 40000, - 500000000, - 60000000000000000]}} + ####This is a long comment. This should be wrapped to fit within 72 characters. + some_tuple=( 1,2, 3,'a' ); + some_variable={'long':'Long code lines should be wrapped within 79 characters.', + 'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'], + 'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1, + 20,300,40000,500000000,60000000000000000]}} return (some_tuple, some_variable) - - -def example2(): return ('' in {'f': 2}) in {'has_key() is deprecated': True} - - -class Example3(object): - def __init__(self, bar): - # Comments should have a space after the hash. - if bar: - bar += 1 - bar = bar * bar - return bar - else: - some_string = """ +def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key('')); +class Example3( object ): + def __init__ ( self, bar ): + #Comments should have a space after the hash. + if bar : bar+=1; bar=bar* bar ; return bar + else: + some_string = """ Indentation in multiline strings should not be touched. Only actual code should be reindented. """ - return (sys.path, some_string) + return (sys.path, some_string) From b8454c5d2b9110a5bab8ee49a13233fe9a13bdac Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:29:29 -0800 Subject: [PATCH 09/12] Update main.yml --- .github/workflows/main.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 20f6ffb..968a0ad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,18 +1,13 @@ -name: auto-format -on: pull_request +name: clang-format Check +on: [push, pull_request] jobs: - format: - # Check if the PR is not from a fork - if: github.event.pull_request.head.repo.full_name == github.repository + formatting-check: + name: Formatting Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - with: - ref: ${{ github.head_ref }} - - name: autopep8 - uses: peter-evans/autopep8@v1 - with: - args: --exit-code --recursive --in-place --aggressive --aggressive . - - name: Check for modified files - id: git-check - run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) + - uses: actions/checkout@v2 + - name: Run clang-format style check for C/C++ programs. + uses: jidicula/clang-format-action@v3.1.0 + with: + clang-format-version: '11' + check-path: 'src' From ede902a367daaaa9e550b0027be7115c5134c0ca Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:31:04 -0800 Subject: [PATCH 10/12] Create test.cpp --- test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test.cpp diff --git a/test.cpp b/test.cpp new file mode 100644 index 0000000..5dd8785 --- /dev/null +++ b/test.cpp @@ -0,0 +1,8 @@ +void +f() +{ + someFunction(); + if (true, false) { + f(); + } +} From bc0ec6895298504df5b2a51f26936fbcd04395e0 Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:33:10 -0800 Subject: [PATCH 11/12] Update test.cpp --- test.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test.cpp b/test.cpp index 5dd8785..becfe27 100644 --- a/test.cpp +++ b/test.cpp @@ -1,8 +1 @@ -void -f() -{ - someFunction(); - if (true, false) { - f(); - } -} +int x = 1; From c2a40251773f81b9ef5373833c9ed4845240f61c Mon Sep 17 00:00:00 2001 From: Jia Li Date: Sun, 24 Jan 2021 23:34:41 -0800 Subject: [PATCH 12/12] Update test.cpp --- test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.cpp b/test.cpp index becfe27..0590c3f 100644 --- a/test.cpp +++ b/test.cpp @@ -1 +1 @@ -int x = 1; +int x = 1;