Skip to content

Commit

Permalink
Init the linter for Llama-MoD project.
Browse files Browse the repository at this point in the history
  • Loading branch information
keli-wen committed May 27, 2024
1 parent 8f2cfcd commit d56a52c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool.black]
line-length = 80

[tool.isort]
profile = "black"

[tool.ruff.lint]
select = ["D", "W505"]
ignore = ["D100", "D102", "D104", "D105", "D107", "D203", "D213", "D401", "D402"]

[tool.ruff.lint.pycodestyle]
max-doc-length = 100

[tool.ruff.lint.pydocstyle]
convention = "google"
28 changes: 28 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Check if ufmt and ruff are installed.
if ! command -v ufmt &> /dev/null
then
echo "ufmt could not be found"
echo "Please install ufmt by running 'pip install ufmt'"
exit
fi

if ! command -v ruff &> /dev/null
then
# https://docs.astral.sh/ruff/tutorial/
echo "ruff could not be found"
echo "Please install ruff by running 'pip install ruff'"
exit
fi

# Check if arguments are provided.
if [ "$#" -eq 0 ]
then
# Lint all files in the current directory, and fix any fixable errors.
echo "Lint all files"
ufmt format MoD/
ruff check MoD/ --fix
else
echo "Lint specific files"
ufmt format "$@"
ruff check "$@" --fix
fi

0 comments on commit d56a52c

Please sign in to comment.