Skip to content

Commit d36bcb6

Browse files
committed
fix: code format
1 parent cbfedab commit d36bcb6

File tree

4 files changed

+44
-44
lines changed

4 files changed

+44
-44
lines changed

app.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class App extends React.Component {
5858

5959
return getUserLog({ author, since, path })
6060
.then((stdout) => {
61-
return normolize(stdout, {
62-
firstHour: this.props.firstHour
61+
return normolize(stdout, {
62+
firstHour: this.props.firstHour
6363
});
6464
})
6565
.then(data => {
@@ -71,7 +71,7 @@ class App extends React.Component {
7171
});
7272

7373
await Promise.all(promises);
74-
74+
7575
this.setState({
7676
...this.state,
7777
isLading: false
@@ -81,15 +81,15 @@ class App extends React.Component {
8181
.catch(this.handleError.bind(this));
8282
}
8383

84-
render() {
84+
render() {
8585

8686
const { errors, isLading, out, loading } = this.state;
8787

8888
const isErrors = errors.length;
8989
const isContent = Object.keys(out).length;
9090

91-
return (
92-
<Box flexDirection="column">
91+
return (
92+
<Box flexDirection="column">
9393
{isLading ? (
9494
<Box>
9595
<Color green>
@@ -99,29 +99,29 @@ class App extends React.Component {
9999
</Box>
100100
) : (
101101
<>
102-
{isContent ? (
103-
<>
104-
{Object.keys(out).map(day => (
105-
<Box flexDirection="column" key={day}>
106-
{Object.keys(out[day]).map(project => (
107-
<Project key={project} day={day} name={project} data={out[day][project]} ></Project>
102+
{isContent ? (
103+
<>
104+
{Object.keys(out).map(day => (
105+
<Box flexDirection="column" key={day}>
106+
{Object.keys(out[day]).map(project => (
107+
<Project key={project} day={day} name={project} data={out[day][project]}></Project>
108+
))}
109+
</Box>
108110
))}
111+
</>
112+
) : (
113+
<Box>
114+
{!isErrors ? (<Color blueBright>Not Found</Color>) : null}
109115
</Box>
110-
))}
111-
</>
112-
) : (
113-
<Box>
114-
{!isErrors ? ( <Color blueBright>Not Found</Color> ) : null }
115-
</Box>
116-
)}
116+
)}
117117

118-
{isErrors ? ( <Errors errors={errors} ></Errors> ) : null }
118+
{isErrors ? (<Errors errors={errors}></Errors>) : null}
119119

120120
</>
121121
)}
122-
</Box>
123-
);
124-
}
122+
</Box>
123+
);
124+
}
125125
}
126126

127127
App.propTypes = {

lib/dir.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const getDirectories = async (source) => {
1414

1515
const statPromises = dirs
1616
.map(dirent => stat(join(source, dirent))
17-
.then(data => ({
18-
isDirectory: data.isDirectory(),
19-
name: dirent
20-
})));
17+
.then(data => ({
18+
isDirectory: data.isDirectory(),
19+
name: dirent
20+
})));
2121

2222
const stats = await Promise.all(statPromises);
2323

@@ -28,10 +28,10 @@ const getDirectories = async (source) => {
2828

2929
const getSubDirectories = async (root) => {
3030

31-
const allSubDirectories = await getDirectories(root);
31+
const allSubDirectories = await getDirectories(root);
3232

3333
if (allSubDirectories.includes('.git')) {
34-
return [ root ]
34+
return [root];
3535
}
3636

3737
const subDirectoriesPromises = allSubDirectories

lib/git.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { exec } = require('child_process');
22

3-
function run (command, cwd) {
3+
function run(command, cwd) {
44
return new Promise((resolve, reject) => {
55
exec(command, { cwd }, (err, stdout) => {
66
if (err) {
@@ -12,17 +12,17 @@ function run (command, cwd) {
1212
});
1313
}
1414

15-
function log (path, since, author) {
15+
function log(path, since, author) {
1616
return run(`git log --since="${since}" --author="${author}" --pretty=format:"${path}|%s|%b|%ci|%an;" --date=format:"%X"`, path);
1717
}
1818

19-
function user (path) {
19+
function user(path) {
2020
return run(`git config --get user.name`, path);
2121
}
2222

23-
async function getUserLog ({ author = null, path, since }) {
24-
const currentAuthor = author || await user(path)
25-
23+
async function getUserLog({ author = null, path, since }) {
24+
const currentAuthor = author || await user(path);
25+
2626
try {
2727
return await log(path, since, currentAuthor);
2828
} catch (e) {

lib/normalizer.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const moment = require('moment');
22
const { groupBy } = require('lodash');
33

4-
function normolize (stdout, { firstHour = 9 } = {}) {
4+
function normolize(stdout, { firstHour = 9 } = {}) {
55
let items = stdout.split(';')
66
.filter(item => item.trim())
77
.map(item => {
8-
const [ path, message = '', body = '', date ] = item.trim().split('|');
8+
const [path, message = '', body = '', date] = item.trim().split('|');
99

1010
let progect = path.split(/\\|\//).pop();
1111

@@ -14,14 +14,14 @@ function normolize (stdout, { firstHour = 9 } = {}) {
1414
}
1515

1616
return {
17-
progect,
17+
progect,
1818
date: moment(date, 'YYYY-MM-DD HH:mm:ss Z'),
1919
day: moment(date, 'YYYY-MM-DD HH:mm:ss Z').startOf('day').format('DD/MM/YYYY'),
2020
message,
2121
body
2222
};
2323
})
24-
.sort((a,b) => {
24+
.sort((a, b) => {
2525
return a.date.unix() - b.date.unix();
2626
});
2727

@@ -30,16 +30,16 @@ function normolize (stdout, { firstHour = 9 } = {}) {
3030
Object.keys(items).forEach(day => {
3131

3232
items[day] = items[day].map((data, index, arr) => {
33-
33+
3434
let endTime = moment(day, 'DD/MM/YYYY').add(firstHour, 'h');
3535

36-
if(arr[index - 1]) {
36+
if (arr[index - 1]) {
3737
endTime = arr[index - 1].date;
3838
}
39-
39+
4040
const duration = moment.duration(data.date.diff(endTime));
41-
42-
return {
41+
42+
return {
4343
...data,
4444
spend: duration.humanize(),
4545
spendTime: duration.asMinutes()

0 commit comments

Comments
 (0)