Skip to content

Commit

Permalink
Merge branch 'develop' into 128-create-testmotionbasedcanting
Browse files Browse the repository at this point in the history
  • Loading branch information
mhhwang1 authored Oct 9, 2024
2 parents 1ae8058 + b7816bf commit 595d9dd
Show file tree
Hide file tree
Showing 25 changed files with 555 additions and 163 deletions.
70 changes: 70 additions & 0 deletions .github/ISSUE_TEMPLATE/code-bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Code Bug Report
description: File a code bug report.
title: "[Code Bug]: "
labels: ["code bug", "triage"]
assignees:
- e10harvey, bbean23, braden6521
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. [email protected]
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: version
attributes:
label: Version
description: What version of our software are you running?
placeholder: develop@c481fdc
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: What OS are you seeing this on?
multiple: true
options:
- Windows
- Linux
- MacOS
- type: textarea
id: dependencies
attributes:
label: Relevant dependency versions
description: Please copy and paste any relevant dependency versions (hint python3 --version, ffmpeg -version, pip list). This will be automatically formatted into code, so no need for backticks.
render: shell
- type: textarea
id: reproducer
attributes:
label: python script that produces the error
description: Please copy and paste the code that produces the error. This will be automatically formatted into code, so no need for backticks.
render: python
- type: textarea
id: logs
attributes:
label: Relevant console output
description: Please copy and paste any relevant console output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: checkboxes
id: contribution-guidelines
attributes:
label: Contribution Guidelines
description: By submitting this issue, you agree to follow our [contribution guidelines](https://github.com/sandialabs/OpenCSP/blob/main/CONTRIBUTING.md).
options:
- label: I agree to follow this project's contribution guidelines
required: true
60 changes: 60 additions & 0 deletions .github/ISSUE_TEMPLATE/code-feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Code Feature Request
description: Request a new code feature.
title: "[Code Feature]: "
labels: ["code feature", "under review"]
assignees:
- e10harvey, bbean23, braden6521
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. [email protected]
validations:
required: false
- type: textarea
id: feature-description
attributes:
label: Feature
description: Also, describe the feature you would like.
placeholder: Describe what you want!
validations:
required: true
- type: textarea
id: requirements
attributes:
label: Feature
description: Also tell us, what are your requirements?
placeholder: As a X, I need to Y, so that I can Z.
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: What OS do you intend to use this on?
multiple: true
options:
- Windows
- Linux
- MacOS
- type: textarea
id: dependencies
attributes:
label: Dependencies
description: Also tell us, what third party dependencies does this feature require?
placeholder: foobar v1000
validations:
required: false
- type: checkboxes
id: contribution-guidelines
attributes:
label: Contribution Guidelines
description: By submitting this issue, you agree to follow our [contribution guidelines](https://github.com/sandialabs/OpenCSP/blob/main/CONTRIBUTING.md).
options:
- label: I agree to follow this project's contribution guidelines
required: true
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
blank_issues_enabled: false

contact_links:
- name: OpenCSP Community Support
url: https://github.com/sandialabs/OpenCSP/discussions
about: Please ask and answer questions here.
78 changes: 78 additions & 0 deletions .github/ISSUE_TEMPLATE/data-bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Data Bug Report
description: File a data bug report.
title: "[Data Bug]: "
labels: ["data bug", "triage"]
assignees:
- e10harvey, bbean23, braden6521
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. [email protected]
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: version
attributes:
label: Version
description: What version of our software are you running?
placeholder: develop@c481fdc
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: What OS are you seeing this on?
multiple: true
options:
- Windows
- Linux
- MacOS
- type: input
id: data-link
attributes:
label: Data link
description: How can we access the data you're having trouble with?
placeholder: ex. https://github.com/sandialabs/OpenCSP/tree/develop/opencsp/app/sofast/test/data/input/SofastConfiguration
validations:
required: true
- type: textarea
id: dependencies
attributes:
label: Relevant dependency versions
description: Please copy and paste any relevant dependency versions (hint python3 --version, ffmpeg -version, pip list). This will be automatically formatted into code, so no need for backticks.
render: shell
- type: textarea
id: reproducer
attributes:
label: python script that produces the error
description: Please copy and paste the code that produces the error. This will be automatically formatted into code, so no need for backticks.
render: python
- type: textarea
id: logs
attributes:
label: Relevant console output
description: Please copy and paste any relevant console output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: checkboxes
id: contribution-guidelines
attributes:
label: Contribution Guidelines
description: By submitting this issue, you agree to follow our [contribution guidelines](https://github.com/sandialabs/OpenCSP/blob/main/CONTRIBUTING.md).
options:
- label: I agree to follow this project's contribution guidelines
required: true
60 changes: 60 additions & 0 deletions .github/ISSUE_TEMPLATE/data-feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Data Feature Request
description: Request a new data feature.
title: "[Data Feature]: "
labels: ["data feature", "under review"]
assignees:
- e10harvey, bbean23, braden6521
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. [email protected]
validations:
required: false
- type: textarea
id: feature-description
attributes:
label: Feature
description: Also, describe the feature you would like.
placeholder: Describe what you want!
validations:
required: true
- type: textarea
id: requirements
attributes:
label: Requirements
description: Also tell us, what are your requirements?
placeholder: As a X, I need to Y, so that I can Z.
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: What OS do you intend to use this on?
multiple: true
options:
- Windows
- Linux
- MacOS
- type: textarea
id: dependencies
attributes:
label: Dependencies
description: Also tell us, what third party dependencies does this feature require?
placeholder: foobar v1000
validations:
required: false
- type: checkboxes
id: contribution-guidelines
attributes:
label: Contribution Guidelines
description: By submitting this issue, you agree to follow our [contribution guidelines](https://github.com/sandialabs/OpenCSP/blob/main/CONTRIBUTING.md).
options:
- label: I agree to follow this project's contribution guidelines
required: true
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Purpose

_Please briefly describe the purpose of this pull request. If this fixes a github issue please include `e.g. fixes #22` so that the issue gets closed automatically when this is merged._

## Summary of changes

_Please summarize the code changes in this pull request._

## Implementation notes

_Please describe any relevant implementation details for reviewers, e.g. how correctness was verified._

## Submission checklist
- [ ] Target branch is `develop`, not `main`
- [ ] Existing tests are updated or new tests were added
- [ ] `opencsp/test/test_DocStringsExist.py` are verified to include this change or have been updated accordingly
- [ ] .rst file(s) under `doc/` are verified to include this change or have been updated accordingly

## Additional information

_Please provide any additional information here._
32 changes: 16 additions & 16 deletions contrib/scripts/sensitive_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _register_file_in_cleared_cache(self, file_path: str, file_name_ext: str):
cache_entry = fc.FileCache.for_file(self.root_search_dir, file_path, file_name_ext)
self.new_cached_cleared_files.append(cache_entry)

def _is_binary_file(self, file_path: str, file_name_ext: str):
def _is_binary_file(self, rel_file_path: str, file_name_ext: str):
is_binary_file = False

# check if a binary file
Expand All @@ -112,34 +112,34 @@ def _is_binary_file(self, file_path: str, file_name_ext: str):
elif self._is_img_ext(ext):
if ext in self._text_file_extensions:
is_binary_file = False
elif (f"{file_path}/{file_name_ext}" in self._text_file_path_name_exts) or (
elif (f"{rel_file_path}/{file_name_ext}" in self._text_file_path_name_exts) or (
file_name_ext in self._text_file_path_name_exts
):
is_binary_file = False
else:
is_binary_file = True
elif ft.file_size(ft.join(file_path, file_name_ext)) > 1e6:
elif ft.file_size(self.norm_path(rel_file_path, file_name_ext)) > 1e6:
# assume any file > 1MB is a binary file, in order to prevent
# sensitive_strings from taking hours to check these files
# needlessly
is_binary_file = True
if not is_binary_file:
# attempt to parse the file as a text file
try:
file_path_norm: str = self.norm_path(file_path, file_name_ext)
file_path_norm: str = self.norm_path(rel_file_path, file_name_ext)
ft.read_text_file(file_path_norm)
except UnicodeDecodeError:
is_binary_file = True

return is_binary_file

def _enqueue_unknown_binary_files_for_later_processing(self, file_path: str, file_name_ext: str):
def _enqueue_unknown_binary_files_for_later_processing(self, rel_file_path: str, file_name_ext: str):
"""If the given file is recognized as an allowed file, and it's fingerprint matches the allowed file, then we
can dismiss it from the list of unfound files and add it to the list of the accepted files.
However, if the given file isn't recognized or it's fingerprint is different, then add it to the unknown list,
to be dealt with later."""
file_ff = ff.FileFingerprint.for_file(self.root_search_dir, file_path, file_name_ext)
file_ff = ff.FileFingerprint.for_file(self.root_search_dir, rel_file_path, file_name_ext)

if file_ff in self.allowed_binary_files:
# we already know and trust this binary file
Expand All @@ -150,11 +150,11 @@ def _enqueue_unknown_binary_files_for_later_processing(self, file_path: str, fil
# we'll deal with unknown files as a group later
self.unknown_binary_files.append(file_ff)

def parse_file(self, file_path: str, file_name_ext: str) -> list[str]:
file_path_norm: str = self.norm_path(file_path, file_name_ext)
def parse_file(self, rel_file_path: str, file_name_ext: str) -> list[str]:
file_path_norm: str = self.norm_path(rel_file_path, file_name_ext)
lt.debug(file_path_norm)

if self._is_binary_file(file_path, file_name_ext):
if self._is_binary_file(rel_file_path, file_name_ext):
return []
else:
return ft.read_text_file(file_path_norm)
Expand Down Expand Up @@ -447,23 +447,23 @@ def search_files(self):
for file_path_name_ext in files:
if self.verbose:
lt.info(f"Searching file {file_path_name_ext}")
file_path, file_name, file_ext = ft.path_components(file_path_name_ext)
rel_file_path, file_name, file_ext = ft.path_components(file_path_name_ext)
file_name_ext = file_name + file_ext
if self._is_file_in_cleared_cache(file_path, file_name_ext):
if self._is_file_in_cleared_cache(rel_file_path, file_name_ext):
# file cleared in a previous run, don't need to check again
self._register_file_in_cleared_cache(file_path, file_name_ext)
self._register_file_in_cleared_cache(rel_file_path, file_name_ext)
else:
# need to check this file
if self._is_binary_file(file_path, file_name_ext):
if self._is_binary_file(rel_file_path, file_name_ext):
# deal with non-parseable binary files as a group, below
self._enqueue_unknown_binary_files_for_later_processing(file_path, file_name_ext)
self._enqueue_unknown_binary_files_for_later_processing(rel_file_path, file_name_ext)
else:
# check text files for sensitive strings
file_matches = self.search_file(file_path, file_name_ext)
file_matches = self.search_file(rel_file_path, file_name_ext)
if len(file_matches) > 0:
matches[file_path_name_ext] = file_matches
else:
self._register_file_in_cleared_cache(file_path, file_name_ext)
self._register_file_in_cleared_cache(rel_file_path, file_name_ext)

# Potentially remove unfound binary files
if len(self.unfound_allowed_binary_files) > 0 and self.remove_unfound_binaries:
Expand Down
Loading

0 comments on commit 595d9dd

Please sign in to comment.