Skip to content

Commit

Permalink
Issue checkstyle#45: ImportOrder is resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
romani authored and tsjensen committed Mar 21, 2019
1 parent a3a282c commit 5fa5578
Show file tree
Hide file tree
Showing 21 changed files with 140 additions and 133 deletions.
4 changes: 0 additions & 4 deletions checkstyle-sonar-plugin/config/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<suppress checks="Javadoc*" files=".*[\\/]src[\\/]main[\\/]"/>
<suppress checks="Header" files=".*[\\/]src[\\/]main[\\/]"/>
<suppress checks="FinalLocalVariable" files=".*[\\/]src[\\/]main[\\/]"/>
<suppress checks="CustomImportOrder" files=".*[\\/]src[\\/]main[\\/]"/>
<suppress checks="ImportOrder" files=".*[\\/]src[\\/]main[\\/]"/>
<suppress checks="ImportControl" files=".*[\\/]src[\\/]main[\\/]"/>
<suppress checks="DesignForExtension" files=".*[\\/]src[\\/]main[\\/]"/>
<suppress checks="WriteTag" files=".*[\\/]src[\\/]main[\\/]"/>
Expand Down Expand Up @@ -42,9 +40,7 @@
<suppress checks="Header" files=".*[\/]src[\/]test[\/]"/>
<suppress checks="RegexpHeader" files=".*[\/]src[\/]test[\/]"/>
<suppress checks="AvoidStaticImport" files=".*[\/]src[\/]test[\/]"/>
<suppress checks="CustomImportOrder" files=".*[\/]src[\/]test[\/]"/>
<suppress checks="ImportControl" files=".*[\/]src[\/]test[\/]"/>
<suppress checks="ImportOrder" files=".*[\/]src[\/]test[\/]"/>
<suppress checks="Indentation" files=".*[\/]src[\/]test[\/]"/>
<suppress checks="JavadocMethod" files=".*[\/]src[\/]test[\/]"/>
<suppress checks="JavadocPackage" files=".*[\/]src[\/]test[\/]"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
*/
package org.sonar.plugins.checkstyle;

import com.google.common.annotations.VisibleForTesting;
import com.puppycrawl.tools.checkstyle.api.AuditEvent;
import com.puppycrawl.tools.checkstyle.api.AuditListener;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -34,6 +31,10 @@
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleFinder;

import com.google.common.annotations.VisibleForTesting;
import com.puppycrawl.tools.checkstyle.api.AuditEvent;
import com.puppycrawl.tools.checkstyle.api.AuditListener;

/**
* @since 2.3
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
*/
package org.sonar.plugins.checkstyle;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.puppycrawl.tools.checkstyle.ConfigurationLoader;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.PropertiesExpander;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import com.puppycrawl.tools.checkstyle.api.Configuration;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Properties;

import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -36,15 +39,13 @@
import org.sonar.api.config.Settings;
import org.sonar.api.profiles.RulesProfile;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Properties;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.puppycrawl.tools.checkstyle.ConfigurationLoader;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.PropertiesExpander;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import com.puppycrawl.tools.checkstyle.api.Configuration;

public class CheckstyleConfiguration implements BatchExtension {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,6 @@
*/
package org.sonar.plugins.checkstyle;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.io.Closeables;
import com.puppycrawl.tools.checkstyle.Checker;
import com.puppycrawl.tools.checkstyle.PackageNamesLoader;
import com.puppycrawl.tools.checkstyle.XMLLogger;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.BatchExtension;
import org.sonar.api.utils.TimeProfiler;
import org.sonar.plugins.java.api.JavaResourceLocator;

import java.io.File;
import java.io.OutputStream;
import java.net.MalformedURLException;
Expand All @@ -42,6 +29,20 @@
import java.util.List;
import java.util.Locale;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.BatchExtension;
import org.sonar.api.utils.TimeProfiler;
import org.sonar.plugins.java.api.JavaResourceLocator;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.io.Closeables;
import com.puppycrawl.tools.checkstyle.Checker;
import com.puppycrawl.tools.checkstyle.PackageNamesLoader;
import com.puppycrawl.tools.checkstyle.XMLLogger;

public class CheckstyleExecutor implements BatchExtension {
private static final Logger LOG = LoggerFactory.getLogger(CheckstyleExecutor.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
*/
package org.sonar.plugins.checkstyle;

import com.google.common.collect.ImmutableList;
import java.util.List;

import org.sonar.api.CoreProperties;
import org.sonar.api.PropertyType;
import org.sonar.api.SonarPlugin;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.resources.Qualifiers;

import java.util.List;
import com.google.common.collect.ImmutableList;

public final class CheckstylePlugin extends SonarPlugin {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
*/
package org.sonar.plugins.checkstyle;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.config.Settings;
Expand All @@ -30,11 +33,9 @@
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.RuleParam;

import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;

public class CheckstyleProfileExporter extends ProfileExporter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
*/
package org.sonar.plugins.checkstyle;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.io.Reader;
import java.util.List;
import java.util.Map;

import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;

import org.apache.commons.lang.StringUtils;
import org.codehaus.staxmate.SMInputFactory;
import org.codehaus.staxmate.in.SMInputCursor;
Expand All @@ -35,12 +39,9 @@
import org.sonar.api.rules.RuleQuery;
import org.sonar.api.utils.ValidationMessages;

import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;

import java.io.Reader;
import java.util.List;
import java.util.Map;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

public class CheckstyleProfileImporter extends ProfileImporter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
*/
package org.sonar.plugins.checkstyle;

import com.google.common.collect.Iterables;
import java.io.File;

import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.batch.fs.FilePredicates;
Expand All @@ -28,7 +29,7 @@
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.Project;

import java.io.File;
import com.google.common.collect.Iterables;

public class CheckstyleSensor implements Sensor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
*/
package org.sonar.plugins.checkstyle;

import org.apache.commons.io.IOUtils;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.commons.io.IOUtils;
import org.slf4j.LoggerFactory;

public enum CheckstyleVersion {
INSTANCE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@
*/
package org.sonar.plugins.checkstyle;

import com.puppycrawl.tools.checkstyle.api.AuditEvent;
import com.puppycrawl.tools.checkstyle.api.LocalizedMessage;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;

import java.io.File;

import org.junit.Before;
import org.junit.Test;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
Expand All @@ -33,13 +39,8 @@
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleFinder;

import java.io.File;

import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import com.puppycrawl.tools.checkstyle.api.AuditEvent;
import com.puppycrawl.tools.checkstyle.api.LocalizedMessage;

public class CheckstyleAuditListenerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
*/
package org.sonar.plugins.checkstyle;

import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import com.puppycrawl.tools.checkstyle.api.Configuration;
import static org.fest.assertions.Assertions.assertThat;

import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.StandardCharsets;

import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -32,12 +37,8 @@
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.rules.Rule;

import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.StandardCharsets;

import static org.fest.assertions.Assertions.assertThat;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import com.puppycrawl.tools.checkstyle.api.Configuration;

public class CheckstyleConfigurationTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
*/
package org.sonar.plugins.checkstyle;

import org.junit.Test;
import static org.fest.assertions.Assertions.assertThat;

import java.lang.reflect.Constructor;

import static org.fest.assertions.Assertions.assertThat;
import org.junit.Test;

public class CheckstyleConstantsTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,23 @@
*/
package org.sonar.plugins.checkstyle;

import com.google.common.collect.ImmutableList;
import com.puppycrawl.tools.checkstyle.api.AuditEvent;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import static org.fest.assertions.Assertions.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Locale;

import org.apache.commons.io.FileUtils;
import org.junit.Rule;
Expand All @@ -34,23 +48,9 @@
import org.sonar.java.JavaClasspath;
import org.sonar.plugins.java.api.JavaResourceLocator;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Locale;

import static org.fest.assertions.Assertions.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableList;
import com.puppycrawl.tools.checkstyle.api.AuditEvent;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;

public class CheckstyleExecutorTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
*/
package org.sonar.plugins.checkstyle;

import org.junit.Test;

import static org.fest.assertions.Assertions.assertThat;

import org.junit.Test;

public class CheckstylePluginTest {

@Test
Expand Down
Loading

0 comments on commit 5fa5578

Please sign in to comment.