Skip to content

Commit

Permalink
add in formatting skip everything
Browse files Browse the repository at this point in the history
ghstack-source-id: 34fe56595eac4d1a2fecb07a230307c0b2b767d7
Pull Request resolved: #688
  • Loading branch information
drisspg committed Aug 30, 2024
1 parent 18e38f1 commit 5af3db7
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/ruff_linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Code Analysis with Ruff

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Analyzing the code with ruff
run: |
ruff check .
- name: Check well formatted code
run: |
ruff format --check
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.6
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
4 changes: 4 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ tabulate # QOL for printing tables to stdout

# Custom CUDA Extensions
ninja

# Linting
ruff
pre-commit
8 changes: 8 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Currently, we ignore all files in the project by default.
# We plan to add files in chunks using the 'include' list below.
# To add a new path: Simply add it to the 'include' list.
# Example: To lint all files in every subfolder of 'test', add "test/**/*"
include = [
"torchao/float8/inference.py",
"torchao/float8/float8_utils.py",
]
2 changes: 1 addition & 1 deletion torchao/float8/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from dataclasses import dataclass

from enum import auto, Enum
from typing import Callable, List, Optional
from typing import Callable, Optional

import torch
import torch.nn as nn
Expand Down

0 comments on commit 5af3db7

Please sign in to comment.