Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit b08937c

Browse files
GH-78 & GH-77 Completely reorganize and update repo! Added StyleCop (#82)
* Completely reorganize and update repo! * Add Style Cop and fix all formatting * Additional Cleanup for rename and organization * Update readme * small tweaks :)
1 parent 75170dd commit b08937c

File tree

277 files changed

+4745
-4890
lines changed

Some content is hidden

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

277 files changed

+4745
-4890
lines changed

Diff for: .editorconfig

+100-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,105 @@
1-
; This file is for unifying the coding style for different editors and IDEs.
2-
; More information at http://editorconfig.org
3-
1+
# Suppress: EC112
2+
# top-most EditorConfig file
43
root = true
54

5+
# Don't use tabs for indentation.
66
[*]
7-
end_of_line = CRLF
8-
9-
[*.cs]
107
indent_style = space
8+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
9+
10+
# Code files
11+
[*.{cs,csx,vb,vbx}]
12+
indent_size = 4
13+
14+
# Code files
15+
[*.sln]
1116
indent_size = 4
17+
18+
# Xml project files
19+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
20+
indent_size = 2
21+
22+
# Xml config files
23+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
24+
indent_size = 2
25+
26+
# JSON files
27+
[*.json]
28+
indent_size = 2
29+
30+
# XML files
31+
[*.xml]
32+
indent_size = 2
33+
34+
# Dotnet code style settings:
35+
[*.{cs,vb}]
36+
# Sort using and Import directives with System.* appearing first
37+
dotnet_sort_system_directives_first = true
38+
# Avoid "this." and "Me." if not necessary
39+
dotnet_style_qualification_for_field = false:suggestion
40+
dotnet_style_qualification_for_property = false:suggestion
41+
dotnet_style_qualification_for_method = false:suggestion
42+
dotnet_style_qualification_for_event = false:suggestion
43+
44+
# Use language keywords instead of framework type names for type references
45+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
46+
dotnet_style_predefined_type_for_member_access = true:suggestion
47+
48+
# Suggest more modern language features when available
49+
dotnet_style_object_initializer = true:suggestion
50+
dotnet_style_collection_initializer = true:suggestion
51+
dotnet_style_coalesce_expression = true:suggestion
52+
dotnet_style_null_propagation = true:suggestion
53+
dotnet_style_explicit_tuple_names = true:suggestion
54+
55+
# Naming Conventions:
56+
# Pascal Casing
57+
dotnet_naming_symbols.method_and_property_symbols.applicable_kinds= method,property,enum
58+
dotnet_naming_symbols.method_and_property_symbols.applicable_accessibilities = *
59+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
60+
61+
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.severity = warning
62+
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.symbols = method_and_property_symbols
63+
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.style = pascal_case_style
64+
65+
# Non-public members must be lower-case
66+
dotnet_naming_symbols.non_public_symbols.applicable_kinds = field
67+
dotnet_naming_symbols.non_public_symbols.applicable_accessibilities = private
68+
dotnet_naming_style.all_lower_case_style.capitalization = camel_case
69+
70+
dotnet_naming_rule.non_public_members_must_be_lower_case.severity = warning
71+
dotnet_naming_rule.non_public_members_must_be_lower_case.symbols = non_public_symbols
72+
dotnet_naming_rule.non_public_members_must_be_lower_case.style = all_lower_case_style
73+
74+
# CSharp code style settings:
75+
[*.cs]
76+
# Do not prefer "var" everywhere
77+
csharp_style_var_for_built_in_types = true:error
78+
csharp_style_var_when_type_is_apparent = true:error
79+
csharp_style_var_elsewhere = true:error
80+
81+
# Prefer method-like constructs to have a block body
82+
csharp_style_expression_bodied_methods = true:suggestion
83+
csharp_style_expression_bodied_constructors = true:suggestion
84+
csharp_style_expression_bodied_operators = true:suggestion
85+
86+
# Prefer property-like constructs to have an expression-body
87+
csharp_style_expression_bodied_properties = true:suggestion
88+
csharp_style_expression_bodied_indexers = true:suggestion
89+
csharp_style_expression_bodied_accessors = true:suggestion
90+
91+
# Suggest more modern language features when available
92+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
93+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
94+
csharp_style_inlined_variable_declaration = true:suggestion
95+
csharp_style_throw_expression = true:suggestion
96+
csharp_style_conditional_delegate_call = true:suggestion
97+
98+
# Newline settings
99+
csharp_new_line_before_open_brace = all
100+
csharp_new_line_before_else = true
101+
csharp_new_line_before_catch = true
102+
csharp_new_line_before_finally = true
103+
csharp_new_line_before_members_in_object_initializers = true
104+
csharp_new_line_before_members_in_anonymous_types = true
105+

Diff for: .gitattributes

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain
64+
65+
# Force bash scripts to always use lf line endings so that if a repo is accessed
66+
# in Unix via a file share from Windows, the scripts will work.
67+
*.sh text eol=lf

Diff for: CODE_OF_CONDUCT.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

Diff for: CodeStyles.targets

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<PropertyGroup>
5+
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Toolkit.ruleset</CodeAnalysisRuleSet>
6+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta006" PrivateAssets="All" />
11+
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" InProject="false" />
12+
</ItemGroup>
13+
14+
</Project>

Diff for: Contributing.md

+52-52
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
# Contributing to Xamarin Community Toolkit
1+
# Contributing
22

3-
The foundation of **Xamarin Community Toolkit** is simplicity and follow similar practices from the [UWP Community Toolkit](https://github.com/Microsoft/UWPCommunityToolkit).
3+
Thanks you for your interest in contributing to Xamarin Community Toolkit! In this document we'll outline what you need to know about contributing and how to get started.
44

5-
A developer should be able to quickly and easily learn to use the API.
5+
## Code of Conduct
66

7-
Simplicity and a low barrier to entry are must-have features of every API. If you have any second thoughts about the complexity of a design, it is almost always much better to cut the feature from the current release and spend more time to get the design right for the next release.
7+
Please see our [Code of Conduct](CODE_OF_CONDUCT.md).
88

9-
You can always add to an API, you cannot ever remove anything from one. If the design does not feel right, and you ship it anyway, you are likely to regret having done so.
9+
## Prerequisite
1010

11-
That's why many of the guidelines of this document are obvious and serve only one purpose: Simplicity.
11+
You will need to complete a Contribution License Agreement before any pull request can be accepted. Complete the CLA at https://cla2.dotnetfoundation.org/.
1212

13-
## A good pull request
14-
Every contribution has to come with:
1513

16-
* Before starting coding, **you should open an issue** and start discussing with the community to see if your idea/feature is interesting enough.
17-
* A documentation page in the [documentation folder](docs/). Once validated your documentation will be visible [here](http://formscommunitytoolkit.readthedocs.io/en/latest/).
18-
* A sample for the [Sample app]() (If applicable).
19-
* Unit tests (If applicable).
20-
* You tested your code with latest stable brandch of Xamarin and UWP SDK 10586 and SDK 14393.
21-
* PR has to target dev branch.
14+
## Documentation - mdoc
2215

23-
PR has to be validated by at least two core members before being merged.
16+
This project uses [mdoc](http://www.mono-project.com/docs/tools+libraries/tools/monodoc/generating-documentation/) to document types, members, and to add small code snippets and examples. mdoc files are simple xml files and there is an msbuild target you can invoke to help generate the xml placeholders.
2417

25-
Once merged, you can get a pre-release package of the toolkit be adding the appveyor [NuGet feed](https://ci.appveyor.com/nuget/formscommunitytoolkit).
18+
Read the [Documenting your code with mdoc wiki page](wiki/Documenting-your-code-with-mdoc) for more information on this process.
2619

27-
## Quality insurance for pull requests for controls
28-
We encourage developers to follow the following guidances when submitting pull requests for controls:
29-
* Your control must be usable and efficient with keyboard only.
30-
* Tab order must be logical.
31-
* Focused controls must be visible.
32-
* Action must be triggered when hitting Enter key.
33-
* Do not use custom colors but instead rely on theme colors so high contrasts themes can be used with your control.
34-
* Add AutomationProperties.Name on all controls to define what the controls purpose (Name is minimum, but there are some other things too that can really help the screen reader).
35-
* Don't use the same Name on two different elements unless they have different control types.
20+
Every pull request which affects public types or members should include corresponding mdoc xml file changes.
3621

37-
You can find more information about these topics [here](https://blogs.msdn.microsoft.com/winuiautomation/2015/07/14/building-accessible-windows-universal-apps-introduction)
3822

39-
This is to help as part of our effort to build an accessible toolkit.
23+
### Bug Fixes
4024

41-
## General rules
25+
If you're looking for something to fix, please browse [open issues](https://github.com/xamarin/XamarinCommunityToolkit/issues).
4226

43-
* DO NOT require that users perform any extensive initialization before they can start programming basic scenarios.
44-
* DO provide good defaults for all values associated with parameters, options, etc.
45-
* DO ensure that APIs are intuitive and can be successfully used in basic scenarios without referring to the reference documentation.
46-
* DO communicate incorrect usage of APIs as soon as possible.
47-
* DO design an API by writing code samples for the main scenarios. Only then, you define the object model that supports those code samples.
48-
* DO NOT use regions. DO use partial classes instead.
49-
* DO declare static dependency properties at the top of their file.
50-
* DO NOT seal controls.
51-
* DO use extension methods over static methods where possible.
52-
* DO NOT return true or false to give sucess status. Throw exceptions if there was a failure.
53-
* DO use verbs like GET.
54-
* DO NOT use verbs that are not already used like fetch.
27+
Follow the style used by the [.NET Foundation](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md), with two primary exceptions:
5528

56-
## Naming conventions
57-
* We are following the coding guidelines of [.NET Core Foundational libraries](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md).
29+
- We do not use the `private` keyword as it is the default accessibility level in C#.
30+
- We will **not** use `_` or `s_` as a prefix for internal or private field names
31+
- We will use `camelCaseFieldName` for naming internal or private fields in both instance and static implementations
5832

59-
## Documentation
60-
* DO NOT expect that your API is so well designed that it needs no documentation. No API is that intuitive.
61-
* DO provide great documentation with all APIs.
62-
* DO use readable and self-documenting identifier names.
63-
* DO use consistent naming and terminology.
64-
* DO provide strongly typed APIs.
65-
* DO use verbose identifier names.
33+
Read and follow our [Pull Request template](https://github.com/xamarin/XamarinCommunityToolkit/blob/master/PULL_REQUEST_TEMPLATE.md)
6634

67-
## Files and folders
68-
* DO associate no more than one class per file.
69-
* DO use folders to group classes based on features.
35+
### Proposals
36+
37+
To propose a change or new feature, review the guidance below and then [open an issue using this template](https://github.com/xamarin/XamarinCommunityToolkit/issues/new).
38+
39+
#### Non-Starter Topics
40+
The following topics should generally not be proposed for discussion as they are non-starters:
41+
42+
* Large renames of APIs
43+
* Large non-backward-compatible breaking changes
44+
* Platform-Specifics which can be accomplished without changing Xamarin Community Toolkit
45+
* Avoid clutter posts like "+1" which do not serve to further the conversation
46+
47+
#### Proposal States
48+
##### Open
49+
Open proposals are still under discussion. Please leave your concrete, constructive feedback on this proposal. +1s and other clutter posts which do not add to the discussion will be removed.
50+
51+
##### Accepted
52+
Accepted proposals are proposals that both the community and core XamarinCommunityToolkit agree should be a part of XamarinCommunityToolkit. These proposals are ready for implementation, but do not yet have a developer actively working on them. These proposals are available for anyone to work on, both community and the core XamarinCommunityToolkit team.
53+
54+
If you wish to start working on an accepted proposal, please reply to the thread so we can mark you as the implementor and change the title to In Progress. This helps to avoid multiple people working on the same thing. If you decide to work on this proposal publicly, feel free to post a link to the branch as well for folks to follow along.
55+
56+
###### What "Accepted" does mean
57+
* Any community member is welcome to work on the idea.
58+
* The core XamarinCommunityToolkit team _may_ consider working on this idea on their own, but has not done so until it is marked "In Progress" with a team member assigned as the implementor.
59+
* Any pull request implementing the proposal will be welcomed with an API and code review.
60+
61+
###### What "Accepted" does not mean
62+
* The proposal will ever be implemented, either by a community member or by the core XamarinCommunityToolkit team.
63+
* The core XamarinCommunityToolkit team is committing to implementing a proposal, even if nobody else does. Accepted proposals simply mean that the core XamarinCommunityToolkit team and the community agree that this proposal should be a part of XamarinCommunityToolkit.
64+
65+
##### In Progress
66+
Once a developer has begun work on a proposal, either from the core XamarinCommunityToolkit team or a community member, the proposal is marked as in progress with the implementors name and (possibly) a link to a development branch to follow along with progress.
67+
68+
#### Rejected
69+
Rejected proposals will not be implemented or merged into XamarinCommunityToolkit. Once a proposal is rejected, the thread will be closed and the conversation is considered completed, pending considerable new information or changes.

0 commit comments

Comments
 (0)