Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hpc-compendium
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ZIH
hpcsupport
hpc-compendium
Commits
c68ce755
Commit
c68ce755
authored
2 years ago
by
Jan Frenzel
Browse files
Options
Downloads
Patches
Plain Diff
Removed debug statements in check-code-style.sh.
parent
7223b44e
No related branches found
No related tags found
2 merge requests
!673
Automated merge from preview to main
,
!655
Resolve "Lint test scripts in doc.zih.tu-dresden.de/util"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc.zih.tu-dresden.de/util/check-code-style.sh
+2
-9
2 additions, 9 deletions
doc.zih.tu-dresden.de/util/check-code-style.sh
with
2 additions
and
9 deletions
doc.zih.tu-dresden.de/util/check-code-style.sh
+
2
−
9
View file @
c68ce755
...
@@ -51,7 +51,7 @@ function style_check() {
...
@@ -51,7 +51,7 @@ function style_check() {
# If shell script is provided
# If shell script is provided
test_res_count
=
$(
grep
-cP
"
${
pattern
}
"
$myfile
||
true
)
test_res_count
=
$(
grep
-cP
"
${
pattern
}
"
$myfile
||
true
)
if
[[
"
${
test_res_count
}
"
-gt
"0"
]]
;
then
if
[[
"
${
test_res_count
}
"
-gt
"0"
]]
;
then
echo
-e
"[WARNING]
${
warning
}
"
#\nThis coding style was not used for following lines:"
echo
-e
"[WARNING]
${
warning
}
"
echo
"[WARNING] This coding style was not used for following lines in file
$(
realpath
${
myfile
}
)
:"
echo
"[WARNING] This coding style was not used for following lines in file
$(
realpath
${
myfile
}
)
:"
grep
-nP
"
${
pattern
}
"
$myfile
grep
-nP
"
${
pattern
}
"
$myfile
echo
""
echo
""
...
@@ -70,7 +70,7 @@ function style_check() {
...
@@ -70,7 +70,7 @@ function style_check() {
test_res_count
=
"
$(
echo
"
${
test_string
}
"
|
grep
-cnP
"
${
pattern
}
"
)
"
test_res_count
=
"
$(
echo
"
${
test_string
}
"
|
grep
-cnP
"
${
pattern
}
"
)
"
fi
fi
if
[[
"
${
test_res_count
}
"
-gt
"0"
]]
;
then
if
[[
"
${
test_res_count
}
"
-gt
"0"
]]
;
then
echo
-e
"[WARNING]
${
warning
}
"
# This coding style was not used for following lines:"
echo
-e
"[WARNING]
${
warning
}
"
echo
"[WARNING] This coding style was not used for following lines in file
$(
realpath
${
myfile
}
)
:"
echo
"[WARNING] This coding style was not used for following lines in file
$(
realpath
${
myfile
}
)
:"
grep
-no
-F
"
$(
echo
"
${
test_string
}
"
|
grep
-P
"
${
pattern
}
"
)
"
"
${
myfile
}
"
grep
-no
-F
"
$(
echo
"
${
test_string
}
"
|
grep
-P
"
${
pattern
}
"
)
"
"
${
myfile
}
"
echo
""
echo
""
...
@@ -102,23 +102,18 @@ if [ $# -eq 1 ]; then
...
@@ -102,23 +102,18 @@ if [ $# -eq 1 ]; then
-a
|
--all
)
-a
|
--all
)
echo
"Checking in all files."
echo
"Checking in all files."
files
=
$(
find
$basedir
-name
'*.md'
-o
-name
'*.sh'
)
files
=
$(
find
$basedir
-name
'*.md'
-o
-name
'*.sh'
)
#file_num=$(find $basedir -name '*.md' -o -name '*.sh' | wc -l) #For debugging
;;
;;
*
)
*
)
files
=
"
$1
"
files
=
"
$1
"
file_num
=
1
;;
;;
esac
esac
elif
[
$#
-eq
0
]
;
then
elif
[
$#
-eq
0
]
;
then
echo
"Search in git-changed files."
echo
"Search in git-changed files."
files
=
`
git diff
--name-only
"
$(
git merge-base HEAD
"
$branch
"
)
"
|
grep
-e
'.md$'
-e
'.sh$'
||
true
`
files
=
`
git diff
--name-only
"
$(
git merge-base HEAD
"
$branch
"
)
"
|
grep
-e
'.md$'
-e
'.sh$'
||
true
`
#For debugging
#file_num=$(git diff --name-only "$(git merge-base HEAD "$branch")" | grep -c -e '.md$' -e '.sh$' || true)
else
else
usage
usage
fi
fi
#counter=0 #For debugging
any_fails
=
false
any_fails
=
false
for
file
in
$files
;
do
for
file
in
$files
;
do
...
@@ -189,8 +184,6 @@ for file in $files; do
...
@@ -189,8 +184,6 @@ for file in $files; do
if
style_check
"
${
file
}
"
"
${
pattern
}
"
"
${
warning
}
"
;
then
if
style_check
"
${
file
}
"
"
${
pattern
}
"
"
${
warning
}
"
;
then
any_fails
=
true
any_fails
=
true
fi
fi
#((counter=counter+1)) #For debugging
#echo -e "Checked ${counter}/${file_num} files\n" #For debugging
done
done
if
[[
"
${
any_fails
}
"
==
true
]]
;
then
if
[[
"
${
any_fails
}
"
==
true
]]
;
then
exit
1
exit
1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment