-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add python code style lint and format #147
Conversation
@@ -101,3 +103,24 @@ docs: | |||
|
|||
build_spl: clean | |||
python -m splunk_eventgen build --destination ./ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make lint
will only lint the newly added and changed parts of python files here.
@flake8 $(NEWLY_ADDED_PY_FILES) || true | ||
endif | ||
@git diff -U0 -- '*.py' | flake8 --diff || true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make format
will only format newly added python files and sort imports for both newly added and changed python files.
max-line-length = 120 | ||
|
||
[metadata] | ||
description-file = README.md | ||
version-from-file: __init__.py | ||
|
||
[yapf] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yapf
style is based on pep8
here.
@li-wu Will you be including linted code changes to this PR? |
@arctan5x , not really. This PR will not include the formatting changes for existing Python code. You can see that the command |
@li-wu If you want to introduce linting, I would recommend applying a linter to the codebase all together after the tests cases are added. |
Totally agree! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you all.
Let's format all the code after adding the unit test cases. In case there is any bug in the formatting tool which may introduce regression after formatting all the code.
No description provided.