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
2
votes
1 answer

iOS : OCLint is not working with xcode 9.2

We have integrated OCLint in one of our project with below script. source ~/.bash_profile export PATH=$PATH:/usr/local/bin/ if [ -z "${SCHEME+x}" ] then export SCHEME="${PROJECT_NAME}" fi if [ -z "${WORKSPACE+x}" ] then export…
iDev
  • 531
  • 1
  • 5
  • 15
2
votes
0 answers

Oclint show error always -bash: path/to/xctool.sh: No such file or directory

I am using Oclint to generate code review report of application. for this I have used below link http://oclint.org I am using Xctool in the oclint. for installing xctool I have used this…
Chandni
  • 692
  • 1
  • 10
  • 25
2
votes
1 answer

Get class information from ObjCPropertyDecl

I having some trouble extracting the class information from a clang ObjCPropertyDecl type. Example Objective-C file: #import @interface Test: NSObject @property (nonatomic, strong, nullable) NSObject *test; @property…
danielbeard
  • 9,120
  • 3
  • 44
  • 58
2
votes
2 answers

OCLint fails to discover pre-compiled workspace/project headers

I am receiving the error below when attempting to build my OCLint aggregate. We use pre-compiled headers within the workspace and although they are referenced exactly the same within the main target and OCLint aggregate, for some reason,OCLint…
2
votes
1 answer

oclint compile_commands.json not found at current location

Recently I'm trying to use Jenkins for Oclint statically analyzing objective-c sources. So I followed the guide on the Oclint.org, especially this page oclint_guide_with_Jenkins And then, I run the build job on the Jenkins. But the job was always…
urtaq
  • 33
  • 1
  • 11
2
votes
1 answer

How to use cocoapods integrated project with OCLint?

I can build the project and generate OCLint report on a project without cocoapods but when integrated with cocoapods the build for project is successful but the build for OCLint results into errors for the file which are present into cocoapods and…
Dheeraj Singh
  • 5,143
  • 25
  • 33
2
votes
3 answers

The rule 'OCLint:ivar assignment outside accessors or init' does not exist

I am trying to integrate SonarQube to generate report on my iOS project, I am using Objective-C Sonar plugin When i run ./run-sonar.sh OCLint generates a compile_commands.json file in my root directory. and after that getting following…
AMR
  • 63
  • 1
  • 5
2
votes
0 answers

oclint-json-compilation-database not running (0.9) when analysing iOS project

I tried running oclint 0.7 which started going through my project, but eventually failed with: Assertion failed: (Val && "isa<> used on a null pointer"), function doit, file…
Killian
  • 936
  • 3
  • 14
  • 28
2
votes
1 answer

oclint: error: violations exceed threshold via Jenkins

can't win oclint. I really don't know what to do, i try to make some changes in build script but nothing help. script: $XCODE_COMMAND -reporter json-compilation-database:${WORKSPACE}/compile_commands.json clean…
Vladimir Voitekhovski
  • 1,472
  • 5
  • 21
  • 33
2
votes
1 answer

OCLint and xcode project

since yesterday I'm trying to make OCLint works with my iOS project. What I've done so far is to follow these instructions to install OCLint, then I've followed these other instructions to use it within Xcode. The problem is that when I try to…
oiledCode
  • 8,589
  • 6
  • 43
  • 59
1
vote
1 answer

Determining macro expansion for VarDecl in clang

I'm a beginner to C++, attempting to lint Objective-C code with clang. I understand that macros are first expanded before nodes and properties are visited with AST. I have a macro named NIL_CHECK, which is used in numerous files. While performing…
ynwa
  • 11
  • 2
1
vote
1 answer

Reversing Linked List in C

I've been working on a code to reverse a linked list, but I only seem to be getting the first element printed out in my list. Here is my function: void reverseSqueue(Squeue squeue) { if (squeue -> first == NULL || squeue -> last == NULL){ …
William
  • 81
  • 5
1
vote
0 answers

A list of compiler rules for OCLint

Is there a list of all compiler rules (not OCLint rules) which oclint produceses with enabled option -enable-clang-static-analyzer? What I'm looking for is for example rule="clang static analyzer" or rule="compiler warning" from the xml snippet…
user2319066
  • 195
  • 18
1
vote
0 answers

Added OClint to Obj-c code. But it is not showing warnings

I tried adding oclint to Xcode referring to this Doc link Followed the sane steps as shown in the link. But I see no warnings. Can somebody help me out here?
1
vote
0 answers

oclint not install in Mac machine

I want to install Oclint so that it can review objective C code. Can any one has it's tutorial or share any step by step guide line for how can we install it and check objective c code by it. I read this link…