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

Code quality #307

Merged
merged 6 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions .github/workflows/format_check.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
name: Format Check

name: Ruff format
on: [push, pull_request]

jobs:
format-check:
ruff:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff

- name: Check code formatting
run: |
ruff check . --diff
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
args: 'format --check'
25 changes: 4 additions & 21 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
name: Lint

name: Ruff check
on: [push, pull_request]

jobs:
lint:
ruff:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff

- name: Run linter
run: |
ruff check .
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
"source": [
"import pandas as pd\n",
"\n",
"with open('BeamDatabase1.csv', 'r') as file: # noqa: PTH123, UP015\n",
"with open('BeamDatabase1.csv') as file: # noqa: PTH123\n",
" beam_section_database = pd.read_csv(file, header=0)\n",
"\n",
"# Beam section weight shall be less than 300 lb/ft\n",
"# Beam flange thickness shall be less than 1.75 inch.\n",
"target_index = []\n",
"for indx in beam_section_database['index']:\n",
" if (beam_section_database.loc[indx, 'weight'] >= 300): # noqa: PLR2004, SIM114\n",
" target_index.append(indx)\n",
" elif (beam_section_database.loc[indx, 'tf'] >= 1.75): # noqa: PLR2004\n",
" target_index.append(indx)\n",
" if (\n",
" beam_section_database.loc[indx, 'weight'] >= 300 # noqa: PLR2004\n",
" or beam_section_database.loc[indx, 'tf'] >= 1.75 # noqa: PLR2004\n",
" ):\n",
" target_index.append(indx) # noqa: PERF401\n",
"clean_beam_section = beam_section_database.drop(index=target_index)\n",
"clean_beam_section.to_csv('BeamDatabase2.csv', sep=',', index=False)"
]
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ select = ["ALL"]
ignore = ["ANN", "D211", "D212", "Q000", "Q003", "COM812", "D203", "ISC001", "E501", "ERA001", "PGH003", "FIX002", "TD003", "S101", "N801", "S311", "G004", "SIM102", "SIM108", "NPY002", "F401"]
preview = false

[tool.ruff.lint.per-file-ignores]
"path/to/folder/*" = ["ALL"]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

Expand Down
Loading