View
156
Download
1
Embed Size (px)
DESCRIPTION
Quality Assurance doesn’t always get the attention it needs during a project. Maintaining and enforcing organization defined quality rules can be seen as a chore. Having code quality audited while coding is much more efficient than manually peer reviewing afterwards. We will not only demonstrate the powerful Oracle JDeveloper built-in auditing tools, but will also show how to extend it with your own auditing rules, create your own automated code fixes, and how to integrate automated auditing with your build automation. This session shows JDeveloper’s Auditing features and other free tools to enable you and your team to consistently deliver high quality code whether it is ADF, SOA, BPM or any other technology supported by JDeveloper.
Citation preview
Quality Assurance Enforcing Code Guidelines by Extending JDeveloper’s Auditing Framework
About Us
Richard Olrichs
MN
www.olrichs.nl
@richardolrichs
Wilfred van der Deijl
The Future Group
www.redheap.com
@wilfreddeijl
Agenda
● Audit Profiles and Preferences
● Audit JDeveloper Extension Project
● Creating Custom Rules
● SuppressWarnings
● ADF EMG Audit Rules
● Automated QA
Aborts Compile On Error
Custom Rules
Custom Rules
● Setting up JDeveloper Extension
Project
● Implementing Custom Rule
● Implementing Custom Fix
Setting up JDev Extension Project
● Install Extension SDK (Help>CheckForUpdates)
● File > New > Applications >
Extension Application
● extension.xml and MANIFEST.MF
● Bundled as .ZIP
● Can be distributed through custom JDeveloper
Update Center
(aka network drive or URL)
Violation Overload
Violation Overload
● Even ADF Sample Application from OTN
has 157 issues
● Too many violations cause developers to
ignore all of them
Violation Overload
SuppressWarnings Java Annotation
@SuppressWarnings annotation introduced in
Java 1.5 and tells Java Compiler to suppress
warnings
SuppressWarnings Java Annotation
JDeveloper 12c now also “listens” to annotation
and suppresses warnings itself (not only javac)
JDeveloper 12c Suppression Scheme
Why not create our own for non-Java (aka XML)?
Suppress Warnings in XML
Suppress Warnings in XML
ADF EMG Audit Rules
ADF Code Guidelines Extension
● JDeveloper extension available today
● ADF Code Guidelines auditing during
development
● Community project at java.net: adfemg-
auditrules
● Contribute and discuss at ADF EMG
● JDeveloper 12c & JDeveloper 11g
Automated QA
OJAudit
● Command line auditing ● JDEV_HOME/jdev/bin/ojaudit -help
● Output in XML/text/HTML or custom xsl
Automated QA
● Simple solution: Run ojaudit from CI server
and publish output
● Benefit: Same rules during development and
CI QA ● @SuppressWarnings and<!--
SuppressWarning--> keep list of
violations short and actionable
Automated QA
SonarQube
SonarQube
● Tool to manage Code Quality
● Rules, Violations, Metrics, Test Coverage, etc
● Free Open Source
● Initially Java, but now 20+ languages
● Historical data, thus trends
● Highly extensible through plugins
ADF EMG SonarQube plugin
● SonarQube plugin o runs ojaudit
o converts ojaudit output to SonarQube violations
● www.sonarqube.com for base product
● Watch ADF EMG for availability of plugin
● Not specific to ADF, but for any JDev project
● Tested with JDeveloper 12c, but should work
with any version
Summary
● Audit Profiles and Preferences
● Creating Custom Rules
● SuppressWarnings JDev Extension
● ADF EMG Audit Rules Extension
● SonarQube ojaudit plugin
Further Reading
● www.olrichs.nl o Index page for Audit Rules
● www.redheap.com
● www.adfemg.org o Google Groups
● http://docs.oracle.comJDeveloper Doc (not
ADF documentation) o Developing Extensions for JDeveloper
o Java API Reference for Extension SDK