Skip to content

Commit

Permalink
Use @SuppressWarnings for checkstyle suppressions & warnings
Browse files Browse the repository at this point in the history
It's better to use @SuppressWarnings instead of the suppressions file, so that the warning suppression is at the place where it acts.
  • Loading branch information
Stypox committed Mar 18, 2022
1 parent 710964b commit 53f8415
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public int getItemCount() {
return count;
}

@SuppressWarnings("FinalParameters")
@Override
public int getItemViewType(int position) {
if (DEBUG) {
Expand Down Expand Up @@ -300,6 +301,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup paren
}
}

@SuppressWarnings("FinalParameters")
@Override
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) {
if (DEBUG) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ public void seek(final boolean forward) {
//////////////////////////////////////////////////////////////////////////*/
//region Playback initialization via intent

@SuppressWarnings("MethodLength")
public void handleIntent(@NonNull final Intent intent) {
// fail fast if no play queue was provided
final String queueCache = intent.getStringExtra(PLAY_QUEUE_KEY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class PlayQueueItem implements Serializable {
item.getUploaderUrl(), item.getStreamType());
}

@SuppressWarnings("ParameterNumber")
private PlayQueueItem(@Nullable final String name, @Nullable final String url,
final int serviceId, final long duration,
@Nullable final String thumbnailUrl, @Nullable final String uploader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public void close() throws IOException {
outStream = null;
}

@SuppressWarnings("MethodLength")
public void build(final SharpStream output) throws IOException {
if (done) {
throw new RuntimeException("already done");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public void close() {
clustersOffsetsSizes = null;
}

@SuppressWarnings("MethodLength")
public void build(final SharpStream out) throws IOException, RuntimeException {
if (!out.canRewind()) {
throw new IOException("The output stream must be allow seek");
Expand Down
8 changes: 1 addition & 7 deletions checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="FinalParameters"
files="LocalItemListAdapter.java"
lines="232,304"/>

<suppress checks="EmptyBlock"
files="ContentSettingsFragment.java"
lines="227,245"/>
<!-- Use @SuppressWarnings("...") if it is possible, only use this file if it is not -->

<suppress checks="FileLength"
files="Player.java"/>
Expand Down

0 comments on commit 53f8415

Please sign in to comment.