Skip to content

Commit

Permalink
Merge pull request #134 from keenlabs/jm_FormattingConfigChanges
Browse files Browse the repository at this point in the history
Formatting/convention config changes
  • Loading branch information
masojus authored Nov 12, 2017
2 parents a528e6f + 425654b commit 536b56b
Show file tree
Hide file tree
Showing 74 changed files with 650 additions and 382 deletions.
170 changes: 170 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Based on the Roslyn and CoreCLR .editorconfig files:
# https://github.com/dotnet/roslyn/blob/master/.editorconfig
# https://github.com/dotnet/coreclr/blob/master/.editorconfig

# This is the top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8
# Note we're not using utf-8-bom anywhere, though some projects choose to use it for .cs/.vb files.
# Hopefully most devs contributing here will have an editorconfig-friendly IDE/plugin that won't
# automatically try to add the BOM back in.

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# JSON/YAML files
[*.{json,yml,yaml}]
indent_size = 2
charset = utf-8

# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference

# Dotnet code style settings:
[*.{cs,vb}]
## Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true

## Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

## Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

## Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion

# CSharp code style settings:
[*.cs]
## Prefer "var" when it's pretty clear what the type is
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:none

## Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none

## Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

## Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

## Braces
csharp_prefer_braces = true

## Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

## Indentation
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left

## Spacing
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style

dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# name all readonly fields using PascalCase
dotnet_naming_rule.readonly_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.readonly_fields_should_be_pascal_case.symbols = readonly_fields
dotnet_naming_rule.readonly_fields_should_be_pascal_case.style = pascal_case_style

dotnet_naming_symbols.readonly_fields.applicable_kinds = field
dotnet_naming_symbols.readonly_fields.required_modifiers = readonly


# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style

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 = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case

# async methods end in Async
dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods
dotnet_naming_rule.async_methods_end_in_async.style = end_in_async
dotnet_naming_rule.async_methods_end_in_async.severity = suggestion

dotnet_naming_symbols.any_async_methods.applicable_kinds = method
dotnet_naming_symbols.any_async_methods.applicable_accessibilities = *
dotnet_naming_symbols.any_async_methods.required_modifiers = async

### NOTE : unfortunately just looking for the 'async' modifier won't catch all methods that
### return an awaitable.

dotnet_naming_style.end_in_async.required_suffix = Async
dotnet_naming_style.end_in_async.capitalization = pascal_case
133 changes: 112 additions & 21 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Mostly based on the templates here:
# https://github.com/alexkaratarakis/gitattributes

###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
Expand All @@ -6,11 +9,35 @@
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
# This is only used by command line
###############################################################################
#*.cs diff=csharp
*.cs text diff=csharp
*.bat text eol=crlf
*.ini text
*.json text
*.sh text eol=lf
*.ps1 text

## CONFIGS
*.bowerrc text
*.cnf text
*.conf text
*.config text
.browserslistrc text
.editorconfig text
.gitattributes text
.gitconfig text
.gitignore text
.htaccess text
*.npmignore text
*.yaml text
*.yml text
browserslist text
Makefile text
makefile text
*.xml text
*.nunit text
*.nuspec text

###############################################################################
# Set the merge driver for project and solution files
Expand All @@ -20,8 +47,27 @@
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
# intervention with every merge. To do so, just comment the entries below and
# uncomment the group further below
###############################################################################
*.sln text eol=crlf
*.csproj text eol=crlf
*.vbproj text eol=crlf
*.vcxproj text eol=crlf
*.vcproj text eol=crlf
*.dbproj text eol=crlf
*.fsproj text eol=crlf
*.lsproj text eol=crlf
*.wixproj text eol=crlf
*.modelproj text eol=crlf
*.sqlproj text eol=crlf
*.wmaproj text eol=crlf

*.xproj text eol=crlf
*.props text eol=crlf
*.filters text eol=crlf
*.vcxitems text eol=crlf

#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
Expand All @@ -35,29 +81,74 @@
#*.sqlproj merge=binary
#*.wwaproj merge=binary

#*.xproj merge=binary
#*.props merge=binary
#*.filters merge=binary
#*.vcxitems merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
# SVG treated as an asset (binary) by default. If you want to treat it as text,
# comment-out the following line and uncomment the line after.
*.svg binary
#*.svg text
*.eps binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
# is only available from the command line.
###############################################################################
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.adoc text
*.textile text
*.mustache text
*.csv text
*.tab text
*.tsv text
*.sql text

## DOCUMENTATION
*.markdown text
*.md text
*.mdwn text
*.mdown text
*.mkd text
*.mkdn text
*.mdtxt text
*.mdtext text
*.txt text
AUTHORS text
CHANGELOG text
CHANGES text
CONTRIBUTING text
COPYING text
copyright text
*COPYRIGHT* text
INSTALL text
license text
LICENSE text
NEWS text
readme text
*README* text
TODO text
6 changes: 3 additions & 3 deletions Keen.NetStandard.Test/AddOnsTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Keen.Core.DataEnrichment;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using Keen.Core.DataEnrichment;
using NUnit.Framework;


namespace Keen.Core.Test
Expand Down Expand Up @@ -38,7 +38,7 @@ public void IpToGeo_Send_Success()

var a = AddOn.IpToGeo("an_ip", "geocode");

Assert.DoesNotThrow(() => client.AddEvent("AddOnTest", new {an_ip = "70.187.8.97"}, new List<AddOn> {a}));
Assert.DoesNotThrow(() => client.AddEvent("AddOnTest", new { an_ip = "70.187.8.97" }, new List<AddOn> { a }));
}

[Test]
Expand Down
6 changes: 3 additions & 3 deletions Keen.NetStandard.Test/DatasetTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Keen.Core.Dataset;
using System.Collections.Generic;
using System.Threading.Tasks;
using Keen.Core.Dataset;
using Keen.Core.Query;
using Moq;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using System.Collections.Generic;
using System.Threading.Tasks;


namespace Keen.Core.Test
Expand Down
8 changes: 4 additions & 4 deletions Keen.NetStandard.Test/DatasetTests_Integration.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using Keen.Core.Dataset;
using Keen.Core.Query;
using Moq;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Keen.Core.Dataset;
using Keen.Core.Query;
using Moq;
using NUnit.Framework;


namespace Keen.Core.Test
Expand Down
2 changes: 1 addition & 1 deletion Keen.NetStandard.Test/DelegatingHandlerMock.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Net.Http;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

Expand Down
Loading

0 comments on commit 536b56b

Please sign in to comment.