Skip to content
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

Actions changes to force python lint to success if no .py files are in PR #279

Merged
merged 13 commits into from
Jun 7, 2024
32 changes: 28 additions & 4 deletions .github/workflows/python_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: python_lint

on:
push:
paths:
- '**/*.py'
branches: "**"
pull_request:
paths:
- '**/*.py'
types: [opened, reopened, synchronize, closed]
branches: "**"

jobs:
flake8_py3:
Expand All @@ -19,17 +18,42 @@ jobs:
architecture: x64
- name: Checkout PyTorch
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install flake8
run: pip install flake8
- name: Check for Python file changes
id: file_check
uses: tj-actions/changed-files@v44
with:
sha: ${{ github.event.pull_request.head.sha }}
files: |
**.py
- name: Run flake8
if: steps.file_check.outputs.any_changed == 'true'
run: flake8 --ignore E501,W503,E203,W605
- name: No Python files changed
if: steps.file_check.outputs.any_changed != 'true'
run: echo "No Python files have been changed."

black_lint:
runs-on: ubuntu-latest
steps:
- name: Setup
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install black in jupyter
run: pip install black[jupyter]
- name: Check for Python file changes
id: file_check
uses: tj-actions/changed-files@v44
with:
sha: ${{ github.event.pull_request.head.sha }}
files: '**.py'
- name: Check code lints with Black
if: steps.file_check.outputs.any_changed == 'true'
uses: psf/black@stable
- name: No Python files changed
if: steps.file_check.outputs.any_changed != 'true'
run: echo "No Python files have been changed."
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Code contributions to the new version:

#### Changed

- Forcing python lint to success if no .py files are in PR [#279](https://github.com/BU-ISCIII/buisciii-tools/pull/279)

#### Removed

### Requirements
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Options:
-u, --api_user TEXT User for the API logging
-p, --api_password TEXT Password for the API logging
-c, --cred_file TEXT Config file with API logging credentials
--help Show this message and exit.
--help Show this message and exit

Commands:
list List available bu-isciii services.
Expand Down
8 changes: 4 additions & 4 deletions bu_isciii/scratch.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def revert_copy_scratch(self):
except Exception as e:
stderr.print(e)
stderr.print(
"[red]ERROR: Copy of the directory %s failed"
"[red]ERROR: Copy of directory %s failed"
% self.scratch_tmp_path,
highlight=False,
)
Expand Down Expand Up @@ -241,17 +241,17 @@ def remove_scratch(self):
if self.service_folder in scratch_folder:
shutil.rmtree(scratch_folder)
stderr.print(
"[green]Successfully removed the directory %s" % scratch_folder,
"[green]Successfully removed directory %s" % scratch_folder,
highlight=False,
)
else:
log.error(
f"Directory path not the same as service resolution. Skip folder copy '{scratch_folder}'"
f"Directory path is not the same as service resolution. Skip folder copy '{scratch_folder}'"
)
stderr.print(
"[red]ERROR: Directory "
+ scratch_folder
+ " not the same as "
+ " is not the same as "
+ self.scratch_tmp_path,
highlight=False,
)
Expand Down
Loading