Skip to content

oscal-content-validator.py utility has SyntaxWarnings #1025

@bradh

Description

@bradh

Describe the bug

While validating with oscal-content-validator.py, I see:

/home/bradh/devsecops/OSCAL/src/utils/util/oscal-content-validator.py:23: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if ftype is "json":
/home/bradh/devsecops/OSCAL/src/utils/util/oscal-content-validator.py:45: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if ftype is 'json':
/home/bradh/devsecops/OSCAL/src/utils/util/oscal-content-validator.py:47: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if ftype is 'xml':

Who is the bug affecting?

Probably everyone using a new-ish version of Python.

What is affected by this bug?

Minor effect - its noise that obscures the actual validation results.

When does this occur?

When using the validator. It probably affects every run.

How do we replicate the issue?

  1. Invoke it:
./src/utils/util/oscal-content-validator.py -h
  1. See:
./src/utils/util/oscal-content-validator.py:23: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if ftype is "json":
./src/utils/util/oscal-content-validator.py:45: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if ftype is 'json':
./src/utils/util/oscal-content-validator.py:47: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if ftype is 'xml':
usage: oscal-content-validator.py [-h] -s OSCAL_SCHEMA -f OSCAL_FILE

optional arguments:
  -h, --help            show this help message and exit
  -s OSCAL_SCHEMA, --oscal-schema OSCAL_SCHEMA
                        An OSCAL schema file.
  -f OSCAL_FILE, --oscal-file OSCAL_FILE
                        An OSCAL data file.

Expected behavior (i.e. solution)

No SyntaxWarning output

Other Comments

Will send a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions