Skip to content

Commit 2ad6eb0

Browse files
authored
feat: Adds checkstyle module. (#1685)
* feat: Adds checkstyle module.
1 parent 1dc20bf commit 2ad6eb0

File tree

12 files changed

+81
-29
lines changed

12 files changed

+81
-29
lines changed

checkstyle.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

jvb/checkstyle.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
6+
<module name="Checker">
7+
<module name="LineLength">
8+
<property name="fileExtensions" value="java"/>
9+
<property name="max" value="120"/>
10+
<property name="ignorePattern" value="http://|https://"/>
11+
</module>
12+
13+
<module name="TreeWalker">
14+
<module name="LeftCurly">
15+
<property name="option" value="nl"/>
16+
<property name="tokens" value="LITERAL_CATCH"/>
17+
<property name="tokens" value="LITERAL_ELSE"/>
18+
<property name="tokens" value="LITERAL_FINALLY"/>
19+
<property name="tokens" value="LITERAL_IF"/>
20+
<property name="tokens" value="LITERAL_TRY"/>
21+
</module>
22+
23+
<!-- Skips empty blocks {}, to not skip them: value="alone" -->
24+
<module name="RightCurly">
25+
<property name="option" value="alone_or_singleline"/>
26+
</module>
27+
28+
<module name="WhitespaceAfter">
29+
<!-- Drops TYPECAST from default tokens -->
30+
<property name="tokens" value="COMMA , SEMI , LITERAL_IF , LITERAL_ELSE , LITERAL_WHILE , LITERAL_DO , LITERAL_FOR , DO_WHILE"/>
31+
</module>
32+
</module>
33+
34+
<module name="FileTabCharacter">
35+
<property name="eachLine" value="true"/>
36+
</module>
37+
</module>

jvb/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,21 @@
457457
<artifactId>maven-surefire-plugin</artifactId>
458458
<version>2.22.2</version>
459459
</plugin>
460+
<plugin>
461+
<groupId>org.apache.maven.plugins</groupId>
462+
<artifactId>maven-checkstyle-plugin</artifactId>
463+
<version>3.1.1</version>
464+
<configuration>
465+
<configLocation>checkstyle.xml</configLocation>
466+
</configuration>
467+
<executions>
468+
<execution>
469+
<goals>
470+
<goal>check</goal>
471+
</goals>
472+
</execution>
473+
</executions>
474+
</plugin>
460475
<plugin>
461476
<groupId>com.github.spotbugs</groupId>
462477
<artifactId>spotbugs-maven-plugin</artifactId>

jvb/src/main/java/org/jitsi/videobridge/Conference.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,8 @@ private double getMaxReceiverRtt(String excludedEndpointId)
493493
*/
494494
void expire()
495495
{
496-
if (!expired.compareAndSet(false, true)) {
496+
if (!expired.compareAndSet(false, true))
497+
{
497498
return;
498499
}
499500

jvb/src/main/java/org/jitsi/videobridge/cc/vp8/VP8AdaptiveSourceProjectionContext.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,8 @@ private VP8FrameProjection createLayerSwitchProjection(
462462
tl0PicIdx = VpxUtils.applyTl0PicIdxDelta(lastVP8FrameProjection.getTl0PICIDX(),
463463
1);
464464
}
465-
else {
465+
else
466+
{
466467
picId = frame.getPictureId();
467468
tl0PicIdx = frame.getTl0PICIDX();
468469
}
@@ -708,7 +709,8 @@ public void rewriteRtp(
708709
throw new RewriteException("Frame not in tracker (aged off?)");
709710
}
710711

711-
if (vp8Frame.getProjection() == null) {
712+
if (vp8Frame.getProjection() == null)
713+
{
712714
/* Shouldn't happen for an accepted packet whose frame is still known? */
713715
throw new RewriteException("Frame does not have projection?");
714716
}

jvb/src/main/java/org/jitsi/videobridge/octo/ConfOctoTransport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public void setRelays(Collection<String> newRelayIds)
229229
{
230230
bridgeOctoTransport.removeHandler(conferenceId, this);
231231
}
232-
else if(remoteBridges.isEmpty())
232+
else if (remoteBridges.isEmpty())
233233
{
234234
bridgeOctoTransport.addHandler(conferenceId, this);
235235
}

jvb/src/main/java/org/jitsi/videobridge/rest/JSONDeserializer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,8 @@ public static PayloadTypePacketExtension deserializePayloadType(
727727

728728
Object rtcpFbs = payloadType.get(JSONSerializer.RTCP_FBS);
729729

730-
if (rtcpFbs != null && rtcpFbs instanceof JSONArray) {
730+
if (rtcpFbs != null && rtcpFbs instanceof JSONArray)
731+
{
731732
deserializeRtcpFbs((JSONArray) rtcpFbs, payloadTypeIQ);
732733
}
733734

jvb/src/main/java/org/jitsi/videobridge/sctp/SctpManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,10 @@ public SctpClientSocket createClientSocket() {
129129
/**
130130
* Close the active {@link SctpSocket}, if there is one
131131
*/
132-
public void closeConnection() {
133-
if (socket != null) {
132+
public void closeConnection()
133+
{
134+
if (socket != null)
135+
{
134136
if (logger.isDebugEnabled())
135137
{
136138
logger.debug("Closing SCTP socket " + socket.hashCode());

jvb/src/main/java/org/jitsi/videobridge/shim/ChannelShim.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ public void describe(ColibriConferenceIQ.ChannelCommon commonIq)
245245
iq.addSource(bridgeSource);
246246
}
247247

248-
if (sources != null) {
248+
if (sources != null)
249+
{
249250
int[] ssrcs = sources.stream()
250251
.map(SourcePacketExtension::getSSRC)
251252
.filter(ssrc -> ssrc != -1L)
@@ -255,7 +256,8 @@ public void describe(ColibriConferenceIQ.ChannelCommon commonIq)
255256
iq.setSSRCs(ssrcs);
256257
}
257258

258-
if (sourceGroups != null) {
259+
if (sourceGroups != null)
260+
{
259261
sourceGroups.forEach(iq::addSourceGroup);
260262
}
261263
}

jvb/src/main/java/org/jitsi/videobridge/shim/ConferenceShim.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,12 @@ public IQ handleColibriConferenceIQ(ColibriConferenceIQ conferenceIQ)
447447
{
448448
// Item not found conditions are assumed to be less critical, as they often happen in case a request
449449
// arrives late for an expired endpoint.
450-
if (XMPPError.Condition.item_not_found.equals(e.getCondition())) {
450+
if (XMPPError.Condition.item_not_found.equals(e.getCondition()))
451+
{
451452
logger.warn("Error processing channels: " + e);
452-
} else {
453+
}
454+
else
455+
{
453456
logger.error("Error processing channels: " + e);
454457
}
455458
return IQUtils.createError(conferenceIQ, e.getCondition(), e.getMessage());

0 commit comments

Comments
 (0)