Skip to content
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

Check for bad white space before running tests #9809

Merged
merged 1 commit into from
Jan 22, 2015

Conversation

eschnett
Copy link
Contributor

No description provided.

@tkelman
Copy link
Contributor

tkelman commented Jan 17, 2015

This would break building when git is not present, which we should theoretically support via NO_GIT. I'll modify the check-whitespace target so it gets skipped in that case.

@eschnett
Copy link
Contributor Author

Maybe we should use find and perl instead of git? This way, we could also look for tabs, could check for trailing empty lines, missing newlines on the last list, tab/space confusion, etc.

@tkelman
Copy link
Contributor

tkelman commented Jan 18, 2015

That might make sense, but be careful with what you assume find supports - it's quite likely that the OSX, GNU, and BSD versions are all a bit different.

@eschnett
Copy link
Contributor Author

I was thinking of using -name ... and -print, maybe augmented by a -type f. But we could also emulate find with perl.

Or, we write the checker in Julia. When we are about to run the tests, there's a functional Julia environment.

@ihnorton
Copy link
Member

Realistically this only matters when git is present. If you aren't sending
something upstream, whitespaces are between you and your editor.
On Jan 17, 2015 7:18 PM, "Erik Schnetter" [email protected] wrote:

I was thinking of using -name ... and -print, maybe augmented by a -type f.
But we could also emulate find with perl.

Or, we write the checker in Julia. When we are about to run the tests,
there's a functional Julia environment.


Reply to this email directly or view it on GitHub
#9809 (comment).

@tkelman
Copy link
Contributor

tkelman commented Jan 18, 2015

There's also no need to search through files that aren't checked in.

@tkelman
Copy link
Contributor

tkelman commented Jan 21, 2015

Let's try this out. Any objections to merging?

@timholy
Copy link
Sponsor Member

timholy commented Jan 21, 2015

I guess the idea here is to detect whitespace problems before things get submitted to Travis? Given that we have Travis set to fail, that seems like a good idea.

But just checking: among large, active open-source projects, how common is it to be dogmatic about whitespace? I'm just wondering about the balance between keeping the codebase clean and putting up yet one more barrier (learning git is bad enough) for new contributors.

@tkelman
Copy link
Contributor

tkelman commented Jan 21, 2015

We'd have to restrict that search to languages that don't yet have good auto-formatting tools. I think a better long-term solution than failing for nitpicky stuff like this would be to write a jlformat tool that just fixes trivial stuff automatically, and run it on base once a week or so. We could also pretty easily adopt clang-format for the C/C++ source, though it might be fiddly to come up with a configuration that closely matches what we've been doing so far (since clang-format is highly configurable).

Problem is no one has written such a tool for Julia yet, AFAIK. I think it was a suggested GSoC project last year, and presumably will be again this year unless someone implements it before then.

@jakebolewski
Copy link
Member

@timholy (my personal) long-term goal was to start a process where we would eventually have automated style / syntax checks against any code submitted to base. Pretty much every large open source project has this. Whitespace was first, it is easy to check for and cleans up diffs, but hopefully more will come later. As @tkelman pointed out, a set of agreed upon standards makes it easier to write automated tools. Maybe the make target should be make check-format to get the point across.

Tools like clang-format don't get written in a vacuum. clang-format was written because the LLVM / Clang project adopted a set of standards that they rigorously enforced. This was painful, so someone initiated the process to enforce those standards automatically.

@timholy
Copy link
Sponsor Member

timholy commented Jan 21, 2015

Thanks for explaining. Since I find it annoying when I run across code that uses tabs rather than spaces, I am persuaded that long term this will be a good thing.

jakebolewski added a commit that referenced this pull request Jan 22, 2015
Check for bad white space before running tests
@jakebolewski jakebolewski merged commit 7186872 into JuliaLang:master Jan 22, 2015
@eschnett eschnett deleted the patch-4 branch January 22, 2015 21:58
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