1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-24 23:32:05 +01:00

Remove all tabs and add checkstyle rule that enforces no-tabs

Fixes SMACK-866.
This commit is contained in:
Florian Schmaus 2019-05-07 21:24:00 +02:00
parent 575364cc1f
commit 68d7d738b6
10 changed files with 104 additions and 158 deletions

View file

@ -40,10 +40,8 @@
<property name="message" value="Line containing only whitespace character(s)"/>
</module>
<module name="RegexpSingleline">
<!-- We use {2,} instead of + here to address the typical case where a file was written
with tabs but javadoc is causing '\t *' -->
<property name="format" value="^\t+ {2,}"/>
<property name="message" value="Line containing space(s) after tab(s)"/>
<property name="format" value="\t+"/>
<property name="message" value="Line containing tab character(s)"/>
</module>
<module name="RegexpSingleline">
<!--

View file

@ -440,9 +440,7 @@ public class PacketParserUtils {
String language = ParserUtils.getXmlLang(parser);
if (language != null && !"".equals(language.trim())) {
// CHECKSTYLE:OFF
presence.setLanguage(language);
// CHECKSTYLE:ON
}
// Parse sub-elements

View file

@ -781,30 +781,25 @@ public class PacketParserUtilsTest {
@Test
public void validateSimplePresence() throws Exception {
// CHECKSTYLE:OFF
String stanza = "<presence from='juliet@example.com/balcony' to='romeo@example.net'/>";
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// CHECKSTYLE:ON
}
@Test
public void validatePresenceProbe() throws Exception {
// CHECKSTYLE:OFF
String stanza = "<presence from='mercutio@example.com' id='xv291f38' to='juliet@example.com' type='unsubscribed'/>";
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
assertEquals(Presence.Type.unsubscribed, presence.getType());
// CHECKSTYLE:ON
}
@Test
public void validatePresenceOptionalElements() throws Exception {
// CHECKSTYLE:OFF
String stanza = "<presence xml:lang='en' type='unsubscribed'>"
+ "<show>dnd</show>"
+ "<status>Wooing Juliet</status>"
@ -818,7 +813,6 @@ public class PacketParserUtilsTest {
assertEquals("en", presence.getLanguage());
assertEquals("Wooing Juliet", presence.getStatus());
assertEquals(1, presence.getPriority());
// CHECKSTYLE:ON
}
// @Test

View file

@ -257,11 +257,9 @@ public class EnhancedDebugger extends SmackDebugger {
new DefaultTableModel(
new Object[] {"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"},
0) {
// CHECKSTYLE:OFF
private static final long serialVersionUID = 8136121224474217264L;
@Override
public boolean isCellEditable(int rowIndex, int mColIndex) {
// CHECKSTYLE:ON
return false;
}
@ -689,11 +687,9 @@ public class EnhancedDebugger extends SmackDebugger {
new DefaultTableModel(new Object[][] { {"IQ", 0, 0}, {"Message", 0, 0},
{"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}},
new Object[] {"Type", "Received", "Sent"}) {
// CHECKSTYLE:OFF
private static final long serialVersionUID = -6793886085109589269L;
@Override
public boolean isCellEditable(int rowIndex, int mColIndex) {
// CHECKSTYLE:ON
return false;
}
};

View file

@ -131,10 +131,8 @@ public class PrivacyItem {
* @return the allow communication status.
*/
public boolean isAllow() {
// CHECKSTYLE:OFF
return allow;
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allow or deny incoming IQ stanzas or not.
@ -142,10 +140,8 @@ public class PrivacyItem {
* @return the iq filtering status.
*/
public boolean isFilterIQ() {
// CHECKSTYLE:OFF
return filterIQ;
}
// CHECKSTYLE:ON
/**
* Sets whether the receiver allows or denies incoming IQ stanzas or not.
@ -153,11 +149,8 @@ public class PrivacyItem {
* @param filterIQ indicates if the receiver allows or denies incoming IQ stanzas.
*/
public void setFilterIQ(boolean filterIQ) {
// CHECKSTYLE:OFF
this.filterIQ = filterIQ;
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allows or denies incoming messages or not.
@ -165,10 +158,8 @@ public class PrivacyItem {
* @return the message filtering status.
*/
public boolean isFilterMessage() {
// CHECKSTYLE:OFF
return filterMessage;
}
// CHECKSTYLE:ON
/**
* Sets wheather the receiver allows or denies incoming messages or not.
@ -176,10 +167,8 @@ public class PrivacyItem {
* @param filterMessage indicates if the receiver allows or denies incoming messages or not.
*/
public void setFilterMessage(boolean filterMessage) {
// CHECKSTYLE:OFF
this.filterMessage = filterMessage;
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allows or denies incoming presence or not.
@ -187,10 +176,8 @@ public class PrivacyItem {
* @return the iq filtering incoming presence status.
*/
public boolean isFilterPresenceIn() {
// CHECKSTYLE:OFF
return filterPresenceIn;
}
// CHECKSTYLE:ON
/**
* Sets whether the receiver allows or denies incoming presence or not.
@ -198,10 +185,8 @@ public class PrivacyItem {
* @param filterPresenceIn indicates if the receiver allows or denies filtering incoming presence.
*/
public void setFilterPresenceIn(boolean filterPresenceIn) {
// CHECKSTYLE:OFF
this.filterPresenceIn = filterPresenceIn;
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allows or denies incoming presence or not.
@ -209,10 +194,8 @@ public class PrivacyItem {
* @return the iq filtering incoming presence status.
*/
public boolean isFilterPresenceOut() {
// CHECKSTYLE:OFF
return filterPresenceOut;
}
// CHECKSTYLE:ON
/**
* Sets whether the receiver allows or denies outgoing presence or not.
@ -220,10 +203,8 @@ public class PrivacyItem {
* @param filterPresenceOut indicates if the receiver allows or denies filtering outgoing presence
*/
public void setFilterPresenceOut(boolean filterPresenceOut) {
// CHECKSTYLE:OFF
this.filterPresenceOut = filterPresenceOut;
}
// CHECKSTYLE:ON
/**
* Returns the order where the receiver is processed. List items are processed in
@ -235,10 +216,8 @@ public class PrivacyItem {
* @return the order number.
*/
public long getOrder() {
// CHECKSTYLE:OFF
return order;
}
// CHECKSTYLE:ON
/**
* Returns the type hold the kind of communication it will allow or block.
@ -248,9 +227,7 @@ public class PrivacyItem {
*/
public Type getType() {
return type;
// CHECKSTYLE:OFF
}
// CHECKSTYLE:ON
/**
* Returns the element identifier to apply the action.
@ -265,9 +242,7 @@ public class PrivacyItem {
*/
public String getValue() {
return value;
// CHECKSTYLE:OFF
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allows or denies every kind of communication.
@ -278,7 +253,6 @@ public class PrivacyItem {
* @return the all communications status.
*/
public boolean isFilterEverything() {
// CHECKSTYLE:OFF
return !(this.isFilterIQ() || this.isFilterMessage() || this.isFilterPresenceIn()
|| this.isFilterPresenceOut());
}
@ -321,7 +295,6 @@ public class PrivacyItem {
}
buf.append("</item>");
}
// CHECKSTYLE:ON
return buf.toString();
}

View file

@ -155,9 +155,7 @@ public final class ChatManager extends Manager{
Message message = (Message) packet;
Chat chat;
if (message.getThread() == null) {
// CHECKSTYLE:OFF
chat = getUserChat(message.getFrom());
// CHECKSTYLE:ON
}
else {
chat = getThreadChat(message.getThread());

View file

@ -113,13 +113,11 @@ public class MacroGroup {
}
public String toXML() {
// CHECKSTYLE:OFF
StringBuilder buf = new StringBuilder();
buf.append("<macrogroup>");
buf.append("<title>" + getTitle() + "</title>");
buf.append("<macros>");
for (Macro macro : getMacros())
{
for (Macro macro : getMacros()) {
buf.append("<macro>");
buf.append("<title>" + macro.getTitle() + "</title>");
buf.append("<type>" + macro.getType() + "</type>");
@ -138,6 +136,5 @@ public class MacroGroup {
}
buf.append("</macrogroup>");
return buf.toString();
// CHECKSTYLE:ON
}
}

View file

@ -83,11 +83,9 @@ public class Macros extends IQ {
buf.append("<personal>true</personal>");
}
if (getPersonalMacroGroup() != null) {
// CHECKSTYLE:OFF
buf.append("<personalMacro>");
buf.append(StringUtils.escapeForXmlText(getPersonalMacroGroup().toXML()));
buf.append("</personalMacro>");
// CHECKSTYLE:ON
}
return buf;

View file

@ -478,17 +478,13 @@ public class Workgroup {
private void fireInvitationEvent(WorkgroupInvitation invitation) {
for (WorkgroupInvitationListener listener : invitationListeners) {
// CHECKSTYLE:OFF
listener.invitationReceived(invitation);
// CHECKSTYLE:ON
}
}
private void fireQueueJoinedEvent() {
for (QueueListener listener : queueListeners) {
// CHECKSTYLE:OFF
listener.joinedQueue();
// CHECKSTYLE:ON
}
}

View file

@ -50,7 +50,6 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
@Override
public RosterExchange parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
// CHECKSTYLE:OFF
RosterExchange rosterExchange = new RosterExchange();
boolean done = false;
RemoteRosterEntry remoteRosterEntry;
@ -81,7 +80,6 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
}
}
}
// CHECKSTYLE:ON
return rosterExchange;
}