Skip to content

Commit

Permalink
Apply new project formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PrincessRTFM authored Mar 12, 2024
2 parents 064c4ad + ae5492b commit 9a93244
Show file tree
Hide file tree
Showing 18 changed files with 1,685 additions and 1,538 deletions.
210 changes: 210 additions & 0 deletions HuntBuddy/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true

[*]

# Indentation and spacing
indent_size = 4
indent_style = tab

# New line preferences
end_of_line = crlf
insert_final_newline = true

# C# files
[*.cs]

# Organize usings
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
file_header_template = unset

# this. and Me. preferences
dotnet_style_qualification_for_event = true:warning
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_method = true:warning
dotnet_style_qualification_for_property = true:warning

# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning

# 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

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning

# Expression-level preferences
dotnet_style_coalesce_expression = true:warning
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_null_propagation = true:error
dotnet_style_object_initializer = true:warning
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_compound_assignment = true:warning
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:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
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:suggestion

# Parameter preferences
dotnet_code_quality_unused_parameters = all:suggestion

# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none

# var preferences
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = false:warning

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

# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_prefer_extended_property_pattern = true:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_pattern_matching = true:warning
csharp_style_prefer_switch_expression = true:warning

# Null-checking preferences
csharp_style_conditional_delegate_call = true:warning

# 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,required,volatile,async:silent
csharp_prefer_readonly_struct = true:warning

# Code-block preferences
csharp_prefer_braces = when_multiline:warning
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = file_scoped:error
csharp_style_prefer_top_level_statements = false:error

# 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_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_tuple_swap = true:error
csharp_style_prefer_null_check_over_type_check = true:error
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:silent
csharp_style_unused_value_expression_statement_preference = discard_variable:silent

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:suggestion

# 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 = none
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 = false
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 = false

#### Naming styles ####

# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case

dotnet_naming_style.I_prefix_style.required_prefix = I
dotnet_naming_style.I_prefix_style.capitalization = pascal_case

dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case

# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning
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.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const

# Use PascalCase for public fields
dotnet_naming_rule.pascal_case_for_public_fields.severity = warning
dotnet_naming_rule.pascal_case_for_public_fields.symbols = public_fields
dotnet_naming_rule.pascal_case_for_public_fields.style = pascal_case_style
dotnet_naming_symbols.public_fields.applicable_kinds = field
dotnet_naming_symbols.public_fields.applicable_accessibilities = public

# internal and private fields should be camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning
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

# Interfaces must be PascalCase and have an I prefix
dotnet_naming_rule.interfaces_start_with_I.severity = warning
dotnet_naming_rule.interfaces_start_with_I.symbols = any_interface
dotnet_naming_rule.interfaces_start_with_I.style = I_prefix_style
dotnet_naming_symbols.any_interface.applicable_kinds = interface
dotnet_naming_symbols.any_interface.applicable_accessibilities = *

# Classes, structs, methods, enums, events, properties, namespaces, delegates must be PascalCase
dotnet_naming_rule.general_naming.severity = warning
dotnet_naming_rule.general_naming.symbols = general
dotnet_naming_rule.general_naming.style = pascal_case_style
dotnet_naming_symbols.general.applicable_kinds = class,struct,enum,property,method,event,namespace,delegate
dotnet_naming_symbols.general.applicable_accessibilities = *
19 changes: 8 additions & 11 deletions HuntBuddy/Attributes/AliasesAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using System;

namespace HuntBuddy.Attributes
{
[AttributeUsage(AttributeTargets.Method)]
public class AliasesAttribute : Attribute
{
public string[] Aliases { get; }
namespace HuntBuddy.Attributes;

public AliasesAttribute(params string[] aliases)
{
this.Aliases = aliases;
}
[AttributeUsage(AttributeTargets.Method)]
public class AliasesAttribute: Attribute {
public string[] Aliases {
get;
}
}

public AliasesAttribute(params string[] aliases) => this.Aliases = aliases;
}
19 changes: 7 additions & 12 deletions HuntBuddy/Attributes/CommandAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
using System;

namespace HuntBuddy.Attributes
{
[AttributeUsage(AttributeTargets.Method)]
public class CommandAttribute : Attribute
{
public string Command { get; }
namespace HuntBuddy.Attributes;

public CommandAttribute(string command)
{
this.Command = command;
}
}
}
[AttributeUsage(AttributeTargets.Method)]
public class CommandAttribute: Attribute {
public string Command { get; }

public CommandAttribute(string command) => this.Command = command;
}
11 changes: 4 additions & 7 deletions HuntBuddy/Attributes/DoNotShowInHelpAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;

namespace HuntBuddy.Attributes
{
[AttributeUsage(AttributeTargets.Method)]
public class DoNotShowInHelpAttribute : Attribute
{
}
}
namespace HuntBuddy.Attributes;

[AttributeUsage(AttributeTargets.Method)]
public class DoNotShowInHelpAttribute: Attribute;
19 changes: 8 additions & 11 deletions HuntBuddy/Attributes/HelpMessageAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using System;

namespace HuntBuddy.Attributes
{
[AttributeUsage(AttributeTargets.Method)]
public class HelpMessageAttribute : Attribute
{
public string HelpMessage { get; }
namespace HuntBuddy.Attributes;

public HelpMessageAttribute(string helpMessage)
{
this.HelpMessage = helpMessage;
}
[AttributeUsage(AttributeTargets.Method)]
public class HelpMessageAttribute: Attribute {
public string HelpMessage {
get;
}
}

public HelpMessageAttribute(string helpMessage) => this.HelpMessage = helpMessage;
}
39 changes: 19 additions & 20 deletions HuntBuddy/Configuration.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
using System.Numerics;
using System.Text.Json.Serialization;

using Dalamud.Configuration;

namespace HuntBuddy
{
public class Configuration : IPluginConfiguration
{
public int Version { get; set; }
namespace HuntBuddy;

public class Configuration: IPluginConfiguration {
public int Version {
get;
set;
}

public bool IncludeAreaOnMap;
public bool LockWindowPositions;
public bool ShowLocalHunts;
public bool ShowLocalHuntIcons;
public bool HideLocalHuntBackground;
public bool HideCompletedHunts;
public float IconScale = 1f;
public Vector4 IconBackgroundColour = new (0.76f, 0.75f, 0.76f, 0.8f);
public bool IncludeAreaOnMap;
public bool LockWindowPositions;
public bool ShowLocalHunts;
public bool ShowLocalHuntIcons;
public bool HideLocalHuntBackground;
public bool HideCompletedHunts;
public float IconScale = 1f;
public Vector4 IconBackgroundColour = new(0.76f, 0.75f, 0.76f, 0.8f);

[JsonIgnore] public uint IconBackgroundColourU32;
[JsonIgnore] public uint IconBackgroundColourU32;

public void Save()
{
Service.PluginInterface.SavePluginConfig(this);
}
}
}
public void Save() => Service.PluginInterface.SavePluginConfig(this);
}
Loading

0 comments on commit 9a93244

Please sign in to comment.