Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
21c646a8
Kaydet (Commit)
21c646a8
authored
Mar 14, 2012
tarafından
Tom Thorogood
Kaydeden (comit)
Miklos Vajna
Mar 14, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add options to bin/find-german-comments to help weed out false positives
üst
1c9408fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
1 deletion
+43
-1
find-german-comments
bin/find-german-comments
+43
-1
No files found.
bin/find-german-comments
Dosyayı görüntüle @
21c646a8
...
...
@@ -44,6 +44,10 @@ class Parser:
help
=
"Only print the filenames of files containing German comments"
)
op
.
add_option
(
"-v"
,
"--verbose"
,
action
=
"store_true"
,
dest
=
"verbose"
,
default
=
False
,
help
=
"Turn on verbose mode (print progress to stderr)"
)
op
.
add_option
(
"-l"
,
"--line-numbers"
,
action
=
"store_true"
,
dest
=
"line_numbers"
,
default
=
False
,
help
=
"Prints the filenames and line numbers only."
)
op
.
add_option
(
"-t"
,
"--threshold"
,
action
=
"store"
,
dest
=
"THRESHOLD"
,
default
=
0
,
help
=
"When used with '--line-numbers', only bothers outputting comment info if there are more than X number of flagged comments. Useful for weeding out false positives."
)
self
.
options
,
args
=
op
.
parse_args
()
try
:
dir
=
args
[
0
]
...
...
@@ -141,7 +145,45 @@ class Parser:
"""
checks each comment in a file
"""
if
not
self
.
options
.
filenames_only
:
def
tab_calc
(
string
):
START
=
40
#Default of 10 tabs
if
len
(
string
)
>=
START
:
return
1
,
0
diff
=
START
-
len
(
string
)
if
diff
%
4
is
not
0
:
padding
=
1
else
:
padding
=
0
return
(
diff
/
4
)
+
padding
if
self
.
options
.
line_numbers
:
TABS
=
"
\t
"
*
10
path_linenums
=
[]
for
linenum
,
s
in
self
.
get_comments
(
path
):
if
self
.
is_german
(
s
):
path_linenums
.
append
(
linenum
)
valid
=
len
(
path_linenums
)
>
int
(
self
.
options
.
THRESHOLD
)
sys
.
stderr
.
write
(
"
%
s ...
%
s positives --
%
s
\n
"
%
(
path
,
str
(
len
(
path_linenums
)),
str
(
valid
)))
if
valid
:
if
len
(
path
)
+
(
len
(
path_linenums
)
*
4
)
>
75
:
print
"
%
s:
\n
"
%
path
while
(
path_linenums
):
i
=
0
numline
=
[]
while
i
<
10
:
try
:
numline
.
append
(
path_linenums
[
0
])
path_linenums
.
remove
(
path_linenums
[
0
])
except
IndexError
:
i
=
10
i
+=
1
numline
=
[
str
(
i
)
for
i
in
numline
]
print
"
%
s
%
s"
%
(
TABS
,
","
.
join
(
numline
))
else
:
path_linenums
=
[
str
(
i
)
for
i
in
path_linenums
]
print
"
%
s:
%
s
%
s"
%
(
path
,
"
\t
"
*
tab_calc
(
path
),
","
.
join
(
path_linenums
))
elif
not
self
.
options
.
filenames_only
:
for
linenum
,
s
in
self
.
get_comments
(
path
):
if
self
.
is_german
(
s
):
print
"
%
s:
%
s:
%
s"
%
(
path
,
linenum
,
s
)
...
...
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