diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml index 9225af459..dca19a00f 100644 --- a/.github/workflows/format_check.yml +++ b/.github/workflows/format_check.yml @@ -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' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c4fd6475b..744b4e642 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/modules/createSAM/AutoSDA/Preprocessing/CleanBeamSectionDatabase.ipynb b/modules/createSAM/AutoSDA/Preprocessing/CleanBeamSectionDatabase.ipynb index 5d6469510..abbe355f2 100644 --- a/modules/createSAM/AutoSDA/Preprocessing/CleanBeamSectionDatabase.ipynb +++ b/modules/createSAM/AutoSDA/Preprocessing/CleanBeamSectionDatabase.ipynb @@ -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)" ] diff --git a/pyproject.toml b/pyproject.toml index 43fede178..29ad35b40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"