Language statistics#1262

Merged
mmarif merged 5 commits from lang-stats into main 2023-04-12 22:43:30 +02:00
mmarif added this to the 5.1.0 milestone 2023-04-03 20:31:57 +02:00
mmarif self-assigned this 2023-04-03 20:31:58 +02:00
Language statistics
All checks were successful
ci/woodpecker/push/locale Pipeline was successful
ci/woodpecker/pr/locale Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/check Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
56bab586d9
@ -0,0 +7,4 @@
*/
public class LanguageColor {
public static int languageColor(String key) {
Contributor

I woulf prefer a map here over a bunch of ifs.

I woulf prefer a map here over a bunch of ifs.
Author
Owner

I can look into this.

I can look into this.
mmarif marked this conversation as resolved
@ -76,4 +76,169 @@
<color name="gold">#e6b121</color>
<color name="five_yellow">#fdc92f</color>
<color name="five_background_grey">#f5f2f0</color>
Contributor

Maybe put these in a separate file?

Maybe put these in a separate file?
Author
Owner

You mean create something like settings.xml?

You mean create something like settings.xml?
Contributor

Yes, just for the language colors.

Yes, just for the language colors.
mmarif marked this conversation as resolved
@ -0,0 +10,4 @@
public static int languageColor(String key) {
int color;
if (key.equalsIgnoreCase("ASP.NET")) {
Member

would it be possible to do code generation based on mentioned json file?

would it be possible to do code generation based on mentioned json file?
Author
Owner

Not I guess, unless we create our own library or use a third party one (if, one is available though).

That's the reason, I used selected options and colors to not just really add everything. And used default color for that reason, if no color matches here, just use default.

But if you know any library which can only do this job, would be great.

Not I guess, unless we create our own library or use a third party one (if, one is available though). That's the reason, I used selected options and colors to not just really add everything. And used default color for that reason, if no color matches here, just use default. But if you know any library which can only do this job, would be great.
@ -78,1 +78,4 @@
<color name="five_background_grey">#f5f2f0</color>
<!-- language statistics colors -->
<color name="default_lang_color">#49da39</color>
Member

as above ... use code generation or seperate in a external lib that is code generated based on the menjoined json

else we will get out of sync soon!!

as above ... use code generation or seperate in a external lib that is code generated based on the menjoined json else we will get out of sync soon!!
Author
Owner

My reply above.

My reply above.
Separate res file for colors, use Map for colors
Some checks failed
ci/woodpecker/push/locale Pipeline was successful
ci/woodpecker/pr/locale Pipeline was successful
ci/woodpecker/pr/build Pipeline failed
ci/woodpecker/pr/check Pipeline failed
ci/woodpecker/push/check Pipeline failed
ci/woodpecker/push/build Pipeline was successful
22abc3dbeb
Format code
All checks were successful
ci/woodpecker/push/locale Pipeline was successful
ci/woodpecker/pr/locale Pipeline was successful
ci/woodpecker/push/check Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
3cd17008a4
@ -0,0 +12,4 @@
public static int languageColor(String key) {
int color = R.color.default_lang_color;
Map<String, Integer> colors = new HashMap<>();
Contributor

Can you make this static variable in the class and initialize in a static { ... }?

Can you make this static variable in the class and initialize in a `static { ... }`?
Contributor

also move the put statements to the initialization (you can just add a static { ... } block with these inside)

also move the `put` statements to the initialization (you can just add a `static { ... }` block with these inside)
Author
Owner

Do you mean something like in the Class:

static {	colors.put("ASP.NET", R.color.default_lang_color);	colors.put("ATS", R.color.ats); } 
Do you mean something like in the Class: ``` static { colors.put("ASP.NET", R.color.default_lang_color); colors.put("ATS", R.color.ats); } ```
Contributor

Yes, that's exactly what I mean.

Yes, that's exactly what I mean.
Make vars static
Some checks failed
ci/woodpecker/push/locale Pipeline was successful
ci/woodpecker/pr/locale Pipeline was successful
ci/woodpecker/pr/check Pipeline failed
ci/woodpecker/push/check Pipeline failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
1e3ce4cbde
Move out colors
All checks were successful
ci/woodpecker/push/locale Pipeline was successful
ci/woodpecker/pr/locale Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
ci/woodpecker/push/check Pipeline was successful
ae70344569
qwerty287 approved these changes 2023-04-12 10:44:44 +02:00
mmarif referenced this pull request from a commit 2023-04-12 22:43:28 +02:00
mmarif merged commit aa10d425e5 into main 2023-04-12 22:43:30 +02:00
mmarif deleted branch lang-stats 2023-04-12 22:43:30 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gitnex/GitNex!1262
No description provided.