codacy: Use one line for each declaration, it enhances code readability.

This commit is contained in:
AndyScherzinger 2017-05-04 12:30:03 +02:00
parent 0592eac9bf
commit e85f1592e2
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
8 changed files with 28 additions and 11 deletions

View file

@ -96,7 +96,8 @@ public class AccountUtils {
int lastAtPos = account.name.lastIndexOf("@");
String hostAndPort = account.name.substring(lastAtPos + 1);
String username = account.name.substring(0, lastAtPos);
String otherHostAndPort, otherUsername;
String otherHostAndPort;
String otherUsername;
Locale currentLocale = context.getResources().getConfiguration().locale;
for (Account otherAccount : ocAccounts) {
lastAtPos = otherAccount.name.lastIndexOf("@");

View file

@ -302,7 +302,8 @@ public class FileUploader extends Service
UploadsStorageManager uploadsStorageManager = new UploadsStorageManager(context.getContentResolver(), context);
OCUpload[] failedUploads = uploadsStorageManager.getFailedUploads();
Account currentAccount = null;
boolean resultMatch, accountMatch;
boolean resultMatch;
boolean accountMatch;
for ( OCUpload failedUpload: failedUploads) {
accountMatch = (account == null || account.name.equals(failedUpload.getAccountName()));
resultMatch = (uploadResult == null || uploadResult.equals(failedUpload.getLastResult()));
@ -434,7 +435,9 @@ public class FileUploader extends Service
return Service.START_NOT_STICKY;
}
String[] localPaths = null, remotePaths = null, mimeTypes = null;
String[] localPaths = null;
String[] remotePaths = null;
String[] mimeTypes = null;
OCFile[] files = null;
if (intent.hasExtra(KEY_FILE)) {

View file

@ -41,13 +41,13 @@ import java.util.concurrent.ConcurrentMap;
*/
public class IndexedForest<V> {
private ConcurrentMap<String, Node<V>> mMap = new ConcurrentHashMap<String, Node<V>>();
private ConcurrentMap<String, Node<V>> mMap = new ConcurrentHashMap<>();
@SuppressWarnings("PMD.ShortClassName")
private class Node<V> {
String mKey = null;
Node<V> mParent = null;
Set<Node<V>> mChildren = new HashSet<Node<V>>(); // TODO be careful with hash()
Set<Node<V>> mChildren = new HashSet<>(); // TODO be careful with hash()
V mPayload = null;
// payload is optional
@ -112,7 +112,9 @@ public class IndexedForest<V> {
} else {
// value really added
String currentPath = remotePath, parentPath = null, parentKey = null;
String currentPath = remotePath;
String parentPath = null;
String parentKey = null;
Node<V> currentNode = valuedNode, parentNode = null;
boolean linked = false;
while (!OCFile.ROOT_PATH.equals(currentPath) && !linked) {

View file

@ -375,7 +375,9 @@ public class RefreshFolderOperation extends RemoteOperation {
}
// loop to update every child
OCFile remoteFile = null, localFile = null, updatedFile = null;
OCFile remoteFile = null;
OCFile localFile = null;
OCFile updatedFile = null;
RemoteFile r;
for (int i=1; i<folderAndFiles.size(); i++) {
/// new OCFile instance with the data from the server

View file

@ -288,7 +288,9 @@ public class SynchronizeFolderOperation extends SyncOperation {
}
// loop to synchronize every child
OCFile remoteFile = null, localFile = null, updatedFile = null;
OCFile remoteFile = null;
OCFile localFile = null;
OCFile updatedFile = null;
RemoteFile r;
for (int i=1; i<folderAndFiles.size(); i++) {
/// new OCFile instance with the data from the server

View file

@ -294,7 +294,9 @@ public class UploadFileOperation extends SyncOperation {
mCancellationRequested.set(false);
mUploadStarted.set(true);
RemoteOperationResult result = null;
File temporalFile = null, originalFile = new File(mOriginalStoragePath), expectedFile = null;
File temporalFile = null;
File originalFile = new File(mOriginalStoragePath);
File expectedFile = null;
try {

View file

@ -1131,7 +1131,11 @@ public class FileContentProvider extends ContentProvider {
// AccountManager are not synchronous
Account[] accounts = AccountManager.get(getContext()).getAccountsByType(
MainApp.getAccountType());
String serverUrl, username, oldAccountName, newAccountName;
String serverUrl;
String username;
String oldAccountName;
String newAccountName;
for (Account account : accounts) {
// build both old and new account name
serverUrl = ama.getUserData(account, AccountUtils.Constants.KEY_OC_BASE_URL);

View file

@ -1020,7 +1020,8 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
private void updateFooter() {
if (!mJustFolders) {
int filesCount = 0, foldersCount = 0;
int filesCount = 0;
int foldersCount = 0;
int count = mAdapter.getCount();
OCFile file;
for (int i = 0; i < count; i++) {