Skip to content
Snippets Groups Projects
Commit befd58f4 authored by Neil Pilgrim's avatar Neil Pilgrim Committed by Andrew Morgan
Browse files

Document lint.sh & allow application to specified files only (#6312)

parent ace947e8
No related branches found
Tags v1.29.0rc1
No related merge requests found
...@@ -58,6 +58,14 @@ All Matrix projects have a well-defined code-style - and sometimes we've even ...@@ -58,6 +58,14 @@ All Matrix projects have a well-defined code-style - and sometimes we've even
got as far as documenting it... For instance, synapse's code style doc lives got as far as documenting it... For instance, synapse's code style doc lives
at https://github.com/matrix-org/synapse/tree/master/docs/code_style.md. at https://github.com/matrix-org/synapse/tree/master/docs/code_style.md.
To facilitate meeting these criteria you can run ``scripts-dev/lint.sh``
locally. Since this runs the tools listed in the above document, you'll need
python 3.6 and to install each tool. **Note that the script does not just
test/check, but also reformats code, so you may wish to ensure any new code is
committed first**. By default this script checks all files and can take some
time; if you alter only certain files, you might wish to specify paths as
arguments to reduce the run-time.
Please ensure your changes match the cosmetic style of the existing project, Please ensure your changes match the cosmetic style of the existing project,
and **never** mix cosmetic and functional changes in the same commit, as it and **never** mix cosmetic and functional changes in the same commit, as it
makes it horribly hard to review otherwise. makes it horribly hard to review otherwise.
......
Document the use of `lint.sh` for code style enforcement & extend it to run on specified paths only.
...@@ -7,7 +7,15 @@ ...@@ -7,7 +7,15 @@
set -e set -e
isort -y -rc synapse tests scripts-dev scripts if [ $# -ge 1 ]
flake8 synapse tests then
python3 -m black synapse tests scripts-dev scripts files=$*
else
files="synapse tests scripts-dev scripts"
fi
echo "Linting these locations: $files"
isort -y -rc $files
flake8 $files
python3 -m black $files
./scripts-dev/config-lint.sh ./scripts-dev/config-lint.sh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment