Skip to content

Export code style - #3325

Merged
AndyScherzinger merged 1 commit into
masterfrom
codeFormatting
Mar 22, 2019
Merged

Export code style#3325
AndyScherzinger merged 1 commit into
masterfrom
codeFormatting

Conversation

@tobiasKaminsky

Copy link
Copy Markdown
Member

With this AndroidStudio should use the same code formatting for everyone.
Ref: #3320 (comment)

@AndyScherzinger can you test if this does the following:

package com.owncloud.android;
import lombok.Getter;
import lombok.Setter;
public class CodeFormatting {
@Getter @Setter private String test; // this has to be done manually
private void loop() {
for(int i=0;i<10;i++)System.currentTimeMillis();
boolean b;
if(System.currentTimeMillis()>10)b=true;
while(System.currentTimeMillis()>10)System.currentTimeMillis();
}
}

should change after Alt+Shift+L (Reformat Code) to

package com.owncloud.android;
import lombok.Getter;
import lombok.Setter;
public class CodeFormatting {
@Getter @Setter private String test; // this has to be done manually, but it keeps the way
private void loop() {
for (int i = 0; i < 10; i++) {
System.currentTimeMillis();
}
boolean b;
if (System.currentTimeMillis() > 10) {
b = true;
}
while (System.currentTimeMillis() > 10) {
System.currentTimeMillis();
}
}
}
  • correct new lines
  • braces around one liner if/for/while

Signed-off-by: tobiasKaminsky tobias@kaminsky.me

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

Lint

TypemasterPR
Warnings8585
Errors

FindBugs (new)

Warning TypeNumber
Bad practice Warnings35
Correctness Warnings162
Internationalization Warnings15
Malicious code vulnerability Warnings10
Multithreaded correctness Warnings9
Performance Warnings120
Security Warnings204
Dodgy code Warnings135
Total690

FindBugs (master)

Warning TypeNumber
Bad practice Warnings35
Correctness Warnings162
Internationalization Warnings15
Malicious code vulnerability Warnings10
Multithreaded correctness Warnings9
Performance Warnings120
Security Warnings204
Dodgy code Warnings135
Total690

@tobiasKaminskytobiasKaminsky mentioned this pull request Dec 7, 2018
@AndyScherzinger

Copy link
Copy Markdown
Member

I gave it a try while during import AS is simply removing all the formatting config changes introduced in this PR.

@mario

Copy link
Copy Markdown
Contributor

Should you really be importing though @AndyScherzinger ? Or just opening?

@AndyScherzinger

Copy link
Copy Markdown
Member

Hmmm, well I just opened the project since due to the AS files AS is detecting it as a Android Project right away. So yes, I am just opening it.

@tobiasKaminsky

Copy link
Copy Markdown
MemberAuthor

This also does not work for me :/
There is a https://www.jetbrains.com/help/idea/settings-tools-settings-repository.html, but this also does not work for me, when I am trying it locally…

@codecov

codecovBot commented Jan 23, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3325 into master will not change coverage.
The diff coverage is n/a.

@@ Coverage Diff @@## master #3325 +/- ##
========================================
Coverage 6.16% 6.16% Complexity 1 1 ========================================
Files 317 317 Lines 30516 30516 Branches 4389 4389 ========================================
Hits 1882 1882 + Misses 28349 28348 -1 - Partials 285 286 +1
Impacted FilesCoverage ΔComplexity Δ
.../third_parties/daveKoeller/AlphanumComparator.java82.14% <0%> (ø)0% <0%> (ø)⬇️

@tobiasKaminsky

Copy link
Copy Markdown
MemberAuthor

So I gave it a new try

  • complete new clone from this repo
  • close all projects in AS
  • in this screen I used "open an existing Android Studio project"
    image
  • c&p code sample from first post
  • Code -> Reformat Code
  • seems to work

@AndyScherzinger

Copy link
Copy Markdown
Member

@tobiasKaminsky let's merge it then :)

@AndyScherzinger
AndyScherzinger merged commit 4ab17b5 into masterMar 22, 2019
@AndyScherzinger
AndyScherzinger deleted the codeFormatting branch March 22, 2019 07:38
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@tobiasKaminsky@nextcloud-android-bot@AndyScherzinger@mario