rules:
  - id: raise-not-base-exception
    message:
      In Python3, a runtime `TypeError` will be thrown if you attempt to raise an object or class which does not inherit
      from `BaseException`
    languages: [python]
    severity: ERROR
    pattern-either:
      - pattern: raise "..."
      - pattern: |
          $X: BaseException
          raise $X(...)
      - patterns:
          - pattern: raise $EXCEPTION
          - metavariable-regex:
              metavariable: $EXCEPTION
              regex: '[0-9]*\.?[0-9]+'
    metadata:
      category: correctness
      technology:
        - python
