Skip to content

Commit a58c9a3

Browse files
committed
🎉 Bring naming convention guide to life with guides for csharp, git, java and php
1 parent e4cb35f commit a58c9a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+13333
-2
lines changed

.bookignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Excludes files from build
2+
sw.config.js

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Node rules:
2+
## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
3+
.grunt
4+
5+
## Dependency directory
6+
## Commenting this out is preferred by some people, see
7+
## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git
8+
node_modules
9+
10+
# Book build output
11+
_book
12+
13+
# eBook build output
14+
*.epub
15+
*.mobi
16+
*.pdf

README.md

100644100755
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
1-
# naming-convention-guide
2-
Collection of naming guides for writing more consistent and readable codes
1+
# Welcome - The Naming Convention Project
2+
3+
The Naming Convention Project is an effort to identify, collect and maintain a set of guidelines for best naming practices.
4+
5+
## How we work:
6+
We accept recommendations from all enthusiastic who care about the quality. The suggested recommendations will be submitted to website by collaborative consensus based processes.
7+
8+
[![Join the chat at https://gitter.im/naming_convention/community](https://badges.gitter.im/JoinChat.svg)](https://gitter.im/naming_convention/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
9+
10+
## Naming Convention topic list:
11+
* [C#](../c#/)
12+
* [Git](../git/)
13+
* [Java](../java/)
14+
* [PHP](../php/)
15+
16+
## Contributions
17+
Help us create the better conventions with your contributions. Simply read our [Contribution Guide](../meta/contribution-guide.html) and get started!

SUMMARY.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Summary
2+
3+
* [Introduction](README.md)
4+
* [Contribute Guide](docs/CONTRIBUTING.md)
5+
* [FAQ](docs/faq.md)
6+
* [Lexicon](docs/lexicon.md)
7+
* [C#](csharp/README.md)
8+
* [Argument Naming](csharp/argument-naming.md)
9+
* [Class Naming](csharp/class-naming.md)
10+
* [Enum Naming](csharp/enum-naming.md)
11+
* [Interface Naming](csharp/interface-naming.md)
12+
* [Method Naming](csharp/method-naming.md)
13+
* [Variable Naming](csharp/variable-naming.md)
14+
* [Git](git/README.md)
15+
* [Branch Naming](git/branch-naming.md)
16+
* [Commit Message Naming](git/commit-message-naming.md)
17+
* [Pull Request Naming](git/pull-request-naming.md)
18+
* [Java](java/README.md)
19+
* [Class Naming](java/class-naming.md)
20+
* [Interface Naming](java/interface-naming.md)
21+
* [Method Naming](java/method-naming.md)
22+
* [Variable Naming](java/variable-naming.md)
23+
* [Package Naming](java/package-naming.md)
24+
* [Constant Naming](java/constant-naming.md)
25+
* [PHP](php/README.md)
26+
* [Class Naming](php/class-naming.md)
27+
* [Interface Naming](php/interface-naming.md)
28+
* [Method Naming](php/method-naming.md)
29+
* [Variable Naming](php/variable-naming.md)
30+
* [Constant Naming](php/constant-naming.md)
31+
* [Namespaces Naming](php/namespaces-naming.md)

_layouts/website/layout.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{% extends "layout.html" %}
2+
3+
{% block head %}
4+
{{ super() }}
5+
<meta name="HandheldFriendly" content="true"/>
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<meta name="mobile-web-app-capable" content="yes">
8+
<meta name="apple-mobile-web-app-capable" content="yes">
9+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
10+
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ "images/apple-touch-icon-precomposed-152.png"|resolveAsset }}">
11+
<link rel="shortcut icon" href="/icon.png" type="image/png">
12+
<link rel="manifest" href="manifest.json">
13+
<meta name="application-name" content="NamingConventions">
14+
<meta name="apple-mobile-web-app-title" content="NamingConventions">
15+
<meta name="theme-color" content="#fafafa">
16+
<meta name="msapplication-navbutton-color" content="#fafafa">
17+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
18+
<meta name="msapplication-starturl" content="/">
19+
<link rel="icon" href="/icon.png">
20+
<link rel="apple-touch-icon" href="/icon.png">
21+
{% endblock %}
22+
23+
{% block style %}
24+
{### Include theme css before plugins css ###}
25+
<link rel="stylesheet" href="{{ "style.css"|resolveAsset }}">
26+
27+
{{ super() }}
28+
29+
{### Custom stylesheets for the book ###}
30+
31+
{% for type, style in config.styles %}
32+
{% if fileExists(style) and type == "website" %}
33+
<link rel="stylesheet" href="{{ style|resolveFile }}">
34+
{% endif %}
35+
{% endfor %}
36+
{% endblock %}
37+
38+
{% block body %}{% endblock %}

_layouts/website/page.html

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{% extends "./layout.html" %}
2+
3+
{% block title %}{{ page.title }} · {{ super() }}{% endblock %}
4+
5+
{% block description %}{{ page.description }}{% endblock %}
6+
7+
{% block head %}
8+
{{ super() }}
9+
{% if page.next and page.next.path %}
10+
<link rel="next" href="{{ page.next.path|resolveFile }}" />
11+
{% endif %}
12+
{% if page.previous and page.previous.path %}
13+
<link rel="prev" href="{{ page.previous.path|resolveFile }}" />
14+
{% endif %}
15+
{% endblock %}
16+
17+
{% block javascript %}
18+
<script src="{{ "gitbook.js"|resolveAsset }}"></script>
19+
<script src="{{ "theme.js"|resolveAsset }}"></script>
20+
{% for resource in plugins.resources.js %}
21+
{% if resource.url %}
22+
<script src="{{ resource.url }}"></script>
23+
{% else %}
24+
<script src="{{ resource.path|resolveAsset }}"></script>
25+
{% endif %}
26+
{% endfor %}
27+
{% endblock %}
28+
29+
{% block body %}
30+
<div class="book">
31+
<div class="book-summary">
32+
{% block book_sidebar %}
33+
{% block search_input %}{% endblock %}
34+
{% block book_summary %}
35+
<nav role="navigation">
36+
{% include "website/summary.html" %}
37+
</nav>
38+
{% endblock %}
39+
{% endblock %}
40+
</div>
41+
42+
<div class="book-body">
43+
{% block book_body %}
44+
<div class="body-inner">
45+
{% block book_inner %}
46+
{% include "website/header.html" %}
47+
48+
<div class="page-wrapper" tabindex="-1" role="main">
49+
<div class="page-inner">
50+
{% block search_results %}
51+
<section class="normal markdown-section">
52+
{% block page %}
53+
{{ page.content|safe }}
54+
{% endblock %}
55+
</section>
56+
{% endblock %}
57+
</div>
58+
</div>
59+
{% endblock %}
60+
</div>
61+
62+
{% block book_navigation %}
63+
{% if page.previous and page.previous.path %}
64+
<a href="{{ page.previous.path|resolveFile }}{{ page.previous.anchor }}" class="navigation navigation-prev {% if not (page.next and page.next.path) %}navigation-unique{% endif %}" aria-label="Previous page: {{ page.previous.title }}">
65+
<i class="fa fa-angle-left"></i>
66+
</a>
67+
{% endif %}
68+
{% if page.next and page.next.path %}
69+
<a href="{{ page.next.path|resolveFile }}{{ page.next.anchor }}" class="navigation navigation-next {% if not (page.previous and page.previous.path) %}navigation-unique{% endif %}" aria-label="Next page: {{ page.next.title }}">
70+
<i class="fa fa-angle-right"></i>
71+
</a>
72+
{% endif %}
73+
{% endblock %}
74+
{% endblock %}
75+
</div>
76+
77+
<script>
78+
var gitbook = gitbook || [];
79+
gitbook.push(function() {
80+
gitbook.page.hasChanged({{ template.getJSContext()|dump|safe }});
81+
});
82+
</script>
83+
84+
<script>
85+
'use strict';
86+
if ('serviceWorker' in navigator) {
87+
window.addEventListener('load', function() {
88+
navigator.serviceWorker.register('/service-worker.js').then(function(reg) {
89+
reg.onupdatefound = function() {
90+
var installingWorker = reg.installing;
91+
installingWorker.onstatechange = function() {
92+
switch (installingWorker.state) {
93+
case 'installed':
94+
if (navigator.serviceWorker.controller) {
95+
console.log('New or updated content is available.');
96+
} else {
97+
console.log('Content is now available offline!');
98+
}
99+
break;
100+
case 'redundant':
101+
console.error('The installing service worker became redundant.');
102+
break;
103+
}
104+
};
105+
};
106+
}).catch(function(e) {
107+
console.error('Error during service worker registration:', e);
108+
});
109+
});
110+
}
111+
</script>
112+
</div>
113+
{% endblock %}

_layouts/website/summary.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{% macro articles(_articles) %}
2+
{% for article in _articles %}
3+
<li class="chapter {% if article.path == file.path and not article.anchor %}active{% endif %}" data-level="{{ article.level }}" {% if article.path %}data-path="{{ article.path|resolveFile }}"{% endif %}>
4+
{% if article.path and getPageByPath(article.path) %}
5+
<a href="{{ article.path|resolveFile }}{{ article.anchor }}">
6+
{% elif article.url %}
7+
<a target="_blank" href="{{ article.url }}">
8+
{% else %}
9+
<span>
10+
{% endif %}
11+
{% if article.level != "0" and config.pluginsConfig['theme-default'].showLevel %}
12+
<b>{{ article.level }}.</b>
13+
{% endif %}
14+
{{ article.title }}
15+
{% if article.path or article.url %}
16+
</a>
17+
{% else %}
18+
</span>
19+
{% endif %}
20+
21+
{% if article.articles.length > 0 %}
22+
<ul class="articles">
23+
{{ articles(article.articles, file, config) }}
24+
</ul>
25+
{% endif %}
26+
</li>
27+
{% endfor %}
28+
{% endmacro %}
29+
30+
<ul class="summary">
31+
<a href="/">
32+
<img src="/logo.png" style="width: 100%; max-width: 220px; padding: 16px 16px 6px 16px;" alt="NamingConvention">
33+
</a>
34+
<li class="divider"></li>
35+
{% set _divider = false %}
36+
{% if config.links.sidebar %}
37+
{% for linkTitle, link in config.links.sidebar %}
38+
{% set _divider = true %}
39+
<li>
40+
<a href="{{ link }}" target="_blank" class="custom-link">{{ linkTitle }}</a>
41+
</li>
42+
{% endfor %}
43+
{% endif %}
44+
45+
{% if _divider %}
46+
<li class="divider"></li>
47+
{% endif %}
48+
49+
{% for part in summary.parts %}
50+
{% if part.title %}
51+
<li class="header">{{ part.title }}</li>
52+
{% elif not loop.first %}
53+
<li class="divider"></li>
54+
{% endif %}
55+
{{ articles(part.articles, file, config) }}
56+
{% endfor %}
57+
58+
</ul>

book.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"title": "Naming Convention",
3+
"plugins": [
4+
"github-edit",
5+
"sitemap-general",
6+
"smart-nav-collapse"
7+
],
8+
"pluginsConfig": {
9+
"github-edit": {
10+
"repo": "naming-convention/NamingConvention-Guides",
11+
"branch": "master"
12+
},
13+
"sitemap-general": {
14+
"prefix": "https://namingconventions.org/"
15+
}
16+
},
17+
"styles": {
18+
"website": "styles/website.css"
19+
}
20+
}

csharp/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# C# Naming Convention
2+
List of covered sections:
3+
* [Argument Naming](../csharp/argument-naming.html)
4+
* [Class Naming](../csharp/class-naming.md)
5+
* [Enum Naming](../csharp/enum-naming.html)
6+
* [Interface Naming](../csharp/interface-naming.html)
7+
* [Method Naming](../csharp/method-naming.html)
8+
* [Variable Naming](../csharp/variable-naming.html)
9+
10+
Missing something? Please contribute here by reading [this guide](../docs/CONTRIBUTING.html).

csharp/argument-naming.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# C# Naming Convention > Argument Naming
2+
3+
## camelCase
4+
- Begin with an lowercase letter
5+
- Preferably a noun e.g. phoneNumber
6+
- If multiple words: start it with the lowercase letter followed by an uppercase letter e.g. userPublicId
7+
- Avoid abbreviation and hungarian notation
8+
9+
```c#
10+
public int GetTotalSalary(string employeeId, string companyId)
11+
{
12+
...
13+
}
14+
```

0 commit comments

Comments
 (0)