Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion config/checkstyle-checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,14 @@
<module name="EmptyCatchBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<!-- modified -->

<!-- Class Design -->
<module name="DesignForExtension">
<property name="ignoredAnnotations"
value="Override, Test, Before, After, BeforeClass, AfterClass"/>
<property name="ignoredAnnotations"
value="BeforeAll, AfterAll, BeforeEach, AfterEach"/>
</module>
<module name="HideUtilityClassConstructor"/>
<module name="InnerTypeLast"/>
<module name="InterfaceIsType"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ public CheckstyleConfigurationFile getCheckstyleConfiguration(
return data;
}

/**
* Retrieves the bytes of an additional properties bundle associated with the Checkstyle
* configuration.
* <p>
* This method attempts to find a <code>.properties</code> file with the same base name as the
* provided configuration URL.
* </p>
*
* @param checkConfigURL
* the URL of the Checkstyle configuration file
* @return an optional containing the bytes of the properties bundle, or empty if it cannot be
* loaded
*/
protected Optional<byte[]> getAdditionPropertiesBundleBytes(URL checkConfigURL) {

String location = checkConfigURL.toString();
Expand Down Expand Up @@ -189,8 +202,10 @@ protected Optional<byte[]> getAdditionPropertiesBundleBytes(URL checkConfigURL)
* Gets the property resolver for this configuration type used to expand property values within
* the checkstyle configuration.
*
* @param checkConfiguration
* @param config
* the actual check configuration
* @param configFile
* the checkstyle configuration file
* @return the property resolver
* @throws IOException
* error creating the property resolver
Expand Down Expand Up @@ -223,6 +238,15 @@ protected PropertyResolver getPropertyResolver(ICheckConfiguration config,
return multiResolver;
}

/**
* Reads and returns all bytes from the provided <code>URLConnection</code>.
*
* @param connection
* the connection to read from
* @return the byte array containing the data from the connection
* @throws IOException
* if an I/O error occurs while reading from the connection
*/
protected byte[] getBytesFromURLConnection(URLConnection connection) throws IOException {
try (InputStream in = connection.getInputStream()) {
return ByteStreams.toByteArray(in);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
*
*/
public class CheckstyleFileWriter {
public final class CheckstyleFileWriter {

/** An object containing all settings for the checkstyle-file. */
private final CheckstyleSetting mCheckstyleSetting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;

public class MethodLimitCheck extends AbstractCheck {
public final class MethodLimitCheck extends AbstractCheck {

private int max = 30;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* Event handler being called when the eclipse application has started.
*/
@Component(property = EventConstants.EVENT_TOPIC + "=" + UIEvents.UILifeCycle.APP_STARTUP_COMPLETE)
public class ApplicationStartedHandler implements EventHandler {
public final class ApplicationStartedHandler implements EventHandler {

private final CheckFileOnOpenPartListener mPartListener = new CheckFileOnOpenPartListener();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
* This class provides the editor GUI for a check configuration working set.
*
*/
public class CheckConfigurationWorkingSetEditor {
public final class CheckConfigurationWorkingSetEditor {

//
// attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ public void setEnabled(boolean enabled) {
mValueWidget.setEnabled(enabled);
}

/**
* Figure out an initial value for the property. This will be,
* in order of precedence:
* 1) the existing value
* 2) a default value overriding the checkstyle default
* 3) the checkstyle default value, if specified
* 4) blank
*/
protected String getInitValue() {
//
// Figure out an initial value for the property. This will be,
// in order of precedence:
//
// 1) the existing value
// 2) a default value overriding the checkstyle default
// 3) the checkstyle default value, if specified
// 4) blank
//
String initValue = null;
if (mProp != null) {
initValue = mProp.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

public abstract class AbstractQuickfixTestCase {

protected void testQuickfix(final String testDataXml, final AbstractASTResolution quickfix)
protected final void testQuickfix(final String testDataXml, final AbstractASTResolution quickfix)
throws Exception {
try (InputStream stream = getClass().getResourceAsStream(testDataXml)) {
assertThat(stream).withFailMessage(() -> "Cannot find resource " + testDataXml + " in package "
Expand All @@ -56,7 +56,7 @@ protected void testQuickfix(final String testDataXml, final AbstractASTResolutio
}
}

protected void testQuickfix(InputStream testdataStream, AbstractASTResolution quickfix)
private void testQuickfix(InputStream testdataStream, AbstractASTResolution quickfix)
throws Exception {
QuickfixTestData[] testdata = getTestData(testdataStream);

Expand Down
Loading