mbuet2ner / JEasyCrypto

A project for educational purposes for the course "Open Source Software Development" at the University of Oulu
GNU General Public License v3.0
2 stars 23 forks source link

Coding style is not clearly defined in documentation #26

Open rmakynen opened 4 years ago

rmakynen commented 4 years ago

Currently the only mention about coding style is in readme: "This project considers the output of the IntelliJ IDEA IDE Reformat Code option as the gold standard."

This is not a very good way to do to declare the coding style, since it is not very specific and is subject to change. Also the user could have change the default coding style of IntelliJ IDE, which would still result in "gold standard code" due to being reformatted with the IntelliJ IDE.

Many users may prefer some other editor and needing to install Itelli J IDE just for reformatting adds extra effort for every pull request. Furthermore, default values can sometimes change, this type of thing has happened at least in some IDE's where suddenly the hotkeys for certain actions become different. As a result the coding style may suddenly change when Intelli IDE decides to change the default values.

Suggested change: A better way to do this would be to declare a coding style that the repository follows. At a first glance, the coding style seems to conform to K&R style. We would like to add comments related to "K&R style" in the readme/Contribution guide. Benefits of this change would be the freedom to use any code editor the user chooses, since the coding style is now clearly defined (and not subject to change by IDE developers).

Our team is interested in doing this change (Riku, Benjamin, Pirkka-Pekka)

EDIT: We will start working on this change on the week: 11.11.2019 - 17.11.2019

jussityynela commented 4 years ago

@rmakynen

Hi, Agreed, it is usually beneficial to be specific. To clarify are you talking about coding convention or just indentation styles? Do you plan include styles on comments, naming conventions etc.

If you are on the issue of the formatting please keep the rules so that they can be automated. Also, try make the style document that most (all?) of the existing files abide to that style. Beware and keep it simple, this is a issue that can involve a lot of bike shedding, I would like to just pick one and stick to it. Better to keep consistent instead argue where the curly brace should be.

Feel free to suggest existing coding convention, but do not feel obliged to that either :).

rmakynen commented 4 years ago

We would mainly focus on the indentation style. The aim is to find the most common style that is being used currently and define that style formally in the documentation. It might be necessary to change the formatting of some of the code. We don't have any clear vision for naming convention, documentation conventions nor other coding conventions. The focus is on the indentation style.

mbuet2ner commented 4 years ago

I think it would be beneficial to just have a drop in code formatter. That is why suggested using IntelliJ. Of course this is less than ideal. But we could use a standalone formatter like this. Because I really don't think that it is practical for contributors to manually check the formatting.

rmakynen commented 4 years ago

39

We made a pull request.

We noticed that Google Java style was used. By default IntelliJ IDEA didn't use the correct format, but after installing a plugin for it "google-java-style" the indentation was correct. Added two new methods for formatting:

  1. VSCODE
  2. jar file that can be used to format the code.