-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init the linter for Llama-MoD project.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |