Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Application web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Agroclim
AgroMetInfo
Application web
Commits
edf19b92
Commit
edf19b92
authored
1 year ago
by
Olivier Maury
Browse files
Options
Downloads
Patches
Plain Diff
Mise à jour de tokei. refs
#15
parent
362714d0
No related branches found
Branches containing commit
Tags
2.4.4
Tags containing commit
1 merge request
!30
Resolve "Configurer l'intégration continue"
Pipeline
#159654
failed
1 year ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/sloccount.sh
+18
-22
18 additions, 22 deletions
bin/sloccount.sh
bin/tokei2cloc.py
+14
-29
14 additions, 29 deletions
bin/tokei2cloc.py
with
32 additions
and
51 deletions
bin/sloccount.sh
+
18
−
22
View file @
edf19b92
#!/bin/bash
ROOT_DIR
=
$(
dirname
$(
dirname
$0
))
TOKEI2CLOC
=
$(
dirname
$0
)
/tokei2cloc.py
TOKEITGZ
=
tokei-v7.0.3-x86_64-unknown-linux-gnu.tar.gz
if
[
!
-f
bin/tokei
]
;
then
mkdir
-p
~/tmp bin
if
[
!
-f
~/tmp/
$TOKEITGZ
]
;
then
wget
"https://github.com/Aaronepower/tokei/releases/download/v7.0.3/
$TOKEITGZ
"
-O
~/tmp/
$TOKEITGZ
TOKEI
=
$(
command
-v
tokei
)
if
[
!
-x
"
$TOKEI
"
]
;
then
TOKEITGZ
=
tokei-x86_64-unknown-linux-gnu.tar.gz
if
[
!
-f
bin/tokei
]
;
then
mkdir
-p
~/tmp
if
[
!
-f
~/tmp/
$TOKEITGZ
]
;
then
wget
"https://github.com/Aaronepower/tokei/releases/download/v12.1.2/
$TOKEITGZ
"
-O
~/tmp/
$TOKEITGZ
fi
tar
zxf ~/tmp/
$TOKEITGZ
-C
bin
fi
tar
zxf ~/tmp/
$TOKEITGZ
-C
bin
TOKEI
=
bin/tokei
fi
if
[
-f
bin/tokei
]
;
then
mkdir
-p
target
bin/tokei
-f
-o
json src |
$TOKEI2CLOC
>
target/cloc.xml
exit
if
[
!
-f
$TOKEI
]
;
then
echo
"Strange,
$TOKEI
does not exist!"
exit
1
fi
SLOCCOUNT
=
$(
which sloccount
)
;
if
[
"
$SLOCCOUNT
"
!=
""
]
;
then
DATADIR
=
$(
dirname
$0
)
/.slocdata
;
if
[
!
-f
$DATADIR
]
;
then
mkdir
-p
$DATADIR
;
fi
mkdir
-p
target
;
/usr/bin/sloccount
--datadir
$DATADIR
--duplicates
--wide
--details
src
>
target/sloccount.sc
;
else
echo
"sloccount not found!"
;
fi
echo
"tokei is installed at
$TOKEI
"
$TOKEI
--version
mkdir
-p
$ROOT_DIR
/target
$TOKEI
-f
-o
json
$ROOT_DIR
/sava-core/src
$ROOT_DIR
/sava-core-jakarta/src
$ROOT_DIR
/sava-example/src |
$TOKEI2CLOC
>
$ROOT_DIR
/target/cloc.xml
This diff is collapsed.
Click to expand it.
bin/tokei2cloc.py
+
14
−
29
View file @
edf19b92
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# data.pheno.fr - Phenological data portal of TEMPO
# Copyright © 2019 TEMPO (contact-tempo@inrae.fr)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# $Id
: tokei2cloc.py 77 2019-01-11 17:24:18Z omaury
$
# $Id$
#
# Author : Olivier Maury
# Creation Date : 2019-01-15 10:30:29 +0200
# Last Revision : $Date
: 2019-01-11 18:24:18 +0100 (ven., 11 janv. 2019)
$
# Revision : $Rev
: 77
$
# Last Revision : $Date$
# Revision : $Rev$
u
"""
[1mNOM[m
%prog - Tokei2Cloc
...
...
@@ -38,10 +21,10 @@ u"""
Olivier Maury
[1mVERSION[m
$Date
: 2019-01-11 18:24:18 +0100 (ven., 11 janv. 2019)
$
$Date$
"""
__revision__
=
"
$Rev
: 77
$
"
__revision__
=
"
$Rev$
"
__author__
=
"
Olivier Maury
"
import
json
import
sys
...
...
@@ -52,8 +35,10 @@ results = json.loads(sys.stdin.read())
nb_files
=
0
nb_lines
=
0
for
lang
in
results
:
nb_files
+=
len
(
results
[
lang
][
'
stats
'
])
nb_lines
+=
int
(
results
[
lang
][
'
lines
'
])
nb_files
+=
len
(
results
[
lang
][
'
reports
'
])
nb_lines
+=
int
(
results
[
lang
][
'
blanks
'
])
nb_lines
+=
int
(
results
[
lang
][
'
code
'
])
nb_lines
+=
int
(
results
[
lang
][
'
comments
'
])
print
(
"""
<?xml version=
"
1.0
"
?><results>
<header>
...
...
@@ -73,11 +58,11 @@ total_blank = 0
total_comment
=
0
total_code
=
0
for
lang
in
results
:
for
result
in
results
[
lang
][
'
sta
ts
'
]:
blank
=
int
(
result
[
'
blanks
'
])
comment
=
int
(
result
[
'
comments
'
])
code
=
int
(
result
[
'
code
'
])
print
(
"""
<file name=
"
%s
"
blank=
"
%d
"
comment=
"
%d
"
code=
"
%d
"
language=
"
%s
"
/>
"""
%
for
result
in
results
[
lang
][
'
repor
ts
'
]:
blank
=
int
(
result
[
'
stats
'
][
'
blanks
'
])
comment
=
int
(
result
[
'
stats
'
][
'
comments
'
])
code
=
int
(
result
[
'
stats
'
][
'
code
'
])
print
(
"""
<file name=
"
%s
"
blank=
"
%d
"
comment=
"
%d
"
code=
"
%d
"
language=
"
%s
"
/>
"""
%
(
result
[
'
name
'
],
blank
,
comment
,
code
,
lang
))
total_blank
+=
blank
total_comment
+=
comment
...
...
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