[TIMOB-16946] iOS: SDK should have 0 static analyzer errors (it currently has 77)
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-02-09T17:08:53.000+0000 |
Affected Version/s | Release 3.2.2 |
Fix Version/s | Release 3.5.1, Release 4.0.0 |
Components | iOS |
Labels | qe-verified |
Reporter | Matt Langston |
Assignee | Chee Kiat Ng |
Created | 2014-05-12T21:13:41.000+0000 |
Updated | 2015-02-19T19:40:53.000+0000 |
Description
The Titanium iOS SDK should have 0 static analyzer errors (it currently has 77). The static analyzer is very accurate and every issue identified by it should be corrected. The majority of these errors are logic errors (e.g. division by zero, dereferencing null pointers, etc.) and memory leaks.
Verification method:
1. in Xcode, Product -> Analyze
2. Results will appear, indicating all the analyzer errors
After resolving all issues, this should result in 0 analyzer errors.
Attachments
I agree this is important, but I can't (currently) block on this. If we manage to fix it during the beginning of the QE pass, we could consider merging it in.
Running static analyzer on the latest SDK results in 129 errors as of date. To create sub tasks and fixes based on types of errors, to make sure we don't break anything without knowing where we broke it.
All subtasks resolved
Backport to 3_5_X https://github.com/appcelerator/titanium_mobile/pull/6370
Reopening ticket as I still see warnings in the Xcode projects when using: Mac OSX 10.10.1 Appcelerator Studio, build: 3.4.1.201410281743 Titanium SDK build: 3.5.0.v20141202100219 Titanium CLI, build: 3.4.1 Alloy: 1.5.1 Xcode 6.2 beta I created a default Titanium project and a default Alloy project. When running the analyzer in Xcode I see both memory and dead store errors. I will attach screenshots of the errors for the apps which are the following configurations * Default Titanium *without* services enabled * Default Titanium *with* services enabled * Default Alloy *without* services enabled * Default Alloy *with* services enabled
The Memory Leak in AppModule is intentional and in place for LiveView. Ignore that. The Memory Leak in TiBuffer is not really a leak but rather Xcode getting confused over the function name copy. The MemoryLeak in TiNetworkTCPSocketFactory is again not a leak but rather Xcode getting confused over a function name. The two dead store warnings are target dependent. Both of these can be ignored. LeadingSlashRemoved is used on simulators so will show that warning when target is device. AirKey is used on device so will show that warning when target is simulator.
Which of these can we "hide" using the techniques in here http://clang-analyzer.llvm.org/faq.html? I'd like us to either fix the issues that cause an analyzer warning, or if they are intentional, indicate though another mechanism that we intend the warning to exist. [~vduggal], [~pec1985], [~cng], can one of you please take a look?
Used
to inform analyzer to skip the lines of codes that created the intentional warnings mentioned above. master PR: https://github.com/appcelerator/titanium_mobile/pull/6548 3_5_X PR: https://github.com/appcelerator/titanium_mobile/pull/6549
We updated the PRs to ignore the internal errors.
[~ingo] [~cng], I merged those PRs. It looks like there are still 5 warnings.
[~jalter], I think it's because you were doing the analyzer on the KitchenSink projects within the SDK. If we follow Ewan's testing method on newly created titanium projects, you will get zero warnings. So I didn't resolve those you highlighted just because I wanted to minimize unnecessary changes.
That works, thanks [~cng]
Verified fix on: Mac OSX 10.10.2 Appcelerator Studio, build: 3.4.2.201502181619 Titanium SDK build: 3.5.1.v20150219103744 Titanium CLI, build: 3.4.2-alpha Alloy: 1.5.1 Xcode 6.1.1 Created a new project and built it, used Xcodes static analyzer and there are no longer any memory or dead store errors. Closing ticket.