Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
de2c6df2
Commit
de2c6df2
authored
Dec 13, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check-style.sh: check for accidentally committed CRLF line endings
parent
3f1ff3f4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
+24
-10
tools/check-style.sh
+24
-10
No files found.
tools/check-style.sh
View file @
de2c6df2
...
...
@@ -5,11 +5,12 @@
# This script currently checks for
#
# 1. use of tabs instead of spaces
# 2. trailing spaces
# 3. missing space between keyword and parenthesis, e.g.: for(, if(, while(
# 4. opening brace on its own line. It should always be on the same line as the
# if/while/for/do statment.
# 2. MSDOS-style CRLF endings
# 3. trailing spaces
# 4. missing space between keyword and parenthesis, e.g.: for(, if(, while(
# 5. Missing space between right parenthesis and brace, e.g. 'for (...){'
# 6. opening brace on its own line. It should always be on the same line as the
# if/while/for/do statment.
#
# Invoke as: tools/check-style.sh
#
...
...
@@ -30,11 +31,11 @@ while read -u 3 f; do
done
found
=
# The mt=41 sets a red background for matched
trailing space
s
exec
3< <
(
GREP_COLORS
=
'mt=41'
grep
'\s\+$'
include/ tests/
*
.
{
cpp,py,h
}
docs/
*
.rst
-rn
--color
=
always
)
# The mt=41 sets a red background for matched
MS-DOS CRLF line ending
s
exec
3< <
(
GREP_COLORS
=
'mt=41'
grep
-IUlr
$'
\r
'
include/ tests/
*
.
{
cpp,py,h
}
docs/
*
.rst
--color
=
always
)
while
read
-u
3 f
;
do
if
[
-z
"
$found
"
]
;
then
echo
-e
'\e[31m\e[01mError: found
trailing space
s in the following files:\e[0m'
echo
-e
'\e[31m\e[01mError: found
CRLF character
s in the following files:\e[0m'
found
=
1
errors
=
1
fi
...
...
@@ -43,10 +44,11 @@ while read -u 3 f; do
done
found
=
exec
3< <
(
GREP_COLORS
=
'mt=41'
grep
'^\s*{\s*$'
include/ docs/
*
.rst
-rn
--color
=
always
)
# The mt=41 sets a red background for matched trailing spaces
exec
3< <
(
GREP_COLORS
=
'mt=41'
grep
'\s\+$'
include/ tests/
*
.
{
cpp,py,h
}
docs/
*
.rst
-rn
--color
=
always
)
while
read
-u
3 f
;
do
if
[
-z
"
$found
"
]
;
then
echo
-e
'\e[31m\e[01mError:
braces should occur on the same line as the if/while/.. statement. Found issues in the following files:
\e[0m'
echo
-e
'\e[31m\e[01mError:
found trailing spaces in the following files:
\e[0m'
found
=
1
errors
=
1
fi
...
...
@@ -55,7 +57,7 @@ while read -u 3 f; do
done
found
=
exec
3< <
(
grep
'\<\(if\|for\|while\)(\|){'
include/ tests/
*
.
{
cpp,py,h
}
-rn
--color
=
always
)
exec
3< <
(
grep
'\<\(if\|for\|while\
|catch\
)(\|){'
include/ tests/
*
.
{
cpp,py,h
}
-rn
--color
=
always
)
while
read
-u
3 line
;
do
if
[
-z
"
$found
"
]
;
then
echo
-e
'\e[31m\e[01mError: found the following coding style problems:\e[0m'
...
...
@@ -66,4 +68,16 @@ while read -u 3 line; do
echo
"
$line
"
done
found
=
exec
3< <
(
GREP_COLORS
=
'mt=41'
grep
'^\s*{\s*$'
include/ docs/
*
.rst
-rn
--color
=
always
)
while
read
-u
3 f
;
do
if
[
-z
"
$found
"
]
;
then
echo
-e
'\e[31m\e[01mError: braces should occur on the same line as the if/while/.. statement. Found issues in the following files: \e[0m'
found
=
1
errors
=
1
fi
echo
"
$f
"
done
exit
$errors
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