Visitar URL original
Copy .editorconfig from dotnet/corefx repo by danielcweber · Pull Request #584 · dotnet/reactive · GitHub
Skip to content

Copy .editorconfig from dotnet/corefx repo - #584

Merged
clairernovotny merged 7 commits into
dotnet:masterfrom
danielcweber:Editorconfig
Jun 18, 2018
Merged

clairernovotny merged 7 commits into
dotnet:masterfrom
danielcweber:Editorconfig

Conversation

@danielcweber

Copy link
Copy Markdown
Collaborator

This repo should adhere to the coding guidlines defined in https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md. Assuming their .editorconfig exactly captures these guidelines, they have been copied here.

@akarnokd

Copy link
Copy Markdown
Collaborator

Is there a way to have a list of nonconforming files and lines or it is required to open each .cs file?

@danielcweber

Copy link
Copy Markdown
Collaborator Author

Investigating. So far I didn't find a way to scan the whole sln, however, ReSharper understands .editorconfig as well and is able to perform a full scan.

@danielcweber

Copy link
Copy Markdown
Collaborator Author

I know you don't like ReSharper too much, are you currently working on something that should be pushed before? Otherwise, I would enforce the code style now.

@akarnokd

akarnokd commented Jun 12, 2018 •

Copy link
Copy Markdown
Collaborator

I'm working on adding unit tests that verify the recent changes in components based on code coverage. I don't plan to change anything other than test files.

@danielcweber danielcweber changed the title Copy .editorconfig dotnet/corefx repo Copy .editorconfig from dotnet/corefx repo Jun 12, 2018
@clairernovotny

Copy link
Copy Markdown
Contributor

We do not need to follow their rules explicitly. Many of them sure, but for others like var, we don't need to be as strict as them. I'd go the other way and say we should always use var.

Comment thread .editorconfig Outdated
dotnet_style_qualification_for_event = false:suggestion

# Use language keywords instead of framework type names for type references
# only use var when it's obvious what the variable type is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with this this section

Comment thread .editorconfig Outdated

# Use language keywords instead of framework type names for type references
# only use var when it's obvious what the variable type is
csharp_style_var_for_built_in_types = false:none

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be true:suggestion

Comment thread .editorconfig Outdated
# Use language keywords instead of framework type names for type references
# only use var when it's obvious what the variable type is
csharp_style_var_for_built_in_types = false:none
csharp_style_var_when_type_is_apparent = false:none

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be true:suggestion

Comment thread .editorconfig Outdated
# only use var when it's obvious what the variable type is
csharp_style_var_for_built_in_types = false:none
csharp_style_var_when_type_is_apparent = false:none
csharp_style_var_elsewhere = false:suggestion

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be true:suggestion

Comment thread .editorconfig Outdated

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# static fields should have s_ prefix

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule is terrible...IMO.

@danielcweber danielcweber Jun 12, 2018 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReSharper suggests pascal case with no underscore, which I follow elsewhere. Up to debate. This is what this thread is for.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who prefers what for static fields?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The s_-prefix requirement has been dropped. Static fields should be pascal cased.

Comment thread .editorconfig
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal

dotnet_naming_style.camel_case_underscore_style.required_prefix = _

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also hate having an underscore prefix.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, on the other hand, is preferred by me.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this style is present throughout most of the repo, but I can change the config if everybody agrees.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akarnokd and me settled on keeping underscores as a compromise, for safety reasons, to make code more readably outside VS (github, git diff, etc) and since it's used throughout Rx sources today.

Comment thread .editorconfig Outdated

# Code style defaults
dotnet_sort_system_directives_first = true
dotnet_style_require_accessibility_modifiers = always

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this but can go either way. I prefer omit_if_default so that accessibility modifiers are only present if they differ from what the language provides.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have it explicit to be clear for anybody who contributes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to omit_if_default to have less redundancies.

@akarnokd

Copy link
Copy Markdown
Collaborator

It will probably create impossible cases, for example:

image

If you have var you have to default it to some type, which by definition will be ignored. Having IDisposable[] previousDisposable; will complain about not using var.

@danielcweber

Copy link
Copy Markdown
Collaborator Author

So, is there anything we definitely want to take from the corefx-config? We might as well settle with the original config or enhance that.

@danielcweber

danielcweber commented Jun 14, 2018 •

Copy link
Copy Markdown
Collaborator Author

@onovotny We have settled on some changes. Do you think we can go with the proposed .editorconfig?

@clairernovotny

Copy link
Copy Markdown
Contributor

Looks good, the only suggestion I would add is to specify yaml/yml as indent size of 2. Otherwise, LGTM.

@danielcweber

Copy link
Copy Markdown
Collaborator Author

@onovotny Can you access the build-logs? I can't, that has been happening occasionally for a while now.

@clairernovotny

Copy link
Copy Markdown
Contributor

I don't see the logs either but am looking into it via other avenues.

@clairernovotny
clairernovotny merged commit d1e3405 into dotnet:master Jun 18, 2018
@danielcweber
danielcweber deleted the Editorconfig branch June 19, 2018 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants