Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
OpenXG-RAN
Commits
f3cd2c9a
Commit
f3cd2c9a
authored
Aug 22, 2022
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove astyle
parent
e87dd85d
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
57 additions
and
262 deletions
+57
-262
ci-scripts/Jenkinsfile-gitlab
ci-scripts/Jenkinsfile-gitlab
+1
-14
ci-scripts/astyle-options.txt
ci-scripts/astyle-options.txt
+0
-26
ci-scripts/checkCodingFormattingRules.sh
ci-scripts/checkCodingFormattingRules.sh
+4
-22
ci-scripts/cls_static_code_analysis.py
ci-scripts/cls_static_code_analysis.py
+0
-14
ci-scripts/docker/Dockerfile.formatting.bionic
ci-scripts/docker/Dockerfile.formatting.bionic
+0
-4
ci-scripts/reportBuildLocally.sh
ci-scripts/reportBuildLocally.sh
+52
-83
cmake_targets/tools/indent_source_code
cmake_targets/tools/indent_source_code
+0
-68
pre-commit
pre-commit
+0
-31
No files found.
ci-scripts/Jenkinsfile-gitlab
View file @
f3cd2c9a
...
@@ -111,17 +111,7 @@ pipeline {
...
@@ -111,17 +111,7 @@ pipeline {
sh
"./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
sh
"./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
sh
"zip -r -qq localZip.zip ."
sh
"zip -r -qq localZip.zip ."
// Running astyle options on the list of modified files by the merge request
// here was an astyle formatting check, with corresponding messages. The same could be done with clang-format
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
sh
"./ci-scripts/checkCodingFormattingRules.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}"
def
res
=
readFile
(
'./oai_rules_result.txt'
).
trim
();
if
(
"0"
.
equals
(
res
))
{
def
message
=
"OAI "
+
JOB_NAME
+
" build ("
+
BUILD_ID
+
"): All Changed files in Merge Request follow OAI Formatting Rules"
addGitLabMRComment
comment:
message
}
else
{
def
message
=
"OAI "
+
JOB_NAME
+
" build ("
+
BUILD_ID
+
"): Some Changed files in Merge Request DO NOT follow OAI Formatting Rules"
addGitLabMRComment
comment:
message
}
}
else
{
}
else
{
echo
"Git Branch is ${GIT_BRANCH}"
echo
"Git Branch is ${GIT_BRANCH}"
echo
"Git Commit is ${GIT_COMMIT}"
echo
"Git Commit is ${GIT_COMMIT}"
...
@@ -132,9 +122,6 @@ pipeline {
...
@@ -132,9 +122,6 @@ pipeline {
sh
"git log -n1 --pretty=format:\"%s\" > .git/CI_COMMIT_MSG"
sh
"git log -n1 --pretty=format:\"%s\" > .git/CI_COMMIT_MSG"
sh
"zip -r -qq localZip.zip ."
sh
"zip -r -qq localZip.zip ."
// Running astyle options on all C/H files in the repository
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
sh
"./ci-scripts/checkCodingFormattingRules.sh"
}
}
}
}
}
}
...
...
ci-scripts/astyle-options.txt
deleted
100644 → 0
View file @
e87dd85d
# OAI is using a style that is similar to the Google style
--style=google
# long options can be written without the preceding '--'
# Convert tabs to spaces
convert-tabs
# Indentation is 2 spaces
indent=spaces=2
# Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block.
indent-switches
# Indent preprocessor blocks at bracket level 0.
indent-preproc-block
# Indent multi-line preprocessor #define statements.
indent-preproc-define
# Indent C++ comments beginning in column one.
indent-col1-comments
# Pad empty lines around header blocks
break-blocks
delete-empty-lines
# Attach a pointer or reference operator (*, &, or ^) to the variable name (right)
align-pointer=name
# The code line length is 200 characters/columns (this is the maximum allowed by astyle)
max-code-length=200
# If the line contains logical conditionals they will be placed first on the new line.
break-after-logical
# Force use of the linux end of line
lineend=linux
ci-scripts/checkCodingFormattingRules.sh
View file @
f3cd2c9a
...
@@ -24,8 +24,6 @@ function usage {
...
@@ -24,8 +24,6 @@ function usage {
echo
"OAI Coding / Formatting Guideline Check script"
echo
"OAI Coding / Formatting Guideline Check script"
echo
" Original Author: Raphael Defosseux"
echo
" Original Author: Raphael Defosseux"
echo
""
echo
""
echo
" Requirement: astyle shall be installed"
echo
""
echo
" By default (no options) the complete repository will be checked"
echo
" By default (no options) the complete repository will be checked"
echo
" In case of merge request, provided source and target branch,"
echo
" In case of merge request, provided source and target branch,"
echo
" the script will check only the modified files"
echo
" the script will check only the modified files"
...
@@ -57,11 +55,10 @@ fi
...
@@ -57,11 +55,10 @@ fi
if
[
$#
-eq
0
]
if
[
$#
-eq
0
]
then
then
echo
" ---- Checking the whole repository ----"
# in this file we previously had a list of files that were not properly
echo
""
# formatted. At the time of this MR, the Jenkinsfile expects this file, so
NB_FILES_TO_FORMAT
=
`
astyle
--dry-run
--options
=
ci-scripts/astyle-options.txt
--recursive
--exclude
=
ci-scripts
--exclude
=
cmake_targets
*
.c
*
.h |
grep
-c
Formatted
||
true
`
# we simply produce an empty one
echo
"Nb Files that do NOT follow OAI rules:
$NB_FILES_TO_FORMAT
"
touch
./oai_rules_result.txt
echo
$NB_FILES_TO_FORMAT
>
./oai_rules_result.txt
# Testing Circular Dependencies protection
# Testing Circular Dependencies protection
awk
'/#[ \t]*ifndef/ { gsub("^.*ifndef *",""); if (names[$1]!="") print "files with same {define ", FILENAME, names[$1]; names[$1]=FILENAME } /#[ \t]*define/ { gsub("^.*define *",""); if(names[$1]!=FILENAME) print "error in declaration", FILENAME, $1, names[$1]; nextfile }'
`
find openair
*
common targets executables
-name
*
.h |grep
-v
LFDS
`
>
header-files-w-incorrect-define.txt
awk
'/#[ \t]*ifndef/ { gsub("^.*ifndef *",""); if (names[$1]!="") print "files with same {define ", FILENAME, names[$1]; names[$1]=FILENAME } /#[ \t]*define/ { gsub("^.*define *",""); if(names[$1]!=FILENAME) print "error in declaration", FILENAME, $1, names[$1]; nextfile }'
`
find openair
*
common targets executables
-name
*
.h |grep
-v
LFDS
`
>
header-files-w-incorrect-define.txt
...
@@ -151,10 +148,6 @@ echo ""
...
@@ -151,10 +148,6 @@ echo ""
# Retrieve the list of modified files since the latest develop commit
# Retrieve the list of modified files since the latest develop commit
MODIFIED_FILES
=
`
git log
$TARGET_INIT_COMMIT
..
$MERGE_COMMMIT
--oneline
--name-status
| egrep
"^M|^A"
|
sed
-e
"s@^M
\t
*@@"
-e
"s@^A
\t
*@@"
|
sort
|
uniq
`
MODIFIED_FILES
=
`
git log
$TARGET_INIT_COMMIT
..
$MERGE_COMMMIT
--oneline
--name-status
| egrep
"^M|^A"
|
sed
-e
"s@^M
\t
*@@"
-e
"s@^A
\t
*@@"
|
sort
|
uniq
`
NB_TO_FORMAT
=
0
NB_TO_FORMAT
=
0
if
[
-f
oai_rules_result_list.txt
]
then
rm
-f
oai_rules_result_list.txt
fi
if
[
-f
header-files-w-incorrect-define.txt
]
if
[
-f
header-files-w-incorrect-define.txt
]
then
then
rm
-f
header-files-w-incorrect-define.txt
rm
-f
header-files-w-incorrect-define.txt
...
@@ -178,13 +171,6 @@ do
...
@@ -178,13 +171,6 @@ do
EXT
=
"
${
filename
##*.
}
"
EXT
=
"
${
filename
##*.
}
"
if
[
$EXT
=
"c"
]
||
[
$EXT
=
"h"
]
||
[
$EXT
=
"cpp"
]
||
[
$EXT
=
"hpp"
]
if
[
$EXT
=
"c"
]
||
[
$EXT
=
"h"
]
||
[
$EXT
=
"cpp"
]
||
[
$EXT
=
"hpp"
]
then
then
TO_FORMAT
=
`
astyle
--dry-run
--options
=
ci-scripts/astyle-options.txt
$FULLFILE
|
grep
-c
Formatted
||
true
`
NB_TO_FORMAT
=
$((
NB_TO_FORMAT
+
TO_FORMAT
))
if
[
$TO_FORMAT
-ne
0
]
then
echo
$FULLFILE
echo
$FULLFILE
>>
./oai_rules_result_list.txt
fi
# Testing if explicit GNU GPL license banner
# Testing if explicit GNU GPL license banner
GNU_EXCEPTION
=
`
echo
$FULLFILE
| egrep
-c
"openair3/NAS/COMMON/milenage.h"
||
true
`
GNU_EXCEPTION
=
`
echo
$FULLFILE
| egrep
-c
"openair3/NAS/COMMON/milenage.h"
||
true
`
if
[
$GNU_EXCEPTION
-eq
0
]
if
[
$GNU_EXCEPTION
-eq
0
]
...
@@ -215,9 +201,5 @@ do
...
@@ -215,9 +201,5 @@ do
fi
fi
done
done
rm
-f
header-files-w-incorrect-define-tmp.txt
rm
-f
header-files-w-incorrect-define-tmp.txt
echo
""
echo
" ----------------------------------------------------------"
echo
"Nb Files that do NOT follow OAI rules:
$NB_TO_FORMAT
"
echo
$NB_TO_FORMAT
>
./oai_rules_result.txt
exit
0
exit
0
ci-scripts/cls_static_code_analysis.py
View file @
f3cd2c9a
...
@@ -321,20 +321,6 @@ class StaticCodeAnalysis():
...
@@ -321,20 +321,6 @@ class StaticCodeAnalysis():
if
ret
is
not
None
:
if
ret
is
not
None
:
analyzed
=
True
analyzed
=
True
if
analyzed
:
if
analyzed
:
ret
=
re
.
search
(
'Nb Files that do NOT follow OAI rules: (?P<nb_errors>[0-9\.]+)'
,
str
(
line
))
if
ret
is
not
None
:
nbFilesNotFormatted
=
int
(
ret
.
group
(
'nb_errors'
))
if
re
.
search
(
'=== Files not properly formatted ==='
,
str
(
line
))
is
not
None
:
listFiles
=
True
if
listFiles
:
if
re
.
search
(
'Removing intermediate container'
,
str
(
line
))
is
not
None
:
listFiles
=
False
elif
re
.
search
(
'Running in|Files not properly formatted'
,
str
(
line
))
is
not
None
:
pass
else
:
listFilesNotFormatted
.
append
(
str
(
line
).
strip
())
if
re
.
search
(
'=== Files with incorrect define protection ==='
,
str
(
line
))
is
not
None
:
if
re
.
search
(
'=== Files with incorrect define protection ==='
,
str
(
line
))
is
not
None
:
circularHeaderDependency
=
True
circularHeaderDependency
=
True
if
circularHeaderDependency
:
if
circularHeaderDependency
:
...
...
ci-scripts/docker/Dockerfile.formatting.bionic
View file @
f3cd2c9a
...
@@ -8,7 +8,6 @@ ENV DEBIAN_FRONTEND=noninteractive
...
@@ -8,7 +8,6 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
astyle \
gawk \
gawk \
git
git
...
@@ -18,9 +17,6 @@ COPY . .
...
@@ -18,9 +17,6 @@ COPY . .
RUN /bin/bash -c "if [[ -v MERGE_REQUEST ]]; then echo 'Source Branch = $SRC_BRANCH'; echo 'Target Branch = $TARGET_BRANCH'; else echo 'Push to develop'; fi"
RUN /bin/bash -c "if [[ -v MERGE_REQUEST ]]; then echo 'Source Branch = $SRC_BRANCH'; echo 'Target Branch = $TARGET_BRANCH'; else echo 'Push to develop'; fi"
RUN /bin/bash -c "if [[ -v MERGE_REQUEST ]]; then ./ci-scripts/checkCodingFormattingRules.sh --src-branch $SRC_BRANCH --target-branch $TARGET_BRANCH; else ./ci-scripts/checkCodingFormattingRules.sh; fi"
RUN /bin/bash -c "if [[ -v MERGE_REQUEST ]]; then ./ci-scripts/checkCodingFormattingRules.sh --src-branch $SRC_BRANCH --target-branch $TARGET_BRANCH; else ./ci-scripts/checkCodingFormattingRules.sh; fi"
RUN echo "=== Files not properly formatted ===" && \
/bin/bash -c "if [[ -f oai_rules_result_list.txt ]]; then cat oai_rules_result_list.txt; fi"
RUN echo "=== Files with incorrect define protection ===" && \
RUN echo "=== Files with incorrect define protection ===" && \
/bin/bash -c "if [[ -f header-files-w-incorrect-define.txt ]]; then cat header-files-w-incorrect-define.txt; fi"
/bin/bash -c "if [[ -f header-files-w-incorrect-define.txt ]]; then cat header-files-w-incorrect-define.txt; fi"
...
...
ci-scripts/reportBuildLocally.sh
View file @
f3cd2c9a
This diff is collapsed.
Click to expand it.
cmake_targets/tools/indent_source_code
deleted
100755 → 0
View file @
e87dd85d
#!/bin/bash
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# file indent_source_code
# brief
# author Lionel Gauthier
# company Eurecom
# email: lionel.gauthier@eurecom.fr
#
################################
# include helper functions
################################
THIS_SCRIPT_PATH
=
$(
dirname
$(
readlink
-f
$0
))
source
$THIS_SCRIPT_PATH
/build_helper
function
main
()
{
local
MAX_CODE_LENGTH
=
200
local
INDENT_SPACES
=
2
set_openair_env
# remove trailing white spaces
#find $OPENAIR_DIR/openair1 -type f \( -name '*.c' -o -name '*.h' \) -exec sed --in-place 's/[[:space:]]\+$//' {} \+
#find $OPENAIR_DIR/openair2 -type f \( -name '*.c' -o -name '*.h' \) -exec sed --in-place 's/[[:space:]]\+$//' {} \+
#find $OPENAIR_DIR/openair3 -type f \( -name '*.c' -o -name '*.h' \) -exec sed --in-place 's/[[:space:]]\+$//' {} \+
#find $OPENAIR_DIR/openair3 -type f \( -name '*.c' -o -name '*.h' \) -exec sed --in-place 's/[[:space:]]\+$//' {} \+
#find $OPENAIR_DIR/targets -type f \( -name '*.c' -o -name '*.h' \) -exec sed --in-place 's/[[:space:]]\+$//' {} \+
# Style google not available on 14.04
exit
0
# will use indent
command
-v
astyle
>
/dev/null 2>&1
||
{
echo
>
&2
"astyle required but it's not installed."
;
sudo
apt-get
install
astyle
;
}
astyle
--recursive
--convert-tabs
--indent
=
spaces
=
$INDENT_SPACES
--style
=
kr
--indent-col1-comments
--max-code-length
=
$MAX_CODE_LENGTH
\
$OPENAIR_DIR
/openair1/
*
.h
\
$OPENAIR_DIR
/openair1/
*
.c
\
$OPENAIR_DIR
/openair2/
*
.h
\
$OPENAIR_DIR
/openair2/
*
.c
\
$OPENAIR_DIR
/openair3/
*
.h
\
$OPENAIR_DIR
/openair3/
*
.c
\
$OPENAIR_DIR
/openair3/
*
.h
\
$OPENAIR_DIR
/openair3/
*
.c
\
$OPENAIR_DIR
/targets/
*
.h
\
$OPENAIR_DIR
/targets/
*
.c
}
main
"
$@
"
pre-commit
deleted
100644 → 0
View file @
e87dd85d
#!/bin/bash
# Installation:
# cp pre-commit .git/hooks
# chmod +x .git/hooks/pre-commit
OPTIONS
=
"--options=ci-scripts/astyle-options.txt"
RETURN
=
0
ASTYLE
=
$(
which astyle
)
if
[
$?
-ne
0
]
;
then
echo
"[!] astyle not installed. Unable to check source file format policy."
>
&2
exit
1
fi
FILES
=
`
git diff
--cached
--name-only
--diff-filter
=
ACMR |
grep
-E
"
\.
(c|cpp|h)$"
`
for
FILE
in
$FILES
;
do
$ASTYLE
$OPTIONS
<
$FILE
| cmp
-s
$FILE
-
if
[
$?
-ne
0
]
;
then
echo
"[!]
$FILE
does not respect the agreed coding style."
>
&2
RETURN
=
1
fi
done
if
[
$RETURN
-eq
1
]
;
then
echo
""
>
&2
echo
"Make sure you have run astyle with the following options:"
>
&2
echo
$OPTIONS
>
&2
fi
exit
$RETURN
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment