|By Lahlali Issam||
|November 26, 2013 11:31 AM EST||
Many Java static analysis tools exist right here, each one focusing on a specific area and each one has its advantages, we can enumerate:
- Pmd which is a static rule-set based Java source code analyzer that identifies potential problems like:
- Possible bugs—Empty try/catch/finally/switch blocks.
- Dead code—Unused local variables, parameters and private methods.
- Empty if/while statements.
- Overcomplicated expressions—Unnecessary if statements, for loops that could be while loops.
- Suboptimal code—Wasteful String/StringBuffer usage.
- FindBugs which looks for bugs in Java code. It uses static analysis to identify hundreds of different potential types of errors in Java programs.
- Checkstyle defines a set of available modules, each of which provides rules checking with a configurable level of strictness (mandatory, optional...). Each rule can raise notifications, warnings, and errors.
Many ways exist to exploit the results of these tools:
- XML format: XML files could be generated from each of these tools, and it can be used to create an HTML report or used by another tool to exploit the analysis result.
- HTML format: HTML report is the prefered way to generate reports and share them between the team, and you can create your custom report by using an xsl stylesheet.
- IDE Plugins: almost all known IDE provides plugins for these tools, which gives the possibility to discover all violations from the source code.
One of the problems with code quality tools is that they tend to overwhelm developers with problems that aren't really problems -- that is, false positives. When false positives occur, developers learn to ignore the output of the tool or abandon it altogether.
And to exploit better their result, it's better to have a way to focus only on what we want and gives to developers a useful view. In this post we will discover another interesting way to exploit better the result of all known java static analysis tools, and query them like a database.
JArchitect and CQLinq
JArchitect is another static analysis tool which complements the other tools, it uses a code query langage based on Linq ( CQLinq) to query the code base like a database.
Until JArchitect 3 you can query only analysis data extracted from JArchitect, however the V4 gives the possibility to import the analysis result from many other static analysis tools and query them with CQLinq.
Let's take as example the source code of the PDT core (the Php plugin for eclipse). and discover how we can exploit the analysis result of these tools from JArchitect.
To begin here are the steps to follows before requesting the analysis result:
- Step1: Analyse the project with PMD, CPD, FindBugs and CheckStyle. And generate the XML files containing the result.
- Step2: Analyze the project with JArchitect.
- Step3: Import all the xml files into JArchitect from the menu "Plugins->Import Plugins Result Files"
Get all issues:
The request to get all issues is very simple, however as you can see it's not very interesting, indeed it's a challenge to exploit a result with 232 725 issues.
To exploit better the result of these tools we can filter it with CQLinq and focus only on what we want.
Request by ruleset
Request by priority
We can also filter by priority:
Most recurrent issues
Classes having most issues
It's very interesting to know the classes which contains many violations
As we can observe CheckStyle report thousand of issues and many of them could be ignored.
The previous query is interesting, but it's not give us exactly the classes with lack of quality, another useful metric to take into account is the NBLinesOfCode, it's normal that a class with many lines of code contains many issues, for that we can modify the previous request to calculate the ratio between the Issues count and the NBLinesofCode.
What's very strange in this result is that the ratio of the 8 first classes is more than 200, in this case we have more than 200 issues by code line.
To explain this behavior let's take a look at some lines of the CompilerAstParser:
The NbLinesOfCode is the number of statements and not the physical lines, and this Class declare many arrays , each one is declared by thousand of physical lines, however each array declaration is considered as one statement.
And as shown before for the most recurrent issues query, the following rule '+' should be on a new line. is violated thousand of times for each array. Maybe it's better to remove these kind of rules from the CheckStyle configuration file.
Most popular methods having issues
When the static analysis tools report the issues, it's useful to locate which the prioritary issues to resolve? specially if it concerns bugs.
It's true that a bug could exist in a specific method, but what interesting to know is how many methods are impacted by the bug, and the popular method are the most used ones and it's better to resolve them quickly.
Using CQLinq we can combine the result of all these tools and also the result of JArchitect to create more elaborated queries, and add these checks to the build process.
Having issues in a project is not bad, we can say that's normal, however we have to check the quality trend of the project. Indeed it's a bad indicator if the number of issues grows after changes and evolutions. /p>
JArchitect provides the Trend Monitoring feature to create trend charts. Trend charts are made of trend metrics values logged over time at analysis time. More than 50 trend metrics are available per default and it is easy to create your own trend metrics.
Let's create a trend metric for the Pmd issues:
And after you can easily create the trend chart to monitor the previous trend metric and add it to the JArchitect dashboard.
With this trend chart we can monitor the evolution of the Pmd issues, and try to understand the reasons when the metric grows over versions.
Customize the JArchitect report
JArchitect make possible to append extra report sections in the HTML report that lists some CQLinq queries. In the CQLinq Query Explorer panel, a particular CQLinq group reported is bordered with an orange rectangle.
You can also add to the report the Pmd trend chart:
And in the HTML report these added sections are accesible from the menu:
And here's the page added in the report for the Pmd CQLinq queries:
JArchitect 4 is now open to other static analysis tools, and you can also plug your customized tool easily as descibed here. This way you can use all the JArchitect features to exploit better the result from the known java static analysis tools.
The 4th International Internet of @ThingsExpo, co-located with the 17th International Cloud Expo - to be held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA - announces that its Call for Papers is open. The Internet of Things (IoT) is the biggest idea since the creation of the Worldwide Web more than 20 years ago.
May. 25, 2015 09:00 AM EDT Reads: 1,991
The worldwide cellular network will be the backbone of the future IoT, and the telecom industry is clamoring to get on board as more than just a data pipe. In his session at @ThingsExpo, Evan McGee, CTO of Ring Plus, Inc., discussed what service operators can offer that would benefit IoT entrepreneurs, inventors, and consumers. Evan McGee is the CTO of RingPlus, a leading innovative U.S. MVNO and wireless enabler. His focus is on combining web technologies with traditional telecom to create a new breed of unified communication that is easily accessible to the general consumer. With over a de...
May. 25, 2015 06:00 AM EDT Reads: 4,754
Disruptive macro trends in technology are impacting and dramatically changing the "art of the possible" relative to supply chain management practices through the innovative use of IoT, cloud, machine learning and Big Data to enable connected ecosystems of engagement. Enterprise informatics can now move beyond point solutions that merely monitor the past and implement integrated enterprise fabrics that enable end-to-end supply chain visibility to improve customer service delivery and optimize supplier management. Learn about enterprise architecture strategies for designing connected systems tha...
May. 25, 2015 05:00 AM EDT Reads: 6,031
Cloud is not a commodity. And no matter what you call it, computing doesn’t come out of the sky. It comes from physical hardware inside brick and mortar facilities connected by hundreds of miles of networking cable. And no two clouds are built the same way. SoftLayer gives you the highest performing cloud infrastructure available. One platform that takes data centers around the world that are full of the widest range of cloud computing options, and then integrates and automates everything. Join SoftLayer on June 9 at 16th Cloud Expo to learn about IBM Cloud's SoftLayer platform, explore se...
May. 25, 2015 04:45 AM EDT Reads: 3,241
SYS-CON Media announced today that 9 out of 10 " most read" DevOps articles are published by @DevOpsSummit Blog. Launched in October 2014, @DevOpsSummit Blog offers top articles, news stories, and blog posts from the world's well-known experts and guarantees better exposure for its authors than any other publication. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long development cycles that produce softw...
May. 25, 2015 04:15 AM EDT Reads: 4,238
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo in Silicon Valley. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place Nov 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 17th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal an...
May. 25, 2015 04:00 AM EDT Reads: 2,881
15th Cloud Expo, which took place Nov. 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA, expanded the conference content of @ThingsExpo, Big Data Expo, and DevOps Summit to include two developer events. IBM held a Bluemix Developer Playground on November 5 and ElasticBox held a Hackathon on November 6. Both events took place on the expo floor. The Bluemix Developer Playground, for developers of all levels, highlighted the ease of use of Bluemix, its services and functionality and provide short-term introductory projects that developers can complete between sessions.
May. 25, 2015 04:00 AM EDT Reads: 6,394
From telemedicine to smart cars, digital homes and industrial monitoring, the explosive growth of IoT has created exciting new business opportunities for real time calls and messaging. In his session at @ThingsExpo, Ivelin Ivanov, CEO and Co-Founder of Telestax, shared some of the new revenue sources that IoT created for Restcomm – the open source telephony platform from Telestax. Ivelin Ivanov is a technology entrepreneur who founded Mobicents, an Open Source VoIP Platform, to help create, deploy, and manage applications integrating voice, video and data. He is the co-founder of TeleStax, a...
May. 25, 2015 04:00 AM EDT Reads: 6,500
The Internet of Things (IoT) promises to evolve the way the world does business; however, understanding how to apply it to your company can be a mystery. Most people struggle with understanding the potential business uses or tend to get caught up in the technology, resulting in solutions that fail to meet even minimum business goals. In his session at @ThingsExpo, Jesse Shiah, CEO / President / Co-Founder of AgilePoint Inc., showed what is needed to leverage the IoT to transform your business. He discussed opportunities and challenges ahead for the IoT from a market and technical point of vie...
May. 25, 2015 04:00 AM EDT Reads: 6,881
Grow your business with enterprise wearable apps using SAP Platforms and Google Glass. SAP and Google just launched the SAP and Google Glass Challenge, an opportunity for you to innovate and develop the best Enterprise Wearable App using SAP Platforms and Google Glass and gain valuable market exposure. In his session at @ThingsExpo, Brian McPhail, Senior Director of Business Development, ISVs & Digital Commerce at SAP, outlined the timeline of the SAP Google Glass Challenge and the opportunity for developers, start-ups, and companies of all sizes to engage with SAP today.
May. 25, 2015 03:00 AM EDT Reads: 5,121
The 3rd International @ThingsExpo, co-located with the 16th International Cloud Expo – to be held June 9-11, 2015, at the Javits Center in New York City, NY – is now accepting Hackathon proposals. Hackathon sponsorship benefits include general brand exposure and increasing engagement with the developer ecosystem. At Cloud Expo 2014 Silicon Valley, IBM held the Bluemix Developer Playground on November 5 and ElasticBox held the DevOps Hackathon on November 6. Both events took place on the expo floor. The Bluemix Developer Playground, for developers of all levels, highlighted the ease of use of...
May. 25, 2015 03:00 AM EDT Reads: 3,515
Enthusiasm for the Internet of Things has reached an all-time high. In 2013 alone, venture capitalists spent more than $1 billion dollars investing in the IoT space. With "smart" appliances and devices, IoT covers wearable smart devices, cloud services to hardware companies. Nest, a Google company, detects temperatures inside homes and automatically adjusts it by tracking its user's habit. These technologies are quickly developing and with it come challenges such as bridging infrastructure gaps, abiding by privacy concerns and making the concept a reality. These challenges can't be addressed w...
May. 25, 2015 02:45 AM EDT Reads: 6,821
The industrial software market has treated data with the mentality of “collect everything now, worry about how to use it later.” We now find ourselves buried in data, with the pervasive connectivity of the (Industrial) Internet of Things only piling on more numbers. There’s too much data and not enough information. In his session at @ThingsExpo, Bob Gates, Global Marketing Director, GE’s Intelligent Platforms business, to discuss how realizing the power of IoT, software developers are now focused on understanding how industrial data can create intelligence for industrial operations. Imagine ...
May. 25, 2015 02:00 AM EDT Reads: 5,340
SYS-CON Events announced today that Liaison Technologies, a leading provider of data management and integration cloud services and solutions, has been named "Silver Sponsor" of SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York, NY. Liaison Technologies is a recognized market leader in providing cloud-enabled data integration and data management solutions to break down complex information barriers, enabling enterprises to make smarter decisions, faster.
May. 25, 2015 01:30 AM EDT Reads: 5,440
The 17th International Cloud Expo has announced that its Call for Papers is open. 17th International Cloud Expo, to be held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, APM, APIs, Microservices, Security, Big Data, Internet of Things, DevOps and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal today!
May. 25, 2015 01:15 AM EDT Reads: 4,539
Hadoop as a Service (as offered by handful of niche vendors now) is a cloud computing solution that makes medium and large-scale data processing accessible, easy, fast and inexpensive. In his session at Big Data Expo, Kumar Ramamurthy, Vice President and Chief Technologist, EIM & Big Data, at Virtusa, will discuss how this is achieved by eliminating the operational challenges of running Hadoop, so one can focus on business growth. The fragmented Hadoop distribution world and various PaaS solutions that provide a Hadoop flavor either make choices for customers very flexible in the name of opti...
May. 25, 2015 12:30 AM EDT Reads: 4,018
Cultural, regulatory, environmental, political and economic (CREPE) conditions over the past decade are creating cross-industry solution spaces that require processes and technologies from both the Internet of Things (IoT), and Data Management and Analytics (DMA). These solution spaces are evolving into Sensor Analytics Ecosystems (SAE) that represent significant new opportunities for organizations of all types. Public Utilities throughout the world, providing electricity, natural gas and water, are pursuing SmartGrid initiatives that represent one of the more mature examples of SAE. We have s...
May. 24, 2015 11:00 PM EDT Reads: 6,143
The Internet of Things will put IT to its ultimate test by creating infinite new opportunities to digitize products and services, generate and analyze new data to improve customer satisfaction, and discover new ways to gain a competitive advantage across nearly every industry. In order to help corporate business units to capitalize on the rapidly evolving IoT opportunities, IT must stand up to a new set of challenges. In his session at @ThingsExpo, Jeff Kaplan, Managing Director of THINKstrategies, will examine why IT must finally fulfill its role in support of its SBUs or face a new round of...
May. 24, 2015 10:00 PM EDT Reads: 5,509
Can call centers hang up the phones for good? Intuitive Solutions did. WebRTC enabled this contact center provider to eliminate antiquated telephony and desktop phone infrastructure with a pure web-based solution, allowing them to expand beyond brick-and-mortar confines to a home-based agent model. It also ensured scalability and better service for customers, including MUY! Companies, one of the country's largest franchise restaurant companies with 232 Pizza Hut locations. This is one example of WebRTC adoption today, but the potential is limitless when powered by IoT.
May. 24, 2015 09:00 PM EDT Reads: 6,598
One of the biggest challenges when developing connected devices is identifying user value and delivering it through successful user experiences. In his session at Internet of @ThingsExpo, Mike Kuniavsky, Principal Scientist, Innovation Services at PARC, described an IoT-specific approach to user experience design that combines approaches from interaction design, industrial design and service design to create experiences that go beyond simple connected gadgets to create lasting, multi-device experiences grounded in people's real needs and desires.
May. 24, 2015 09:00 PM EDT Reads: 6,161