clusterfuzz icon indicating copy to clipboard operation
clusterfuzz copied to clipboard

Rename `environment.get_value_string()` to `get_value_raw()`.

Open letitz opened this issue 1 year ago • 1 comments

This is a prelude to fixing type errors in environment.py.

One of the big sources of type errors so far has been the fact that environment.get_value() is ~untyped. Many places in the codebase assume that it returns e.g. a string, or an int. We can introduce get_value_int() for example for ints that checks at runtime that the environment variable evaluated to an int, and use that instead where applicable to appease the type checker (and surface errors earlier at runtime).

There is a need for a get_value_string() that tries to evaluate environment variable contents, i.e. supports quoted values. Many variables are expected to be strings, yet the pervasive use of environment.get_value() and environment.set_value() means it is hard to tell whether they are sometimes quoted or not.

This PR renames the current get_value_string() function to make space for a future get_value_string() that evaluates variables.

letitz avatar Jul 31 '24 14:07 letitz

Thanks for the review! I've rebased and made the type annotation more precise, to avoid errors like:

foo = environment.get_value_raw('foo', '')
bar = foo.split(',')   # type checker complains `foo` might be None

letitz avatar Sep 17 '24 10:09 letitz

This pull request has not had any activity for 60 days and will be automatically closed in two weeks

github-actions[bot] avatar Jan 16 '25 22:01 github-actions[bot]

This pull request has not had any activity for 60 days and will be automatically closed in two weeks

github-actions[bot] avatar Jan 16 '25 23:01 github-actions[bot]

This pull request has not had any activity for 60 days and will be automatically closed in two weeks

github-actions[bot] avatar Jan 17 '25 00:01 github-actions[bot]

This pull request has not had any activity for 60 days and will be automatically closed in two weeks

github-actions[bot] avatar Jan 17 '25 01:01 github-actions[bot]

This pull request has not had any activity for 60 days and will be automatically closed in two weeks

github-actions[bot] avatar Jan 17 '25 02:01 github-actions[bot]

This pull request has not had any activity for 60 days and will be automatically closed in two weeks

github-actions[bot] avatar Mar 18 '25 02:03 github-actions[bot]

This pull request has not had any activity for 60 days and will be automatically closed in two weeks

github-actions[bot] avatar May 17 '25 10:05 github-actions[bot]

Automatically closing stale pull request

github-actions[bot] avatar May 31 '25 10:05 github-actions[bot]