-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Styleguide First Pass #68
base: master
Are you sure you want to change the base?
Styleguide First Pass #68
Conversation
First pass at styleguide for C# documentation
Very cool! The documentation definitely needs a more consistent format. I would also like to contribute towards this when I have the time (~2 days). A few things to note:
|
STYLEGUIDE.md
Outdated
| | ||
</span> | ||
|
||
> Omit elements entirely if not relavent to that class (eg: parent class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why that? Parent class and interfaces - usefull information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
* Type (with link to that object or objects) | ||
* Notes | ||
|
||
## Variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where to describe consts?
in this section, or another?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed :)
Fixed some typos, cleaned up the tables, and changed spans to divs per feedback request. Removed some overly strict requirements too.
Adjusted Class variables table to add row for const / read only / static / etc
Fixed broken Method Table
More Fixes
Last set of fixes, removed extra table columns and more cleanup
Ready for Re-review :) |
STYLEGUIDE.md
Outdated
<span style= "font-size:12px"> | ||
|
||
Using / Namespaces | | <span style='color:yellow'>Taleworlds.Core</span>| | | | <span style='color:green'>Saveable</span> | | ||
:---|---|---|---|---|---|---:| | ||
[System](EXAMPLE) | | | | | | 10000 | | ||
[System.Xml](EXAMPLE)| | ||
[TaleWorlds.SaveSystem](EXAMPLE) | | ||
| | ||
</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The left column shows all the includes, the yellow is the specific namespace, and savable is green, the savable class number is 10000. I'm more than open to better recommendations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Table should contain similar data. But without table it will be over wide.
So, maybe table is the best now.
|
||
# Enums | ||
|
||
Enums should be placed in their own file at the Class level (on their own page under a package) with the following format: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where to describe enums, which defined in class? In separate file? In that case info about using is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was basing off of the decompiled dlls. Enums are defined in their and don't have anything else in them afaik:
public enum WeaponClass
{
// Token: 0x040005BF RID: 1471
Undefined,
// Token: 0x040005C0 RID: 1472
Dagger,
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am working on Hero class. And it define structs and enums in self.
Where would be good place to document them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they are unique / private to the class they should probably go somewhere within the class, if they live outside the class then they should go as their own page in the Enums section. Open to recommendations for the former.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I will place it to class on my case.
But according to styleguides enum should be separated from class.
So that lack on develop side :D (also with public variables)
STYLEGUIDE.md
Outdated
| | ||
</span> | ||
|
||
### Values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where H2 header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed to H2
|
||
Unlike the root and package level READMEs, the class README will contain more than just links to child folders. Each class will start with a **Class Overview Panel**: | ||
|
||
### [Parent Object Name](EXAMPLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File should start with H1 header.
I suggest move info about parent and interfaces to H2 after description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue its good to have quick access to the parrent class right next to the classname, but thats just me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's good. So that's why I suggested h2 after description.
But when you open a class readme - you, most likely want to read about this certain class first, not related.
STYLEGUIDE.md
Outdated
|...|...|...|...| | ||
</div> | ||
|
||
Methods should follow parameters, seperated by a H1 header. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> H1
Is typo here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed to be H2. Poor wording on my part. The idea is to have a clear break between each section
STYLEGUIDE.md
Outdated
|
||
<div style= "font-size:12px"> | ||
|
||
| Type | Method Name | Number of Params | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Number of Params - redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Params better, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Overthought it while writing. Fixed.
STYLEGUIDE.md
Outdated
### [Parent Object Name](EXAMPLE) | ||
## Method Name | ||
|
||
| Parameters | Type | default | Optional? | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MnB2 use C#, not TS. Type -> Parameters is better :)
Methods discription place in separate file, do I understand correctly?
In that case we don't need table here, because we have almost the same in another place. In addition, discription would be better placed here, not in another header.
Example: https://docs.python.org/3/library/math.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, Optional and default have the same meaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oof. Not a C# master by any means, Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each file (Classes, Methods, etc) will focus on itself. So the Methods will have their description in their own file, not in their class file. I agree that this table could be optional, but users may navigate straight to a method from very far away (so to speak) in the documentation and won't arrive by going directly through their parrent class (or struct, w/e) tree. If you think this is still worth removing after that consideration, I'll remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To summarize, I suggest:
Put methods declaration in class (when I read about class, I want to see it interface) as list (not table, because table assume that datas similar by size)
Put methods definition in separate file (without table).
In that case class won't be overwhelmed and definition won't be stretched out.
Lots of feedback fixes from Anakael's feedback
For this Style Guide, are you proposing that the C# API should include the namespace in each path? In other words, something like:
Right now it is organized like this:
My vote is to stick with the current setup and then include the namespace at the top of the documentation for each class. Let me know your thoughts. Also, I would rename instances of |
C# API > Library (by dll package) > Class > Method As for renaming package to library / namespace, im fine with either. |
|
||
The above would be a valid snippet for the ```InformationMessage``` Class, but can be longer if the extra length is used to give important context about the snippet. | ||
|
||
Directly after this intro snippet, we have a section outlining the variables of the class. All variables are assumed to have private setters unless otherwise noted. Each variable should contain all of the following information: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it private - why it is required to be mentioned?
The above would be a valid snippet for the ```InformationMessage``` Class, but can be longer if the extra length is used to give important context about the snippet. | ||
|
||
Directly after this intro snippet, we have a section outlining the variables of the class. All variables are assumed to have private setters unless otherwise noted. Each variable should contain all of the following information: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mod?
First pass at styleguide for C# documentation