Skip to content
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

PMD 6.0.0 #2771

Merged
merged 10 commits into from
Dec 31, 2017
Merged

PMD 6.0.0 #2771

merged 10 commits into from
Dec 31, 2017

Conversation

TWiStErRob
Copy link
Collaborator

I suggest a Squash Merge again. I suggest you take a look at the two revert commits and then the extra commits I added later. Please make sure you review thoroughly, hopefully rebase didn't mess anything up. Feel free to commit any amendments to the branch (you have write rights to all PR branches).

Description

Upgrade PMD from 5.8.1 to 6.0.0 based on https://github.com/sjudd/glide/tree/pmd_6_0_0 branch rebased onto #2762. Mostly PMD triggered fixes and refactors.

Motivation and Context

Better checks for finding hidden issues in the code.

sjudd and others added 10 commits December 30, 2017 11:49
Move @SuppressWarnings closer to the problem to avoid suppressing future similar issues.
Reduce amount of C-style (declare first and then use) variable definitions
Make some variables final in tricky methods (enabled by above).
Remove some unnecessary PMD suppressions
Move PMD.OneDeclarationPerLine suppression for for loops into pmd config
Small method extractions towards Clean Code
Minor formatting/interface-impl enhancements in touched classes
@@ -368,15 +368,15 @@ public synchronized void reset() throws IOException {
*/
@Override
public synchronized long skip(long byteCount) throws IOException {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swapped order to mimic java.io.InputStream#skip (i.e. don't throw when no bytes are skipped)

@@ -66,37 +68,43 @@ public int getOrientation(Uri uri) {
}

public InputStream open(Uri uri) throws FileNotFoundException {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extracted cursor handling to separate method and move up validation to look like guards

if (!TextUtils.isEmpty(values)) {
combinedHeaders.put(entry.getKey(), sb.toString());
combinedHeaders.put(entry.getKey(), values);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extracted method to simplify code, and remove duplicate sb.toString building.

@@ -274,19 +270,16 @@ private static int parseExifSegment(RandomAccessReader segmentData) {

int firstIfdOffset = segmentData.getInt32(headerOffsetSize + 4) + headerOffsetSize;
int tagCount = segmentData.getInt16(firstIfdOffset);

int tagOffset, tagType, formatCode, componentCount;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't just split them up, but moved them close to usage, thus can be final

@sjudd
Copy link
Collaborator

sjudd commented Dec 31, 2017

LGTM, thanks for cleaning this up!

@sjudd sjudd merged commit f16aef4 into bumptech:master Dec 31, 2017
@TWiStErRob TWiStErRob deleted the pmd_6_0_0 branch December 31, 2017 13:56
@T45K T45K mentioned this pull request Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants