Gitlab ci code_quality job dosent accept rules

As per this post : https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html , tried the to add the rules on code quality job for merge request pipelines . But i get yaml validation error .

I see below error
jobs:code_quality config key may not be used with rules: only

Below is my job definition in ci-yml for code-quality:
code_quality:
rules:
- if: ‘$CI_PIPELINE_SOURCE == “merge_request_event”’
when: always
extends: .shell_base
stage: static-analysis
allow_failure: true
artifacts:
expose_as: ‘PLS Code Quality Report’
paths: [gl-code-quality-report.json]
script:
- docker run --env SOURCE_CODE="$PWD" --volume "PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock registry.gitlab.com/gitlab-org/ci-cd/codequality:{VERSION:-latest} /code

Thanks
Amith