Linter Configuration


The IBM Operator Collection SDK extension for VS Code has a built-in linter meant to validate your operator-config YAML file.

The linter can be configured with a YAML file called .oc-lint, which should be placed in the same directory as your operator-config file. It contains the following format:

  ---
# .oc-lint

# List of files for the linter to ignore.
exclude_paths:
    - '**'

# Use all the default linter rules
use_default_rules: true

# List of rules to skip linting.
skip_list:
    - match-domain

# List of additional rules to enable.
enable_list:
    - hosts-all
  

Where:

  • exlude_paths defines a glob pattern to ignore when matching against the files the linter will process.
  • use_default_rules Enables all the linting rules to be applied.
  • skip_list Lists all the rules you want disabled.
  • enable_list Lists all the rules you want to explicitly enable.

You can ignore or enable rules, and ignore files from linting.

Linter Rules


You can customize the linter rules and files to suit your needs. By default, the following rules are applied:

RuleDescription
missing-galaxyMissing galaxy.yaml file errors.
match-domaingalaxy.yml file domain mismatch
match-namegalaxy.yml file name mismatch
match-versiongalaxy.yml file version mismatch
ansible-configBuild includes ansible.cfg error
playbook-pathPlaybook relative path validation error
hosts-allPlaybook hosts validation
missing-playbookValidate Playbook existence
finalizer-pathFinalizer relative path validation error
missing-finalizerValidate Finalizer existence

Quick Fix Options


The built-in linter will attempt to remedy playbooks specified in the operator-config YAML file with playbooks that it finds in the collection workspace. When errors are found, for instance in the case that the specifed playbook cannot be located, the linter may provide options to quickly resolve them:

Linter Quick Fix Options