Skip to content

Commit b010c67

Browse files
committed
test 7
1 parent 2f50836 commit b010c67

2 files changed

Lines changed: 26 additions & 21 deletions

File tree

.github/workflows/pylint.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,29 @@ jobs:
88
strategy:
99
matrix:
1010
python-version: ["3.11", "3.12", "3.13"]
11+
1112
steps:
12-
- uses: actions/checkout@v4
13-
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v3
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
- name: Install dependencies
18-
run: |
19-
python -m pip install --upgrade pip
20-
pip install pylint
21-
- name: Analysing the code with pylint
22-
run: |
23-
echo CI_COMMIT_SHA=${CI_COMMIT_SHA}
24-
echo CI_MERGE_REQUEST_TARGET_BRANCH_NAME=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
25-
git fetch origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
26-
tmp_files=$(git diff --name-only ${CI_COMMIT_SHA} origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME})
27-
echo "Changed files are $tmp_files"
28-
if [ -z "$(echo "$tmp_files" | grep "\.py")" ]; then exit 0; else echo "Python files are found"; fi
29-
tmp_pfiles=$(echo "$tmp_files" | grep "\.py")
30-
echo "Python files are $tmp_pfiles"
31-
mkdir ./pylint
32-
pylint $tmp_pfiles | tee ./pylint/pylint.log || pylint-exit $?
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v3
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install pylint
26+
27+
- name: Get modified Python files
28+
id: changed-files
29+
run: |
30+
FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- '*.py' | tr '\n' ' ')
31+
echo "files=$FILES" >> $GITHUB_OUTPUT
32+
33+
- name: Analysing the code with pylint
34+
if: steps.changed-files.outputs.files != ''
35+
run: |
36+
pylint ${{ steps.changed-files.outputs.files }}

autograder/context.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ def get_request(self):
2828
raise Exception("RequestContext has not been initialized. Call set_request() first.")
2929
return self.request
3030

31+
# Create a globally accessible instance
3132
request_context = RequestContext.get_instance()

0 commit comments

Comments
 (0)