RepoSense icon indicating copy to clipboard operation
RepoSense copied to clipboard

Use ES6+ way for string interpolation

Open jamessspanggg opened this issue 5 years ago • 4 comments

In the front end pug files, strings are concatenated with variables using the + operator. This might be messy for lines with a lot of variables concatenated together. Let's use ES6's way for string interpolation: title="`${fileType}: ${user.fileTypeContribution[fileType]} lines, ...`"

https://github.com/reposense/RepoSense/blob/61f1fc4f4f854a176ab1f6672f6759c42712c9c3/frontend/src/index.pug#L267-L269

jamessspanggg avatar Feb 11 '20 15:02 jamessspanggg

Update: realise that some parts of the code uses ES6 string interpolation but some don't, let's standardise it.

https://github.com/reposense/RepoSense/blob/61f1fc4f4f854a176ab1f6672f6759c42712c9c3/frontend/src/ramp.pug#L10

jamessspanggg avatar Feb 11 '20 15:02 jamessspanggg

Regarding this. I was thinking that we should convert most of our JS code to follow ES6+ way and not just for String interpolation. This could be done slowly through a number of PRs.

Your POV on this?

Tejas2805 avatar Feb 18 '20 04:02 Tejas2805

Your POV on this?

Hmm my view on we should only convert it when it will improve the readability/efficiency.

jamessspanggg avatar Feb 18 '20 05:02 jamessspanggg

For anyone who's keen to work on this issue, we no longer have an index.pug file. The code mentioned can now be found here:

https://github.com/reposense/RepoSense/blob/51cb75848327bf02f7d064602a31f9995fa198bc/frontend/src/components/v-summary-charts.vue#L163-L165

yhtMinceraft1010X avatar Feb 21 '22 10:02 yhtMinceraft1010X

Hi, can I take this issue as a first timer?

calvintanwj avatar Dec 06 '22 10:12 calvintanwj

@calvintanwj Sure, go ahead. Let us know if you encounter any issues!

dcshzj avatar Dec 07 '22 07:12 dcshzj