Skip to content

[Python] Add flake8 config #74

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

Merged
merged 1 commit into from
Mar 14, 2016
Merged

Conversation

modocache
Copy link
Contributor

In swiftlang/swift#1153, @practicalswift added a flake8 config to the Swift project, in order to lint the Python scripts used by that project. This does the same for XCTest.

This includes all the linting rules active on the main Swift repository. It also includes tweaks to build_script.py, which bring this project in full compliance with those linting rules.

To lint the Python code in the project:

$ flake8

To install flake8:

$ pip install flake8

See https://flake8.readthedocs.org/en/latest/ for details.

In swiftlang/swift#1153, @practicalswift added a
flake8 config to the Swift project, in order to lint the Python scripts
used by that project. This does the same for XCTest.

This includes all the linting rules active on the main Swift repository.
It also includes tweaks to `build_script.py`, which bring this project in full
compliance with those linting rules.

To lint the Python code in the project:

    $ flake8

To install flake8:

    $ pip install flake8

See https://flake8.readthedocs.org/en/latest/ for details.
@briancroom
Copy link
Contributor

Neat!

Do you think it would make sense to have these checks included in CI. Since the build_script.py is only really designed to work on Linux at this point, I guess that would mean adding the invocation to the overall Swift build script.

@mike-ferris
Copy link

This just adds a config file to allow those use of this listing tools for those who may want to, right?

Seems reasonable.

@modocache
Copy link
Contributor Author

Do you think it would make sense to have these checks included in CI.

I absolutely do! I wonder if @practicalswift has already put any thought into this. Personally I think it's a great idea, but I'm not sure how I would feel if Python linter errors caused CI to fail... thoughts? 🙌

modocache added a commit that referenced this pull request Mar 14, 2016
[Python] Add flake8 config
@modocache modocache merged commit a32ae82 into swiftlang:master Mar 14, 2016
@modocache modocache deleted the add-pep8 branch March 14, 2016 14:07
@practicalswift
Copy link

@modocache Perhaps the first step could be to run flake8 (if available in PATH) as part of the build process, but without failing the build on linter errors.

The --exit-zero option could be used for that:

--exit-zero           exit with code 0 even if there are errors

Simply printing the linting errors/warnings would reduce the risk of PEP-8 regressions significantly.

What do you think? :-)

@modocache
Copy link
Contributor Author

I like it! Would we be able to pip install flake8 as part of the build script, or would we need to ask one of the Apple CI gurus to install them on the build machines?

Either way, you should send a pull request! 🚀

@modocache
Copy link
Contributor Author

@practicalswift You know what would be really cool?

@swift-ci Please lint Python

The cool part about this would be the fact that that CI step could fail, but contributors would see that it was just the Python linting that failed, not any of the tests or validation tests.

@practicalswift
Copy link

@modocache That would be really nice! Who is in charge of the CI buildbot? Is it you @shahmishal? :-)

@shahmishal
Copy link
Member

Yes, I will set this up on CI can you please create a Jira ticket. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants