Skip to content

Commit

Permalink
chore: initial setup (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
saan800 authored Jul 22, 2024
1 parent cc95226 commit 2259a09
Show file tree
Hide file tree
Showing 47 changed files with 1,492 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"caseSensitive": false,
"language": "en-GB",
"useGitignore": true,
"dictionaries": [
"project-dictionary"
],
"ignorePaths": [
"LICENSE",
".gitignore",
".editorconfig",
"./.githooks/**",
"./.github/dependabot.yml",
"./.github/workflows/**",
"./.vscode/extensions.json",
"./dictionary.dic",
"./Directory.*.props",
"./Directory.*.targets",
"**/*.csproj"
],
"dictionaryDefinitions": [
{
"name": "project-dictionary",
"path": "./dictionary.dic",
"description": "Words used in this project",
"addWords": true
}
],
}
168 changes: 168 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
spelling_languages = en-GB
spelling_error_severity = warning
spelling_exclusion_path = .\dictionary.dic

[*.json]
insert_final_newline = false

[*.md]
max_line_length = off
trim_trailing_whitespace = false

[*.{yml,yaml}]
max_line_length = off

[*.sln, *.csproj, *.ruleset, *.props, *.targets]
max_line_length = off

[*.cs]
indent_size = 4

################# .NET Coding Conventions #################
# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = true
file_header_template = unset

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent

# Expression-level preferences
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion

# Field preferences
dotnet_style_readonly_field = true:warning

# Parameter preferences
dotnet_code_quality_unused_parameters = all:suggestion

# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none


################# C# Coding Conventions #################

# var preferences
csharp_style_var_elsewhere = true:silent
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent

# Expression-bodied members
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent

# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_switch_expression = true:suggestion

# Null-checking preferences
csharp_style_conditional_delegate_call = true:suggestion

# Modifier preferences
csharp_prefer_static_local_function = true:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent

# Code-block preferences
csharp_prefer_braces = true:silent
csharp_prefer_simple_using_statement = true:suggestion

# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:silent

# namespace preferences
csharp_style_namespace_declarations = file_scoped

################## C# Formatting Rules ##################

# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true

# Space preferences
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 = false
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

# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
22 changes: 22 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

rootDirectory="$(dirname -- "$0")/.."
source "$rootDirectory/scripts/colours.sh"
export ROOT_DIR="$rootDirectory"

echo "${CYAN}Running commit-msg hooks${NC}"

# Read the commit message from the file
commit_message_file=$1
commit_message=$(cat "$commit_message_file")

"$rootDirectory/scripts/validate-commit-message.sh" "$commit_message"

# Check the exit code of the script
if [ $? -ne 0 ]; then
echo "${RED}Error: Script failed, aborting commit.${NC}"
exit 1
fi

echo ""
exit 0
24 changes: 24 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

rootDirectory="$(dirname -- "$0")/.."
source "$rootDirectory/scripts/colours.sh"
export ROOT_DIR="$rootDirectory"

echo "${CYAN}Running pre-commit hooks${NC}"

staged_files=$(git diff --cached --name-only --diff-filter=ACMR)

"$rootDirectory/scripts/validate-branch-name.sh"
"$rootDirectory/scripts/lint-dotnet.sh" "$staged_files"

# Check the exit code of the script
if [ $? -ne 0 ]; then
echo "${RED}Error: Script failed, aborting commit.${NC}"
exit 1
fi

# Add any modified files to the staging area
git add $staged_files

echo ""
exit 0
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

### Describe the bug

A clear and concise description of what the bug is.

### Actual behaviour

A clear and concise description of what is currently happening.

##### Screenshots

If applicable, add screenshots to help explain your problem.

### Expected behaviour
A clear and concise description of what you expected to happen.

### How to reproduce
Steps to reproduce the behaviour:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

### Environment

##### Desktop (please complete the following information):
- OS: [e.g. Mac, Windows]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

##### Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

### Additional context
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

### What problem are you trying to solve?
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

### Describe the solution you'd like
A clear and concise description of what you want to happen.

### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

### Additional context
Add any other context, diagrams or screenshots about the feature request here.
35 changes: 35 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
day: friday
time: "05:00"
timezone: "Australia/Perth"
commit-message:
prefix: "dependencies(github-actions): "

- package-ecosystem: nuget
directory: "/"
groups:
microsoft:
patterns:
- Microsoft*
update-types: ["minor", "patch"]
testing:
patterns:
- AutoFixture*
- coverlet*
- FluentAssertions*
- GitHubActionsTestLogger
- xunit*
update-types: ["minor", "patch"]
schedule:
interval: weekly
day: friday
time: "05:00"
timezone: "Australia/Perth"
commit-message:
prefix: "dependencies(nuget): "
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### :spiral_notepad: Description

<!-- Please describe what you added, and add a screenshot if possible.
That makes it easier to understand the change so we can approve it faster. -->

### :white_check_mark: Checklist

<!--- Please include the following in your Pull Request when applicable -->

- [ ] Linked to any related issues in the PR description
- [ ] Added or updated documentation
- [ ] Tests for new functionality and regression tests for bug fixes
- [ ] Breaking changes were made
Loading

0 comments on commit 2259a09

Please sign in to comment.