Skip to content

Commit 6bdece4

Browse files
authored
chore(deps): bump fabasoad/pre-commit-grype from 0.6.3 to 0.6.4 (#61)
<!-- markdownlint-disable-file MD041 --> ## Pull request checklist Please check if your PR fulfills the following requirements: - [ ] I have read the [CONTRIBUTING](https://github.com/fabasoad/pre-commit-snyk/blob/main/CONTRIBUTING.md) doc. - [ ] Tests for the changes have been added (for bug fixes / features). - [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features). ## Pull request type <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type, submit multiple pull requests if needed. --> Please check the type of change your PR introduces: - [ ] Bugfix - [ ] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. --> ## What is the new behavior <!-- Please describe the behavior or changes that are being added by this PR. --> - - - ## Does this introduce a breaking change - [ ] Yes - [ ] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> <!-- This document was adapted from the open-source [appium/appium](https://github.com/appium/appium/blob/master/.github/PULL_REQUEST_TEMPLATE.md) repository. --> --- Closes #{IssueNumber}
1 parent 50dbf6c commit 6bdece4

3 files changed

Lines changed: 41 additions & 16 deletions

File tree

.github/workflows/functional-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ defaults:
2020
run:
2121
shell: sh
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
functional-tests-all:
2528
name: All

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ repos:
3838
hooks:
3939
- id: gitleaks
4040
- repo: https://github.com/fabasoad/pre-commit-grype
41-
rev: v0.6.3
41+
rev: v0.6.4
4242
hooks:
4343
- id: grype-dir
4444
args:

src/.bpkg/bin/fabasoad-log

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ _fabasoad_log_init() {
6060
_fabasoad_wrap_text_with_color() {
6161
log_line="${1}"
6262
level="${2}"
63-
if [ "${FABASOAD_LOG_CONFIG_TEXT_COLOR}" = "true" ]; then
63+
if [ "${FABASOAD_LOG_CONFIG_TEXT_COLOR:-${FABASOAD_LOG_CONFIG_TEXT_COLOR_DEFAULT}}" = "true" ]; then
6464
if [ "${level}" = "error" ]; then
6565
printf "\033[91m${log_line}\033[0m"
6666
elif [ "${level}" = "warning" ]; then
@@ -76,7 +76,7 @@ _fabasoad_wrap_text_with_color() {
7676
}
7777

7878
_fabasoad_wrap_text_with_bold() {
79-
if [ "${FABASOAD_LOG_CONFIG_TEXT_COLOR}" = "true" ]; then
79+
if [ "${FABASOAD_LOG_CONFIG_TEXT_COLOR:-${FABASOAD_LOG_CONFIG_TEXT_COLOR_DEFAULT}}" = "true" ]; then
8080
echo "\033[1m${1}\033[22m"
8181
else
8282
echo "${1}"
@@ -86,7 +86,7 @@ _fabasoad_wrap_text_with_bold() {
8686
# Log level
8787

8888
_fabasoad_is_printing_error_ok() {
89-
log_level="${FABASOAD_LOG_CONFIG_LOG_LEVEL}"
89+
log_level="${FABASOAD_LOG_CONFIG_LOG_LEVEL:-${FABASOAD_LOG_CONFIG_LOG_LEVEL_DEFAULT}}"
9090
if [ "${log_level}" != "off" ]; then
9191
echo "true"
9292
else
@@ -95,7 +95,7 @@ _fabasoad_is_printing_error_ok() {
9595
}
9696

9797
_fabasoad_is_printing_warning_ok() {
98-
log_level="${FABASOAD_LOG_CONFIG_LOG_LEVEL}"
98+
log_level="${FABASOAD_LOG_CONFIG_LOG_LEVEL:-${FABASOAD_LOG_CONFIG_LOG_LEVEL_DEFAULT}}"
9999
if [ "${log_level}" != "off" ] && [ "${log_level}" != "error" ]; then
100100
echo "true"
101101
else
@@ -104,7 +104,7 @@ _fabasoad_is_printing_warning_ok() {
104104
}
105105

106106
_fabasoad_is_printing_info_ok() {
107-
log_level="${FABASOAD_LOG_CONFIG_LOG_LEVEL}"
107+
log_level="${FABASOAD_LOG_CONFIG_LOG_LEVEL:-${FABASOAD_LOG_CONFIG_LOG_LEVEL_DEFAULT}}"
108108
if [ "${log_level}" = "debug" ] || [ "${log_level}" = "info" ]; then
109109
echo "true"
110110
else
@@ -113,7 +113,7 @@ _fabasoad_is_printing_info_ok() {
113113
}
114114

115115
_fabasoad_is_printing_debug_ok() {
116-
log_level="${FABASOAD_LOG_CONFIG_LOG_LEVEL}"
116+
log_level="${FABASOAD_LOG_CONFIG_LOG_LEVEL:-${FABASOAD_LOG_CONFIG_LOG_LEVEL_DEFAULT}}"
117117
if [ "${log_level}" = "debug" ]; then
118118
echo "true"
119119
else
@@ -142,9 +142,9 @@ _fabasoad_log_text() {
142142
level="${1}"
143143
message="${2}"
144144

145-
text_msg="${FABASOAD_LOG_CONFIG_TEXT_FORMAT}"
146-
text_msg=${text_msg/<header>/${FABASOAD_LOG_CONFIG_HEADER}}
147-
text_msg=${text_msg/<timestamp>/$(date +"${FABASOAD_LOG_CONFIG_DATE_FORMAT}")}
145+
text_msg="${FABASOAD_LOG_CONFIG_TEXT_FORMAT:-${FABASOAD_LOG_CONFIG_TEXT_FORMAT_DEFAULT}}"
146+
text_msg=${text_msg/<header>/${FABASOAD_LOG_CONFIG_HEADER:-${FABASOAD_LOG_CONFIG_HEADER_DEFAULT}}}
147+
text_msg=${text_msg/<timestamp>/$(date +"${FABASOAD_LOG_CONFIG_DATE_FORMAT:-${FABASOAD_LOG_CONFIG_DATE_FORMAT_DEFAULT}}")}
148148
text_msg=${text_msg/<level>/$(_fabasoad_wrap_text_with_bold "${level}")}
149149
text_msg=${text_msg/<message>/${message}}
150150

@@ -153,9 +153,12 @@ _fabasoad_log_text() {
153153
}
154154

155155
_fabasoad_log_json() {
156+
timestamp="$(date +"${FABASOAD_LOG_CONFIG_DATE_FORMAT:-${FABASOAD_LOG_CONFIG_DATE_FORMAT_DEFAULT}}")"
157+
header="${FABASOAD_LOG_CONFIG_HEADER:-${FABASOAD_LOG_CONFIG_HEADER_DEFAULT}}"
158+
156159
json_msg=$(jq -cn \
157-
--arg timestamp "$(date +"${FABASOAD_LOG_CONFIG_DATE_FORMAT}")" \
158-
--arg header "${FABASOAD_LOG_CONFIG_HEADER}" \
160+
--arg timestamp "${timestamp}" \
161+
--arg header "${header}" \
159162
--arg level "${1}" \
160163
--arg message "${2}" \
161164
'{
@@ -173,8 +176,8 @@ _fabasoad_log_xml() {
173176
message="${2}"
174177

175178
xml_msg="<log>"
176-
xml_msg="${xml_msg}<timestamp>$(date +"${FABASOAD_LOG_CONFIG_DATE_FORMAT}")</timestamp>"
177-
xml_msg="${xml_msg}<header>${FABASOAD_LOG_CONFIG_HEADER}</header>"
179+
xml_msg="${xml_msg}<timestamp>$(date +"${FABASOAD_LOG_CONFIG_DATE_FORMAT:-${FABASOAD_LOG_CONFIG_DATE_FORMAT_DEFAULT}}")</timestamp>"
180+
xml_msg="${xml_msg}<header>${FABASOAD_LOG_CONFIG_HEADER:-${FABASOAD_LOG_CONFIG_HEADER_DEFAULT}}</header>"
178181
xml_msg="${xml_msg}<level>${level}</level>"
179182
xml_msg="${xml_msg}<message>${message}</message>"
180183
xml_msg="${xml_msg}</log>"
@@ -194,8 +197,27 @@ _fabasoad_log_xml() {
194197
# fabasoad_log "error" "This is error message"
195198
# fabasoad_log "debug" "This is debug message" "./config.json"
196199
fabasoad_log() {
197-
_fabasoad_log_init "${3:-""}"
198-
_fabasoad_log_${FABASOAD_LOG_CONFIG_OUTPUT_FORMAT} "${1}" "${2}"
200+
level="${1}"
201+
message="${2}"
202+
config_path="${3:-""}"
203+
204+
if [ -f "${config_path}" ]; then
205+
_fabasoad_log_init "${config_path}"
206+
fi
207+
208+
case "${FABASOAD_LOG_CONFIG_OUTPUT_FORMAT:-${FABASOAD_LOG_CONFIG_OUTPUT_FORMAT_DEFAULT}}" in
209+
"xml")
210+
log_func="_fabasoad_log_xml"
211+
;;
212+
"json")
213+
log_func="_fabasoad_log_json"
214+
;;
215+
*)
216+
log_func="_fabasoad_log_text"
217+
;;
218+
esac
219+
220+
${log_func} "${level}" "${message}"
199221
}
200222

201223
# export

0 commit comments

Comments
 (0)