Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Android Project Code Style #2443

Closed
Closed

Description

@tobrun

Currently the Android repo supports multiple formatting styles. Only be looking at the MapView class I can identify 3-4 different ones. If I format code on master using the Intelij hotkey it generates 70 changes. My personal belief is that this shouldn't generate a change at all and that we should aim for a consistent style throughout the repo.

We can customise AndroidStudio be introducing custom styles, code inspections & save macro's.

These can be added to the development setup and guidelines for contributing.

@ljbade @bleege

Activity

  1. added
    Android
    on Sep 29, 2015
  2. ljbade commented on Sep 29, 2015

    @ljbade
    Contributor

    Yeah we could hit this as we make a pass over all the files for JavaDoc

  3. added this to the milestone on Sep 29, 2015
  4. bleege commented on Sep 29, 2015

    @bleege
    Contributor

    Good catch @tobrun! We've used Checkstyle for this purpose on the Raster SDK in the past and it worked well. It flags style violations as warnings in Android Studio which helps keep everyone honest. The only question is which style we want to use:

    public void foo() {
    
    }
    
    public void foo()
    {
    
    }

    Let the debate begin! 😄

  5. ljbade commented on Sep 29, 2015

    @ljbade
    Contributor

    I'd say most existing code using brackets inline

  6. ljbade commented on Sep 29, 2015

    @ljbade
    Contributor

    I'd say most existing code using brackets inline

  7. changed the title [-]Setup save actions + formatter for AndroidStudio[/-] [+]Android Project Code Style[/+] on Oct 2, 2015
  8. bleege commented on Oct 2, 2015

    @bleege
    Contributor

    We already have checks.xml so we can hook this up in Android Studio to help us develop / enforce styles. JetBrains offers the following plugin to do so. The SDK's build.gradle should already be configured to enforce this.

  9. 9 remaining items

  10. tobrun commented on Oct 22, 2015

    @tobrun
    MemberAuthor

    Ok, finalized it with this codestyle as shown in 83fbdde.

    @ljbade @bleege
    Could you go over the commit and give feedback on things you like/dislike?

  11. bleege commented on Oct 22, 2015

    @bleege
    Contributor

    This is a good thing, but I'd like to see it in one place. Specifically, we have Checkstyle that's part of the Gradle build process already. Ideally we could get Android Studio's Code Style to be driven by that checks.xml file so that we could keep all this information in one spot.

  12. ljbade commented on Oct 22, 2015

    @ljbade
    Contributor

    @tobrun Can we keep the existing tab width? it would save a lot of code churn

  13. tobrun commented on Oct 25, 2015

    @tobrun
    MemberAuthor

    We can add an codestyle configuration to gradle using idea plugin, as shown in this SO-post

  14. bleege commented on Oct 26, 2015

    @bleege
    Contributor

    @tobrun Cool. Let's try that then.

  15. tobrun commented on Oct 28, 2015

    @tobrun
    MemberAuthor

    @bleege I have been looking at integrating this in gradle but having no succes,
    solution in link above is not working and googling for this only returns checkstyle setup.

  16. tobrun commented on Nov 25, 2015

    @tobrun
    MemberAuthor

    Going to close this down for now, will be on the lookout if anything changes in this space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Android

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions