Questions tagged [oclint]

OCLint is a static code analysis tool for improving the quality of C, C++ and primarily Objective-C. Code analysis reduces defects by inspecting the code and looking for potential problems.

OCLint is a static code analysis tool for improving quality and reducing defects by inspecting C, C++ and Objective-C code and looking for potential problems like:

  • Possible bugs - empty if/else/try/catch/finally statements.
  • Unused code - unused local variables and parameters
  • Complicated code - high cyclomatic complexity, NPath complexity and high NCSS
  • Redundant code - redundant if statement and useless parentheses
  • Code smells - long method and long parameter list
  • Bad practices - inverted logic and parameter reassignment

Static code analysis is a critical technique to detect defects that aren't visible to compilers. OCLint automates this inspection process with advanced features:

Relying on the abstract syntax tree of the source code for better accuracy and efficiency; False positives are mostly reduced to avoid useful results sinking in them. Dynamically loading rules into system, even in the runtime. Flexible and extensible configurations ensure users in customizing the behaviors of the tool. Command line invocation facilitates continuous integration and continuous inspection of the code while being developed, so that technical debts can be fixed early on to reduce the maintenance cost.

48 questions
1
vote
0 answers

How get and output description of VarDecl in clang?

I'm writing OCLint rule based on VisitBlockDecl using clang. How can I output to console value of VarDecl *var variable? static SmallVector blockVars; for (int i=0; i < blockVars.size(); i++) { VarDecl *var = blockVars[i]; }
Yulia
  • 1,087
  • 9
  • 16
1
vote
0 answers

OCLint debug in Xcode

OCLint is integrated to Xcode project (as Agregate target). But I write/edit OCLint rules in the separate files (like simple text files) and then build new/modified rules from the command line. Therefore if I need to debug the rule I have to use…
Yulia
  • 1,087
  • 9
  • 16
1
vote
1 answer

Sonarqube not Importing issues reported by OCLint

I am doing Objective-C code analysis by using sonarqube. The configuration is as below: SonarQube 5.4 Objective-C (Community) 5.0.0 xcode 6 xctool OCLint 0.10.2 The OCLint doing the analysis and puting it in to the sonar-reports/oclint.xml. But…
Uttam Kadam
  • 458
  • 1
  • 7
  • 20
1
vote
1 answer

oclint-json-compilation-database loops indefinitely

I'm integrating OCLint tool in an Xcode project to do some static analysis but I'm getting what seems to be a bug in the OCLint tool. I'm using OCLint 0.8.1 and this is what I do: Build my project $ xcodebuild -workspace "Reduced.xcworkspace"…
1
vote
1 answer

"cannot find original pch source file" while running oclint-xcodebuild manually

So I am using Xcode version 6.3.1 and I am trying to run OClint manually using the link here So when first time I followed the process I was able to generate compile_commands.json successfully using "oclint-xcodebuild" and while running…
sheetal
  • 3,014
  • 2
  • 31
  • 45
1
vote
2 answers

OCLint with Xcode empty report

I'm trying to get OCLint working with a iOS project. I've installed OCLint using Brew and it has installed correctly (I can check in terminal by running the oclint command). I've attempted to integrate it by creating a separate target (tutorial…
bennythemink
  • 5,096
  • 4
  • 36
  • 54
1
vote
0 answers

Does oclint on windows work?

I'm running the windows binary distribution of oclint. Using cmake with CMAKE_EXPORT_COMPILE_COMMANDS=ON I create a compile_commands.json. Here are the first 2 entries: [ { "directory": "C:/QtCassandra/src", "command": "c:/MinGW/bin/c++.c++.exe…
mister270
  • 366
  • 1
  • 15
1
vote
1 answer

oclint 0.8 on Ubuntu getting it to work

I'm a newb to oclint trying to get version 0.8 working on Ubuntu 14.04 desktop running as a VM in Virtualbox. I've built from the source rather than use the binaries. I have 2 very simple programs. The first is a small cpp program that I…
mister270
  • 366
  • 1
  • 15
1
vote
1 answer

oclint: error: no rule loaded

I am trying to get the list of warnings,errors,syntax coding convention and cyclomatic complexity from command line. I found that oclint can be used for my purpose. but then I ran into a problem What I tried to do. xcodebuild -project…
Prajwal Udupa
  • 860
  • 5
  • 28
1
vote
1 answer

Show warnings for methods longer than x lines in Xcode

Is there a way how to check source code files (Objective C) and show warning for methods/functions that are longer than x lines (where the x can be configured). Something that can be integrated in Xcode would be great. I have looked into these two…
Tom Kraina
  • 3,569
  • 1
  • 38
  • 58
0
votes
1 answer

OCLint reports compiler errors due to its inability to find #import-ed header files

I am trying to integrate OCLint 0.13 to check lint violations in my ObjC based iOS project. As per this guide I created an aggregate target in Xcode to run a xcodebuild clean build followed by oclint-xcodebuild to generate a compile_commands.json.…
Prodigy
  • 61
  • 8
0
votes
1 answer

'objc/objc.h' file not found when trying to compile a objective-c program.What should I do?

If i use : oclint test2.m -- -x objective-c -arch armv7 -std=gnu99 -fobjc-arc -O0 -isysroot /Developer/SDKs/iPhoneOS6.0.sdk -g -I./Pods/Headers -c or: oclint test2.m -- -c It will show a Compiler Error:…
Nosferatul
  • 21
  • 3
0
votes
1 answer

OCLint SonarQube(with OCLint) not showing Issues area : Running OCLint - Compile command not found

I have been working on setting up SonarQube for and iOS Project implemented with Objective-C. Used OCLint for setting up the tool. It was success when I tried to setup the SonarQube for simple Xcode project and I'm failing while setting it up for…
Alex Andrews
  • 1,498
  • 2
  • 19
  • 33
0
votes
1 answer

OCLint for Xcodebuild Shell Error

I am getting these error after creating a new Aggregate target with below script: error: oclint not found, analyzing stopped Command /bin/sh failed with exit code 1 Run Script Shell: /bin/sh Script: source ~/.bash_profile hash oclint &>…
Roopesh Mittal
  • 191
  • 2
  • 10
0
votes
1 answer

How to generate OCLint report to html format file?

I'm trying to use OCLint as primary code analyzer for my objc project. I follow OCLint guide and get a json file with named "compile_commands.json". But I can't generate it to HTML format file? Anybody can help me? Athought tried a dozen ways but it…
Phong Nguyen
  • 277
  • 4
  • 16