Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
testoPipelino
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fadi Imani
testoPipelino
Commits
058426e4
Commit
058426e4
authored
1 year ago
by
Fadi Imani
Browse files
Options
Downloads
Patches
Plain Diff
big project
parent
f714756a
No related branches found
No related tags found
No related merge requests found
Pipeline
#40556
failed
1 year ago
Stage: lint
Stage: build
Stage: test
Stage: coverage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
run-clang-format.py
+9
-9
9 additions, 9 deletions
run-clang-format.py
with
9 additions
and
9 deletions
run-clang-format.py
+
9
−
9
View file @
058426e4
...
...
@@ -43,7 +43,7 @@ class ExitStatus:
def
excludes_from_file
(
ignore_file
):
excludes
=
[]
try
:
with
io
.
open
(
ignore_file
,
'
r
'
,
encoding
=
'
utf-8
'
)
as
f
:
with
io
.
open
(
ignore_file
,
'
r
'
,
encoding
=
'
ISO-8859-1
'
)
as
f
:
for
line
in
f
:
if
line
.
startswith
(
'
#
'
):
# ignore comments
...
...
@@ -126,24 +126,24 @@ def run_clang_format_diff_wrapper(args, file):
def
run_clang_format_diff
(
args
,
file
):
try
:
with
io
.
open
(
file
,
'
r
'
,
encoding
=
'
utf-8
'
)
as
f
:
with
io
.
open
(
file
,
'
r
'
,
encoding
=
'
ISO-8859-1
'
)
as
f
:
original
=
f
.
readlines
()
except
IOError
as
exc
:
raise
DiffError
(
str
(
exc
))
invocation
=
[
args
.
clang_format_executable
,
file
]
# Use of
utf-8
to decode the process output.
# Use of
ISO-8859-1
to decode the process output.
#
# Hopefully, this is the correct thing to do.
#
# It's done due to the following assumptions (which may be incorrect):
# - clang-format will returns the bytes read from the files as-is,
# without conversion, and it is already assumed that the files use
utf-8
.
# - if the diagnostics were internationalized, they would use
utf-8
:
# without conversion, and it is already assumed that the files use
ISO-8859-1
.
# - if the diagnostics were internationalized, they would use
ISO-8859-1
:
# > Adding Translations to Clang
# >
# > Not possible yet!
# > Diagnostic strings should be written in
UTF-8
,
# > Diagnostic strings should be written in
ISO-8859-1
,
# > the client can translate to the relevant code page if needed.
# > Each translation completely replaces the format string
# > for the diagnostic.
...
...
@@ -152,7 +152,7 @@ def run_clang_format_diff(args, file):
# It's not pretty, due to Python 2 & 3 compatibility.
encoding_py3
=
{}
if
sys
.
version_info
[
0
]
>=
3
:
encoding_py3
[
'
encoding
'
]
=
'
utf-8
'
encoding_py3
[
'
encoding
'
]
=
'
ISO-8859-1
'
try
:
proc
=
subprocess
.
Popen
(
...
...
@@ -172,7 +172,7 @@ def run_clang_format_diff(args, file):
if
sys
.
version_info
[
0
]
<
3
:
# make the pipes compatible with Python 3,
# reading lines should output unicode
encoding
=
'
utf-8
'
encoding
=
'
ISO-8859-1
'
proc_stdout
=
codecs
.
getreader
(
encoding
)(
proc_stdout
)
proc_stderr
=
codecs
.
getreader
(
encoding
)(
proc_stderr
)
# hopefully the stderr pipe won't get full and block the process
...
...
@@ -223,7 +223,7 @@ def print_diff(diff_lines, use_color):
if
use_color
:
diff_lines
=
colorize
(
diff_lines
)
if
sys
.
version_info
[
0
]
<
3
:
sys
.
stdout
.
writelines
((
l
.
encode
(
'
utf-8
'
)
for
l
in
diff_lines
))
sys
.
stdout
.
writelines
((
l
.
encode
(
'
ISO-8859-1
'
)
for
l
in
diff_lines
))
else
:
sys
.
stdout
.
writelines
(
diff_lines
)
...
...
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