java coding standards - sos.state.co.us · version: 5.11-co::1 10 5/31/2019 java coding standards...
TRANSCRIPT
![Page 1: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/1.jpg)
Java Coding Standards
Version: 5.11-CO::1
May 31, 2019
![Page 2: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/2.jpg)
Table of Contents
5/31/2019 i Version: 5.11-CO::1
Chapter 1: Introduction . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 2: Coding standard proposal . . . . . . . . . . . . 2
Chapter 3: Development Tools . . . . . . . . . . . . . . . . . . 33.1 JavaDoc – IntelliJ (Android Studio) plugin . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.1.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 CheckStyle-IDEA – IntelliJ (Android Studio) plugin . . . . . . . . . . . . . . . . . . 7
3.2.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Configure Code Style Scheme for Android Studio . . . . . . . . . . . . . . . . . . . 10
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
![Page 3: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/3.jpg)
5/31/2019 1 Version: 5.11-CO::1
Chapter 1 - Introduction
CHAPTER 1: INTRODUCTION The aim of this document is to establish the coding standard and set of tools to be used to verify and enforce the usage.
![Page 4: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/4.jpg)
Version: 5.11-CO::1 2 5/31/2019
Java Coding Standards
CHAPTER 2: CODING STANDARD PROPOSAL
Proposed document standard can be found here:
https://google-styleguide.googlecode.com/svn/trunk/javaguide.html
![Page 5: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/5.jpg)
5/31/2019
Chapter 3 - Development Tools
CHAPTER 3: DEVELOPMENT TOOLS
There are two IntelliJ (Android Studio) plugins:
• JavaDoc
• CheckStyle-IDEA
3.1 JavaDoc – IntelliJ (Android Studio) plugin
This tool is used to generate JavaDoc comments for public methods.
http://setial.github.io/intellij-javadocs/
3 Version: 5.11-CO::1
![Page 6: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/6.jpg)
Version: 5.
Java Coding Standards
3.1.1 Installation
It can be installed using “Browse Repositories…” button found in Settings->Plugins of Android Studio.
11-CO::1 4 5/31/2019
![Page 7: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/7.jpg)
5/31/2019
Chapter 3 - Development Tools
3.1.2 Usage
Right click on file, there is the menu option “JavaDocs ->Create JavaDocs for all elements”
5 Version: 5.11-CO::1
![Page 8: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/8.jpg)
Version: 5.
Java Coding Standards
JavaDoc comments will be generated based on file name.
11-CO::1 6 5/31/2019
![Page 9: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/9.jpg)
5/31/2019
Chapter 3 - Development Tools
3.2 CheckStyle-IDEA – IntelliJ (Android Studio) plugin
This plugin provides both real-time and on-demand scanning of Java files with CheckStyle from within the IDEA IDE.
3.2.1 Installation
It can be installed using “Browse Repositories…” button found in Settings->Plugins of Android Studio.FigureCaption
7 Version: 5.11-CO::1
![Page 10: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/10.jpg)
Version: 5.
Java Coding Standards
3.2.2 Configuration
In the Settings window, there is new menu-item called “CheckStyle” where the configuration file is set.
There is configuration file called google_checks.xml that is configures checker according to Google Java Style guide. That file is copied in out folder”\DRE\app\config\checkstyle\checkstyle.xml” in order to be used for Android Studio plugin, as well in the build script.
11-CO::1 8 5/31/2019
![Page 11: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/11.jpg)
5/31/2019
Chapter 3 - Development Tools
3.2.3 Usage
There is the panel to see all errors:
You can also check current file using right-click menu, under “Check Current File” option.
9 Version: 5.11-CO::1
![Page 12: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/12.jpg)
Version: 5.
Java Coding Standards
3.3 Configure Code Style Scheme for Android Studio
There is the Code Style Scheme xml file (“Google Java Style Dominion.xml”) that has all configurations for Java Code Style.
Copy xml configuration to Android Studio configuration folder
For Windows: C:\Users\ivan.curkovic\.AndroidStudio\config\codestyles
For Mac:/Users/<USERNAME>/Library/Preferences/AndroidStudio/codestyles
11-CO::1 10 5/31/2019
![Page 13: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/13.jpg)
5/31/2019
Chapter 3 - Development Tools
Choose Scheme for Java to be “Google Java Style Dominion” from drop-down list.
Now you can reformat code using “Code > Reformat Code…” command in Android Studio.
11 Version: 5.11-CO::1
![Page 14: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/14.jpg)
Java Coding Standards
5/31/2019 12 Version: 5.11-CO::1
REVISION HISTORY
Rev. Date Author Summary
1 02-21-2019 brian.fitzsimmons Created 5.11-CO branch from trunk
![Page 15: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/15.jpg)
Java Coding Standards
5/31/2019 13 Version: 5.11-CO::1
End of DocumentEnd of Document
![Page 16: Java Coding Standards - sos.state.co.us · Version: 5.11-CO::1 10 5/31/2019 Java Coding Standards 3.3 Configure Code Style Scheme for Android Studio There is the Code Style Scheme](https://reader030.vdocuments.mx/reader030/viewer/2022040706/5e05b80ec4d203762b133b86/html5/thumbnails/16.jpg)