Skip to content

oclint

Community Action Reference: Inspected directly from Fastlane core ruby gem definitions.

Supported Platforms: ios, android, mac

Lints implementation files with OCLint

Details

Run the static analyzer tool OCLint for your project. You need to have a compile_commands.json file in your fastlane directory or pass a path to your file.

Parameters & Options

Total options available: 19

Key Type Env Variable Default Required Description
oclint_path String FL_OCLINT_PATH oclint No The path to oclint binary
compile_commands String FL_OCLINT_COMPILE_COMMANDS compile_commands.json No The json compilation database, use xctool reporter ‘json-compilation-database’
select_reqex String FL_OCLINT_SELECT_REQEX - No DEPRECATED! Use :select_regex instead - Select all files matching this reqex
select_regex String FL_OCLINT_SELECT_REGEX - No Select all files matching this regex
exclude_regex String FL_OCLINT_EXCLUDE_REGEX - No Exclude all files matching this regex
report_type String FL_OCLINT_REPORT_TYPE html No The type of the report (default: html)
report_path String FL_OCLINT_REPORT_PATH - No The reports file path
list_enabled_rules Fastlane::Boolean FL_OCLINT_LIST_ENABLED_RULES false Yes List enabled rules
rc String FL_OCLINT_RC - No Override the default behavior of rules
thresholds Array FL_OCLINT_THRESHOLDS - No List of rule thresholds to override the default behavior of rules
enable_rules Array FL_OCLINT_ENABLE_RULES - No List of rules to pick explicitly
disable_rules Array FL_OCLINT_DISABLE_RULES - No List of rules to disable
max_priority_1 Integer - - No The max allowed number of priority 1 violations
max_priority_2 Integer - - No The max allowed number of priority 2 violations
max_priority_3 Integer - - No The max allowed number of priority 3 violations
enable_clang_static_analyzer Fastlane::Boolean FL_OCLINT_ENABLE_CLANG_STATIC_ANALYZER false Yes Enable Clang Static Analyzer, and integrate results into OCLint report
enable_global_analysis Fastlane::Boolean FL_OCLINT_ENABLE_GLOBAL_ANALYSIS false Yes Compile every source, and analyze across global contexts (depends on number of source files, could results in high memory load)
allow_duplicated_violations Fastlane::Boolean FL_OCLINT_ALLOW_DUPLICATED_VIOLATIONS false Yes Allow duplicated violations in the OCLint report
extra_arg String FL_OCLINT_EXTRA_ARG - No Additional argument to append to the compiler command line

Lane Context Shared Values

This action writes the following values to Actions.lane_context[SharedValues::...]:

Key Description
SharedValues::FL_OCLINT_REPORT_PATH The reports file path

Examples

oclint(
compile_commands: "commands.json", # The JSON compilation database, use xctool reporter "json-compilation-database"
select_regex: /ViewController.m/, # Select all files matching this regex
exclude_regex: /Test.m/, # Exclude all files matching this regex
report_type: "pmd", # The type of the report (default: html)
max_priority_1: 10, # The max allowed number of priority 1 violations
max_priority_2: 100, # The max allowed number of priority 2 violations
max_priority_3: 1000, # The max allowed number of priority 3 violations
thresholds: [ # Override the default behavior of rules
"LONG_LINE=200",
"LONG_METHOD=200"
],
enable_rules: [ # List of rules to pick explicitly
"DoubleNegative",
"SwitchStatementsDon'TNeedDefaultWhenFullyCovered"
],
disable_rules: ["GotoStatement"], # List of rules to disable
list_enabled_rules: true, # List enabled rules
enable_clang_static_analyzer: true, # Enable Clang Static Analyzer, and integrate results into OCLint report
enable_global_analysis: true, # Compile every source, and analyze across global contexts (depends on number of source files, could results in high memory load)
allow_duplicated_violations: true, # Allow duplicated violations in the OCLint report
extra_arg: "-Wno-everything" # Additional argument to append to the compiler command line
)

Source & Upstream