Skip to content

Commit

Permalink
Merge pull request #97 from smartsheet/rreynolds/pr96-code-formatting
Browse files Browse the repository at this point in the history
IntelliJ code-formatter applied to all source files; checkstyle config updates to match
  • Loading branch information
ronreynolds committed Sep 11, 2024
2 parents 67dfe3a + 4f0952d commit ad0a68e
Show file tree
Hide file tree
Showing 497 changed files with 5,058 additions and 4,365 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ext {
mockitoCoreVersion = '5.12.0'
mockitoJUnitJupiterVersion = '5.12.0'
okHttpVersion = '4.0.0'
resilience4jVersion = "1.7.1" // last version compatible with pre-17 JDKs
slf4jSimpleVersion = '1.7.25'
slf4jVersion = '1.7.25'
}
Expand Down Expand Up @@ -83,6 +84,7 @@ dependencies {
testImplementation "org.mockito:mockito-core:${mockitoCoreVersion}"
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoJUnitJupiterVersion}"
testImplementation "org.slf4j:slf4j-simple:${slf4jSimpleVersion}"
testImplementation "io.github.resilience4j:resilience4j-retry:${resilience4jVersion}"
}

// Configuration for our Javadocs
Expand Down Expand Up @@ -253,7 +255,6 @@ signing {
// Checkstyle Configuration
checkstyle {
toolVersion = "${checkstyleVersion}"
configFile = file('config/checkstyle/checkstyle-custom.xml')
}

// Override configuration for Checkstyle that runs on our 'src/main' package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
</module>
<!-- End Whitespace -->

<module name="SuppressWarningsFilter" />
<module name="SuppressWarningsFilter"/>

<module name="SuppressionFilter">
<property name="file" value="${config_loc}/checkstyle-suppressions.xml" />
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>

<!-- File Header -->
Expand All @@ -78,7 +78,6 @@
</module>

<module name="TreeWalker">

<property name="tabWidth" value="4"/>

<!-- To suppress a checkstyle rule put //CHECKSTYLE:OFF: RuleName -->
Expand All @@ -104,12 +103,13 @@
<module name="MissingOverride"/>
<!-- Only allow these types of warnings to be suppressed -->
<module name="SuppressWarnings">
<property name="format" value="^((?!(unused|ClassTypeParameterName|WeakerAccess|unchecked|rawtypes|resource|Duplicates|ParameterNumber|MethodCount)).)*$"/>
<property name="format"
value="^((?!(unused|ClassTypeParameterName|WeakerAccess|unchecked|rawtypes|resource|Duplicates|ParameterNumber|MethodCount)).)*$"/>
<message key="suppressed.warning.not.allowed"
value="The warning ''{0}'' cannot be suppressed at this location. Only a few javac warnings are allowed to suppressed."
/>
</module>
<module name="SuppressWarningsHolder" />
<module name="SuppressWarningsHolder"/>
<!-- End Annotations -->

<!-- Block Checks -->
Expand Down Expand Up @@ -223,9 +223,9 @@
<property name="skipEnhancedForLoopVariable" value="true"/>
</module>
<!-- Make sure there is only one occurrence of each string per file -->
<!-- This check was disabled as it flagged strings in the constructors of Enums.
Using constants for these literals seemed unnecessary -->
<module name="MultipleStringLiterals" >
<!-- This check was disabled as it flagged strings in the constructors of Enums.
Using constants for these literals seemed unnecessary -->
<module name="MultipleStringLiterals">
<property name="ignoreStringsRegexp" value='^("")|(",\s*)|(".")'/>
<property name="allowedDuplicates" value="2"/>
</module>
Expand Down Expand Up @@ -287,7 +287,9 @@
<property name="minLineCount" value="1"/>
</module>
<!-- Force 4 spaces on indent of javadoc -->
<!-- conflicts with IntelliJ default java formatter
<module name="JavadocTagContinuationIndentation"/>
-->
<!-- Javadoc types like classes -->
<module name="JavadocType">
<!-- avoid errors on tag '@noinspection' -->
Expand Down
2 changes: 1 addition & 1 deletion config/checkstyle/java.header
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Smartsheet
* Copyright (C) 2024 Smartsheet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
<!-- Allow strings to occur multiple times without making them a variable in tests -->
<suppress checks="MultipleStringLiterals" files="[\\/]src[\\/]test[\\/].*"/>
<!-- Allow underscores in test method names -->
<suppress files="[\\/]src[\\/]test[\\/].*" checks="MethodName" />
<suppress files="[\\/]src[\\/]test[\\/].*" checks="MethodName"/>
<!-- Don't require Javadocs for tests -->
<suppress files="[\\/]src[\\/]test[\\/].*" checks="MissingJavadocMethod" />
<suppress files="[\\/]src[\\/]test[\\/].*" checks="MissingJavadocMethod"/>
<!-- Don't check file lengths for tests -->
<suppress files="[\\/]src[\\/]test[\\/].*" checks="FileLength" />
<suppress files="[\\/]src[\\/]test[\\/].*" checks="FileLength"/>
<!-- Don't check method lengths for tests -->
<suppress files="[\\/]src[\\/]test[\\/].*" checks="MethodLength" />
<suppress files="[\\/]src[\\/]test[\\/].*" checks="MethodLength"/>

<!-- These classes use TRow TColumn and TCell which are confusing to replace with single letter types -->
<!-- These classes use TRow TColumn and TCell which are confusing to replace with single letter types -->
<suppress checks="ClassTypeParameterName" files="src/main/java/com/smartsheet/api/models/AbstractSheet.java"/>
<suppress checks="ClassTypeParameterName" files="src/main/java/com/smartsheet/api/models/AbstractRow.java"/>

<!-- These classes are enums with multiple enums using the same string in value -->
<!-- These classes are enums with multiple enums using the same string in value -->
<suppress checks="MultipleStringLiterals" files="src/main/java/com/smartsheet/api/models/format/Currency.java"/>
<suppress checks="MultipleStringLiterals" files="src/main/java/com/smartsheet/api/models/format/FontFamily.java"/>
</suppressions>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Smartsheet
* Copyright (C) 2024 Smartsheet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Smartsheet
* Copyright (C) 2024 Smartsheet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,8 +36,8 @@ public interface AssociatedAttachmentResources {
List<Attachment> listAttachments(long objectId);

/**
* @param objectId the id of the object
* @param file the file to attach
* @param objectId the id of the object
* @param file the file to attach
* @param contentType the content type of the file
* @return the created attachment
* @deprecated As of release 2.0. Please use the corresponding method in the [Row/Sheet/etc]AttachmentResources classes
Expand All @@ -46,10 +46,10 @@ public interface AssociatedAttachmentResources {
Attachment attachFile(long objectId, File file, String contentType);

/**
* @param objectId the id of the object
* @param inputStream the file to attach
* @param contentType the content type of the file
* @param contentLength the size of the file in bytes.
* @param objectId the id of the object
* @param inputStream the file to attach
* @param contentType the content type of the file
* @param contentLength the size of the file in bytes.
* @param attachmentName the name of the file.
* @return the created attachment
* @deprecated As of release 2.0. Please use the corresponding method in the [Row/Sheet/etc]AttachmentResources classes
Expand All @@ -58,7 +58,7 @@ public interface AssociatedAttachmentResources {
Attachment attachFile(long objectId, InputStream inputStream, String contentType, long contentLength, String attachmentName);

/**
* @param objectId the object id
* @param objectId the object id
* @param attachment the attachment object
* @return the created attachment
* @deprecated As of release 2.0. Please use the corresponding method in the [Row/Sheet/etc]AttachmentResources classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Smartsheet
* Copyright (C) 2024 Smartsheet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@
@Deprecated(since = "2.0.0", forRemoval = true)
public interface AssociatedDiscussionResources {
/**
* @param objectId the object id (sheet id or row id)
* @param objectId the object id (sheet id or row id)
* @param discussion the discussion object
* @return the created discussion
* @throws SmartsheetException if there is any other error during the operation
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/com/smartsheet/api/AttachmentResources.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Smartsheet
* Copyright (C) 2024 Smartsheet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,28 +25,29 @@
* <p>This interface provides methods to access Attachment resources by their id.</p>
*
* <p>Thread Safety: Implementation of this interface must be thread safe.</p>
*
* @deprecated As of release 2.0. Please use {@link AttachmentVersioningResources} instead
*/
@Deprecated(since = "2.0.0", forRemoval = true)
public interface AttachmentResources {

/**
* @param attachmentId the id
* @param file the file
* @param contentType the content type
* @param file the file
* @param contentType the content type
* @return the attachment (note that if there is no such resource, this method will throw ResourceNotFoundException
* rather than returning null).
* rather than returning null).
* @deprecated As of release 2.0. Please use {@link AttachmentVersioningResources} instead
*/
@Deprecated(since = "2.0.0", forRemoval = true)
Attachment attachNewVersion(long attachmentId, File file, String contentType);

/**
* @param attachmentId the id of the attachment to upload a new version.
* @param inputStream the file to attach
* @param contentType the content type of the file
* @param attachmentId the id of the attachment to upload a new version.
* @param inputStream the file to attach
* @param contentType the content type of the file
* @param attachmentName attachment name
* @param contentLength content length
* @param contentLength content length
* @return the created attachment
* @deprecated As of release 2.0. Please use {@link AttachmentVersioningResources} instead
*/
Expand Down
48 changes: 24 additions & 24 deletions src/main/java/com/smartsheet/api/AttachmentVersioningResources.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Smartsheet
* Copyright (C) 2024 Smartsheet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,14 +35,14 @@ public interface AttachmentVersioningResources {
*
* <p>It mirrors to the following Smartsheet REST API method: DELETE /sheets/{sheetId}/attachments/{attachmentId}/versions</p>
*
* @param sheetId the sheet id
* @param sheetId the sheet id
* @param attachentId the attachment id
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
* @throws SmartsheetException if there is any other error during the operation
*/
void deleteAllVersions(long sheetId, long attachentId) throws SmartsheetException;

Expand All @@ -51,17 +51,17 @@ public interface AttachmentVersioningResources {
*
* <p>It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/attachments/{attachmentId}/versions</p>
*
* @param sheetId the id
* @param sheetId the id
* @param attachmentId the attachment id
* @param parameters the pagination paramaters
* @param parameters the pagination paramaters
* @return the attachment (note that if there is no such resource, this method will throw ResourceNotFoundException
* rather than returning null).
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* rather than returning null).
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
* @throws SmartsheetException if there is any other error during the operation
*/
PagedResult<Attachment> listAllVersions(long sheetId, long attachmentId, PaginationParameters parameters) throws SmartsheetException;

Expand All @@ -70,18 +70,18 @@ public interface AttachmentVersioningResources {
*
* <p>It mirrors to the following Smartsheet REST API method: POST /attachment/{id}/versions</p>
*
* @param sheetId the id of the sheet
* @param sheetId the id of the sheet
* @param attachmentId the id of the attachment to upload a new version.
* @param file the file to attach
* @param contentType the content type of the file
* @param file the file to attach
* @param contentType the content type of the file
* @return the created attachment
* @throws FileNotFoundException the file not found exception
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws FileNotFoundException the file not found exception
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
* @throws SmartsheetException if there is any other error during the operation
*/
Attachment attachNewVersion(
long sheetId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Smartsheet
* Copyright (C) 2024 Smartsheet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/smartsheet/api/ColumnResources.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Smartsheet
* Copyright (C) 2024 Smartsheet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,6 +22,7 @@
* <p>This interface provides methods to access Column resources.</p>
*
* <p>Thread Safety: Implementation of this interface must be thread safe.</p>
*
* @deprecated As of release 2.0. Please use {@link SheetCommentResources} instead
*/
@Deprecated(since = "2.0.0", forRemoval = true)
Expand All @@ -30,14 +31,14 @@ public interface ColumnResources {
/**
* @param column the column to update
* @return the updated Column (note that if there is no such resource, this method will throw
* ResourceNotFoundException rather than returning null).
* ResourceNotFoundException rather than returning null).
* @deprecated As of release 2.0. Please use {@link SheetCommentResources} instead
*/
@Deprecated(since = "2.0.0", forRemoval = true)
Column updateColumn(Column column);

/**
* @param id id of the column
* @param id id of the column
* @param sheetId the sheet id
* @deprecated As of release 2.0. Please use {@link SheetCommentResources} instead
*/
Expand Down
Loading

0 comments on commit ad0a68e

Please sign in to comment.