-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
csmock: export functions that can be reused by cspodman #115
csmock: export functions that can be reused by cspodman #115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this. I am marking this pull request as a draft until the related change in cspodman
is proven to work as expected.
44c6d5c
to
f115b7e
Compare
f115b7e
to
687ac1d
Compare
687ac1d
to
c5df618
Compare
@lbossis Thank you for working on this. I am marking this pull request as a draft until the related change in cspodman is proven to work as expected. |
py/common/util.py
Outdated
in order to expose it for potential use where it might fit | ||
""" | ||
# install global filter of known false positives | ||
filter_cmd = f"csdiff --json-output --show-internal \"{props.known_false_positives}\"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... so that they can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
... so that it can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
... so that it can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
... so that it can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
a4f417b
to
dd5baab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vcs-diff-lint found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
... so that it can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
... so that it can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
dd5baab
to
e109338
Compare
# then apply custom per-checker filters | ||
for (chk, csgrep_args) in props.imp_csgrep_filters: | ||
chk_re = re_from_checker_set(props.imp_checker_set - set([chk])) | ||
cmd += " | csdiff <(csgrep '%s' --mode=json --drop-scan-props --invert-regex --checker '%s' %s) -" \ |
Check warning
Code scanning / vcs-diff-lint
Line too long (112/100)
"""transform scan-results.js to scan-results.{err,html} and write stats""" | ||
if props.imp_checker_set: | ||
# filter out "important" defects, first based on checkers only | ||
cmd = "csgrep '%s' --mode=json --checker '%s'" % \ |
Check warning
Code scanning / vcs-diff-lint
finalize_results: Formatting a regular string which could be a f-string
# then apply custom per-checker filters | ||
for (chk, csgrep_args) in props.imp_csgrep_filters: | ||
chk_re = re_from_checker_set(props.imp_checker_set - set([chk])) | ||
cmd += " | csdiff <(csgrep '%s' --mode=json --drop-scan-props --invert-regex --checker '%s' %s) -" \ |
Check warning
Code scanning / vcs-diff-lint
finalize_results: Formatting a regular string which could be a f-string
|
||
# write the result into *-imp.js | ||
imp_js_file = re.sub("\\.js", "-imp.js", js_file) | ||
cmd += " > '%s'" % imp_js_file |
Check warning
Code scanning / vcs-diff-lint
finalize_results: Formatting a regular string which could be a f-string
|
||
# initialize the "imp" flag in the resulting full .js output file | ||
tmp_js_file = re.sub("\\.js", "-tmp.js", js_file) | ||
cmd = "cslinker --implist '%s' '%s' > '%s' && mv -v '%s' '%s'" \ |
Check warning
Code scanning / vcs-diff-lint
finalize_results: Formatting a regular string which could be a f-string
(err_file, _) = transform_results(js_file, results) | ||
|
||
if props.print_defects: | ||
os.system("csgrep '%s'" % err_file) |
Check warning
Code scanning / vcs-diff-lint
finalize_results: Formatting a regular string which could be a f-string
os.system("csgrep '%s'" % err_file) | ||
|
||
|
||
def apply_result_filters(props, results, supp_filters=[]): |
Check warning
Code scanning / vcs-diff-lint
apply_result_filters: Dangerous default value [] as argument
return | ||
|
||
# install path exclusion filters for this pkg | ||
with open(ep_file) as file_handle: |
Check warning
Code scanning / vcs-diff-lint
handle_known_fp_list: Using open without explicitly specifying an encoding
from csmock.common.util import shell_quote | ||
from csmock.common.util import strlist_to_shell_cmd | ||
from csmock.common.results import FatalError | ||
from csmock.common.results import ScanResults | ||
from csmock.common.results import apply_result_filters | ||
from csmock.common.results import finalize_results |
Check warning
Code scanning / vcs-diff-lint
Unable to import 'csmock.common.results'
from csmock.common.util import shell_quote | ||
from csmock.common.util import strlist_to_shell_cmd | ||
from csmock.common.results import FatalError | ||
from csmock.common.results import ScanResults | ||
from csmock.common.results import apply_result_filters | ||
from csmock.common.results import finalize_results | ||
from csmock.common.results import handle_known_fp_list |
Check warning
Code scanning / vcs-diff-lint
Unable to import 'csmock.common.results'
Didn't verify but the proposed changes LGTM. |
... so that they can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
... so that it can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
... so that it can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
... so that it can be reused by cspodman Related: https://issues.redhat.com/browse/OSH-151 Closes: csutils#115
e109338
to
40b402c
Compare
@rhyw Thanks for review! |
Ready for review