78
Quality Assurance JDeveloper Auditing Framework

jdeveloper Auditing framework

Embed Size (px)

DESCRIPTION

jdeveloper Auditing framework

Citation preview

  • Quality Assurance JDeveloper Auditing Framework

  • About Us

    Richard OlrichsMNwww.olrichs.nl@richardolrichs

    Wilfred van der DeijlThe Future Groupwww.redheap.com@wilfreddeijl

  • Agenda

    Audit Profiles and Preferences Audit JDeveloper Extension Project Creating Custom Rules Creating Custom Fixes SuppressWarnings Automated QA

  • Aborts Compile On Error

  • Applies default Fix Run analysis with single

    (or few) rules Example: Generate

    unique JSF component ID

  • Custom Rules

  • Custom Rules

    Setting up JDeveloper Extension Project

    Implementing Custom Rule Implementing Custom Fix

  • Setting up JDev Project

  • 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)

  • Creating Custom Rules

  • Analyzing Java Code

  • Analyzing XML Files

  • Disables Analyzer for current construct and all children

  • AuditContext

    Provides Traversal State report() for Violations, Metrics,

    Suppressions Holds State for Analyzer

    Setting Attributes for Child Constructs Setting Attributes for Parent Construct (Sharing Attributes between Analyzers)

  • AuditContext creates Analyzer State Keys enter() on root-node (Workspaces) invoked

    once, so can initialize keys

  • Creating Custom Fix

  • Transform subclass

    apply(context, construct) applies fix by changing source TransformContext argument contains editor location,

    violation, etc Construct is the object with the violation (eg. a

    JavaMethod or XMLElement) isQueryRequired(context, construct)

    and query(context, construct) queries the user for additional info when applying fix

  • 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 Schemes

  • JDeveloper 12c Suppression Scheme

    Why not create our own for non-Java (aka XML)?

  • Suppress Warnings in XML

  • Suppress Warnings in XML

  • SuppressWarnings

    JDeveloper 12c natively supports @SuppressWarning in Java

    JDev extension adds

    Extension available today JDeveloper 12c only as Suppression

    Schemes is new 12c feature

  • Analyzer - Suppressing violations

  • Transform - Creating XML Comment

  • Audit Extension Project

  • Audit Extension Project

    Project standards Company standards Community standards

  • Audit Extension Project

  • ADF EMG Extension Project

  • 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 only

    at least for now. No reason why this cant be backported to 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 keep list of violations short and actionable

  • Automated QASonarQube

  • 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 runs ojaudit 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

  • Further Reading

    www.olrichs.nl www.redheap.com ADF Enterprise Methodology Group

    Google Groups http://docs.oracle.com

    JDeveloper Doc (not ADF documentation) Developing Extensions for JDeveloper Java API Reference for Extension SDK

  • Summary

    Audit Profiles and Preferences Creating Custom Rules Creating Custom Fixes SuppressWarnings JDev Extension ADF Code Guidelines JDev Extension SonarQube ojaudit plugin