Fixing code quality

cosmos

(Aditya Patil) #1

This is regarding the issue about code quality I mentioned on GitHub.

As I am busy with my final year project, and I have also started other things, like learning some frameworks and writing a blog, I might not be able to fix existing programs. However, I’d be more than happy to contribute towards building proper guidelines and setting up tools to improve code quality and maintain it thereafter.

Here are some suggestions I have,

  1. Add Travis support so that every program is ensured to be compilable.
  2. Add <Insert name of the tool here> for code quality. I am trying out the free ones for my project. You can check them through badges at github.com/InfiniteCoder/apgw
  3. Pick some standard code guidelines, preferably those which can be formatted automatically(using linters?), and enforce them. Are there any tools to check code guideline compliance? There must be some.
  4. Encourage contributors to improve existing programs, by adding a relevant message to README or CONTRIBUTING file.

Btw my current project is related to coding. A lot of its features will be applicable to cosmos, so I’ll try to improve things in cosmos whenever possible.


(Aditya Chatterjee) #2

We are glad :smiley: to have you in our community :family_man_woman_boy_boy:. Small contributions from everyone makes up a huge change. We are looking forward to your contributions. We can fix this together. :muscle:

We need to take up some serious measures to make Cosmos great again. :tada:

Currently, we do have sections for coding styles and installation guidelines where we collaborate to accomplish the task the best way possible. There are tools that can check conformity to a particular style guideline but as our guidelines are generally dynamic, tools must be so as well. This calls for some change in the process.

We ensure the conformity manually but we need to move to an automated process to make management of Cosmos better than ever.

Now it is time to add Travis support to Cosmos. We delayed it to testify our hypothesis that such add-ons may scare off new contributors and may eventually, make it scary. :ghost:

At this point, we need a balance between contributor and user friendliness.

Your forth point seems very promising. :man_dancing:
:thinking: Are you suggesting that users should comment on every code in its corresponding readme ?


(Aditya Patil) #3

What I was suggesting is that it should be made clear in the README and CONTRIBUTING.md files, that it is not only accepted, but rather encouraged that contributors maintain and improve existing codes.

A proper flow for accepting contributions could become a guiding hand, instead of a hindrance to new contributors. For example, a new user submits code, then tools check its conformity. If it’s non conforming, a bot/experienced user submits a message suggesting general steps that should be taken to improve the code, like a link to code guidelines.


(Aditya Chatterjee) #4

Yes, you are right. We must make it clear the way a user can contribute to make the process much smoother and encouraging. :smiley:

In the past, we have witnessed few contributors who were not sure if their way of contributing will be accepted. Eventually, everyone realized that we accept a wide range of contributions than that are readily visible. Though, there might be a bunch of potential users who could have become contributors if we could remove this uncertainty.

If the readme has the potential required updates for the concerned code, the contributing experience will be much better than ever.

We must figure out how can we turn the generalization to specific scopes of contributions.


(Aditya Patil) #5

So what next? Got any plans?


(Aditya Chatterjee) #6

The immediate steps that we must take are:

  • Add support for Travis CI
  • Improve the Contributing guidelines by mentioning further scopes of contribution and redesigning it

Things we need to think on to figure out the best path of action and implement soon:

  • Increase awareness regarding the wide scope of Cosmos
  • Figure out which of the services (like codacy, synk, bettercodehub and others) will be best for our community
  • Reform our review strategy
  • In general, make Cosmos more contributor friendly and accessible

(Aditya Patil) #7

You can use this old PR for travis, https://github.com/OpenGenus/cosmos/pull/2423, but it only supports C and C++.


(Aditya Chatterjee) #8

Yes, it is good to be merged.
Just resolve the conflict . :+1:

We will add support for other languages subsequently. :smile:


(Aditya Patil) #9

Done. We could get the build to succeed by fixing programs one by one.


(Aditya Patil) #10

Have a look at code climate. It doesn’t make it obvious from its github marketplace page, but it’s free for open source projects.

It has a lot of features. We can check maintainability, style conformance and complexity of the code.


(Stelios Tymvios) #11

I’d like to help with improving the code quality. I could help with C, Python, Java, Kotlin. I am also maintaining a repo with my notes on Datastructures and Algorithms so a lot of that is also transferrable.


(Aditya Patil) #12

@aditya Just giving a heads up! Can you accept the PR? or are there any issues with it? If there are issues, let me know, I’ll fix them, or create a new PR :smile:


(Aditya Chatterjee) #13

Thanks for reminding. :smile: It is good to be merged after a small change. I have added a comment in the pull request thread.

Actually, I was thinking if failing checks will discourage new contributors. This integration is necessary and we can figure out a balance as we move ahead :+1:


(Aditya Chatterjee) #14

Hi Stelios :v:, we would love to have you join us in improving the code quality of Cosmos. Maintaining and improving the existing material of Cosmos as we grow is very important. :smile:

Yes, maintaining notes is great :gift_heart: and this would also, enable you to get going with Cosmos effectively. Your first contribution has been great. :trophy:


(Aditya Patil) #15

@aditya I made a fresh new PR. https://github.com/OpenGenus/cosmos/pull/3154. Last time I was a newbie to git, but now I have properly understood the workflow :smile:

Also, I have discovered some issues, for which I shall make separate PRs.


(Aditya Chatterjee) #16

Great. I have merged it :smiley:

Extending it for other languages look pretty simple. Perfect :ok_hand:

For adding support for other languages, add the relevant section in the makefile and another section in Travis matrix.


(Aditya Patil) #17

Can you add a note somewhere, suggesting contributers to have a look at the travis logs and fix any issues if the can. Currently there is a huge pile of warning and issues for both C and C++, and the more people start to fix it, the faster it would be solved.

Maybe add a issue with the “help needed” tag. Or maybe you could add a todo file, which lists things that need to be done, so that contributers could pick from it whatever they like.


(Aditya Chatterjee) #18

Hi, I have created an issue regarding this. See this issue
Let me know if this is fine.

I am compiling a list of major future developments around Cosmos and will include this :+1: