-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 code style with Checkstyle #3282
Conversation
How can i import this into Android Studio, so that the autoformatter will follow those rules? |
And another question, how to check if the code style is ok, without pushing to github and wait for Travis? Edit: you replied to me from IRC, but I guess other people want to know (or they will want to know when this is merged). You have to run This should be asked and required to run, and added in PR template @wb9688 @Poolitzer |
Not needed if you fix everything before you merge this.
Happily. |
Am I correct in the assumption, that this is still a draft, because the build fails, because the style isn't all correct? |
You are right, and @wb9688 is fixing them. There was about 8000 issues, now about 3000. |
@B0pol and @Poolitzer: It doesn't need to be added to the PR template. It'll run on every build, and make the build fail when there are code style issues. @connectety: That's correct and I'm fixing them. |
The point is telling developers to run it locally so they dont push it, geta a travis fail, figure out what the reason is, and then fix it in an unnecessary commit |
@Poolitzer: No, as I said, it'll run on every single build. So if you press the run or build button in Android Studio (or do e.g. |
I would find the build failing very annoying while developing and adding some temporary (log) statements, which may not adhere to the checkstyle. |
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.
Had a brief look at the first ~100 files. Thank you for this tedious work!
app/src/main/java/org/schabi/newpipe/CheckForNewAppVersionTask.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/list/videos/RelatedVideosFragment.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/list/videos/RelatedVideosFragment.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/list/videos/RelatedVideosFragment.java
Show resolved
Hide resolved
@Stypox: Those things are probably caused by me using the Android Studio's reformatter initially on all files, and/or Git fucking up rebase. |
@B0pol: Yes, it's intended that there are some warnings, but those are not errors. We should maybe disable |
I removed my message because I had no more this after rerun, but it was just a bug
Why another pr? It's harder to find the error between 161 warnings, if you remove these warnings, only one line will show up. also, why is newpipe.streams excluded? |
Because it's a lot of work and not really needed. We could just disable
I didn't want to do that, since I had |
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.
Thank your for the effort!
Tested this and does not seem to break anything. I'll leave two things open for discussion.
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.
Aaagh, loading all diffs made Firefox behave strangely ;-)
Anyway, I should have briefly looked at all files now, I found a few more little issues, and when those are solved this can be merged. I also tested a little bit on my phone (Android 7.0) by doing random things, though I don't know if it matters much. @TobiGr how do you go about testing? Do you have a list of things to do in order to make sure everything is working fine?
Thank you again!
app/src/main/java/org/schabi/newpipe/info_list/holder/ChannelInfoItemHolder.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/local/subscription/services/BaseImportExportService.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/player/playback/MediaSourceManager.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/player/playback/MediaSourceManager.java
Show resolved
Hide resolved
Happy rebasing to everyone who has a PR open ;) |
@TobiGr |
@XiangRongLin: Did you change anything in that file? If so, update the line numbers in checkstyle-suppressions.xml. |
@XiangRongLin That's strange because the build for the merge commit 2403184 succeded |
@TobiGr
I'm on the dev branch without any changes. If i increase the line limit, it builds |
@XiangRongLin: That's not possible if it fails on the lines you mention. E.g. line 725 definitely isn't longer than 100 characters. @kapodamy: Would you mind fixing the errors I've suppressed in
|
@wb9688 |
@XiangRongLin: Have you set something else in <property name="file" value="checkstyle-suppressions.xml"/> It should just work on |
@wb9688 The reason why the other lines also appeared is because i fixed line 713 by splitting it into two lines. This causes everything below to be moved one line down, which in turn cause the errors to be in one line lower. Now they don't match the suppression and appear as errors. Edit: this took me way too long to figure out |
@XiangRongLin: I don't know what you're doing, but on my PC that line is exactly 100 characters. Edit: Maybe your PC is acting weird because of the |
I tried runCheckstyle in a fresh clone on my windows pc with JDK 8 and in my ubuntu vm with openJDK 11. I'll just set the max to 101 locally and forget that this problem existed. Edit.: It is that |
What is it?
Long description of the changes in your PR
This PR will let Travis check the code style of all PRs. Do you think this should be run before every build as well?
I'm also going to fix all the current code style issues, except in GigaCrap, so I excluded that already in
build.gradle
.The Checkstyle configuration is based on this, but I disabled some checks.
I'm going to implement this for NewPipeExtractor as well.
Agreement