-
Notifications
You must be signed in to change notification settings - Fork 0
feat(sdk): add linter and fix linter findings #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rubenhoenle
wants to merge
28
commits into
main
Choose a base branch
from
feat/linter-setupg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
be54320
feat(sdk): add linter and fix linter findings
rubenhoenle 7a3fb20
adapt pmd commentsize
Benjosh95 700e032
apply make fmt
Benjosh95 5dff990
shorten deprecated comments
Benjosh95 7670547
fix commentDefaultAccessModifier
Benjosh95 bcf629a
fix pmd ImmutableField
Benjosh95 2e0f841
fix pmd AvoidUncheckedExceptionsInSignatures
Benjosh95 dc61aa0
fix pmd AvoidThrowingRawExceptionTypes
Benjosh95 fba3469
fix pmd avoidsynchronized statement or method
Benjosh95 62c44e0
fix pmd law-of-demeter in ruleset
Benjosh95 d7aec54
fix pmd GuardLogStatement
Benjosh95 c6b1de5
fix pmd commentsize
Benjosh95 92c9c3f
fix pmd SystemPrintln
Benjosh95 4c988e1
fix pmd commentsize
Benjosh95 26134b3
fix pmd commentsize
Benjosh95 c1f8862
fix pmd systemprintln, guardlogstatement
Benjosh95 071954b
fix pmd AvoidThrowingRawExceptionTypes
Benjosh95 03f6849
fix pmd NPathComplexity
Benjosh95 0eaef38
rework fix pmd systemprintln, guardlogstatement
Benjosh95 53176a3
fix pmd AvoidThrowingRawExceptionTypes
Benjosh95 10a0662
fix pmd UseUtilityClass
Benjosh95 a9cc5bc
fix pmd useutilityclass, refactor example class modifiers
Benjosh95 8330da9
fix pms useutilityclass classlevel
Benjosh95 75ccc27
apply make fmt
Benjosh95 f4e40c8
update ci pipeline to include new linter
Benjosh95 245233d
remove comments
Benjosh95 ddb2f62
remove pmd utilityclass, add priv. constructors
Benjosh95 05d29e0
remove some pmd NPathComplexity
Benjosh95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="Custom Ruleset" | ||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> | ||
|
||
<description> | ||
Custom ruleset that excludes generated code from PMD analysis. | ||
</description> | ||
|
||
<exclude-pattern>.*/cloud/stackit/sdk/.*/model/.*</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/api/.*</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/ApiCallback.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/ApiClient.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/ApiResponse.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/GzipRequestInterceptor.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/JSON.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/Pair.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/ProgressRequestBody.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/ProgressResponseBody.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/ServerConfiguration.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/ServerVariable.java</exclude-pattern> | ||
<exclude-pattern>.*/cloud/stackit/sdk/.*/StringUtil.java</exclude-pattern> | ||
|
||
<rule ref="category/java/bestpractices.xml"> | ||
<exclude name="UnitTestContainsTooManyAsserts"/> | ||
<exclude name="UnitTestAssertionsShouldIncludeMessage"/> | ||
</rule> | ||
|
||
<rule ref="category/java/codestyle.xml"> | ||
<exclude name="LocalVariableCouldBeFinal"/> | ||
<exclude name="MethodArgumentCouldBeFinal"/> | ||
<exclude name="AtLeastOneConstructor"/> | ||
<exclude name="LongVariable"/> | ||
<exclude name="OnlyOneReturn"/> | ||
</rule> | ||
|
||
<!-- Excluded this rule to allow simple behaviour like parameter.method() | ||
or chained getter calls (transversing dtos) --> | ||
<rule ref="category/java/design.xml"> | ||
<exclude name="LawOfDemeter"/> | ||
</rule> | ||
|
||
<rule ref="category/java/documentation.xml"> | ||
<exclude name="CommentRequired"/> | ||
</rule> | ||
|
||
<rule ref="category/java/documentation.xml/CommentSize"> | ||
<properties> | ||
<property name="maxLineLength" value="100"/> | ||
<property name="maxLines" value="40"/> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="category/java/errorprone.xml"> | ||
<exclude name="AvoidFieldNameMatchingMethodName"/> | ||
</rule> | ||
|
||
<rule ref="category/java/multithreading.xml"> | ||
</rule> | ||
|
||
<rule ref="category/java/performance.xml"> | ||
</rule> | ||
|
||
<rule ref="category/java/security.xml"> | ||
</rule> | ||
|
||
</ruleset> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ public Response intercept(Chain chain) throws IOException { | |
} catch (InvalidKeySpecException | ApiException e) { | ||
// try-catch required, because ApiException can not be thrown in the implementation | ||
// of Interceptor.intercept(Chain chain) | ||
throw new RuntimeException(e); | ||
throw new IllegalStateException(e); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. e.g. here |
||
} | ||
|
||
Request authenticatedRequest = | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if a
IllegalStateException
is correct here.From https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html: "Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation."
I think I also saw this in multiple places, so please also check if the
IllegalStateException
is appropriate there.