Skip to content
Permalink
Browse files

Code cleanup (#36)

* Language usage optimization.

* Removed unused enum value.

* Fixed issue "Trivial properties should be auto-implemented."

* Whitespace.

* Fixed issue "Use the overloading mechanism instead of the optional parameters."

* Whitespace.

* Fixed issue "Enumeration types should comply with a naming convention"

* Fixed issue "Use the overloading mechanism instead of the optional parameters."

* Fixed issue "Track lack of copyright and license headers"

* Updated header comment format.

* Removed BOM from files.

* Removed whitespace from header comment block.

* Updated comment header.

* Fixed issue "Optional parameters should not be used"

* Set properties to readonly.

* Disabled warnings for switch statements.

* Added warning numbers.

* Disabled warnings for abstract classes that extend another class.

* Set property to readonly.

* Set property to readonly.

* Disabled warnings for Unused private types or members should be removed .

* Updated warning number.

* Added sonar config.

* Fixed issue "Reduce the number of conditional operators (5) used in the expression (maximum allowed 3)."

* Fixed issue "Rename property to match camel case naming rules."

* Disable warning in custom AnimationCurve structs file.

* Fixed issue "Rename property to match camel case naming rules."

* Simplified logic in CameraFollow2D script.

* Disabled warning.

* Fixed issue "Fields that are only assigned in the constructor should be "readonly""

* Simplified logic in CameraFollow3D script.

* Removed unsed property on object.

* Removed unused reference to object.

* Simplified code.

* Fixed issue "Types should be defined in named namespaces"

* Updated comment.

* Fixed issue "Types should be defined in named namespaces"

* Whitespace.

* Removed unused method.
  • Loading branch information
neogeek committed Aug 7, 2018
1 parent 7d83773 commit 3e22a4b9932c6248d115c8336ef839f95089fa16
Showing with 1,083 additions and 282 deletions.
  1. +1 βˆ’0 .gitignore
  2. +8 βˆ’6 Assets/Editor/CalculationTest.cs
  3. +16 βˆ’14 Assets/Editor/CustomExtensionsTest.cs
  4. +26 βˆ’24 Assets/Editor/ObservableListTest.cs
  5. +10 βˆ’8 Assets/Editor/RunnerTest.cs
  6. +8 βˆ’6 Assets/Editor/ScriptableObjectTest.cs
  7. +3 βˆ’1 Assets/Plugins/CandyCoded/ScriptableObjects/BoolReference.cs
  8. +5 βˆ’0 Assets/Plugins/CandyCoded/ScriptableObjects/CustomGenericScriptableObject.cs
  9. +3 βˆ’1 Assets/Plugins/CandyCoded/ScriptableObjects/CustomScriptableObject.cs
  10. +3 βˆ’1 Assets/Plugins/CandyCoded/ScriptableObjects/FloatReference.cs
  11. +2 βˆ’0 Assets/Plugins/CandyCoded/ScriptableObjects/GameObjectListReference.cs
  12. +3 βˆ’1 Assets/Plugins/CandyCoded/ScriptableObjects/IntReference.cs
  13. +5 βˆ’0 Assets/Plugins/CandyCoded/ScriptableObjects/ListReference.cs
  14. +30 βˆ’8 Assets/Plugins/CandyCoded/ScriptableObjects/ObjectPoolReference.cs
  15. +6 βˆ’1 Assets/Plugins/CandyCoded/ScriptableObjects/ObservableListReference.cs
  16. +3 βˆ’1 Assets/Plugins/CandyCoded/ScriptableObjects/StringReference.cs
  17. +100 βˆ’27 Assets/Plugins/CandyCoded/Scripts/Animate.cs
  18. +22 βˆ’41 Assets/Plugins/CandyCoded/Scripts/AnimationData.cs
  19. +4 βˆ’2 Assets/Plugins/CandyCoded/Scripts/Calculation.cs
  20. +6 βˆ’1 Assets/Plugins/CandyCoded/Scripts/Components/BillboardTowardsCamera.cs
  21. +106 βˆ’35 Assets/Plugins/CandyCoded/Scripts/Components/CameraFollow2D.cs
  22. +93 βˆ’43 Assets/Plugins/CandyCoded/Scripts/Components/CameraFollow3D.cs
  23. +23 βˆ’16 Assets/Plugins/CandyCoded/Scripts/Components/Gizmo.cs
  24. +54 βˆ’7 Assets/Plugins/CandyCoded/Scripts/Components/ScreenShake.cs
  25. +5 βˆ’0 Assets/Plugins/CandyCoded/Scripts/Components/SelfDestructParticleSystem.cs
  26. +9 βˆ’2 Assets/Plugins/CandyCoded/Scripts/CustomEditor/DisplayInInspector.cs
  27. +10 βˆ’3 Assets/Plugins/CandyCoded/Scripts/CustomEditor/EnumMask.cs
  28. +41 βˆ’12 Assets/Plugins/CandyCoded/Scripts/CustomEditor/ObservableList.cs
  29. +9 βˆ’2 Assets/Plugins/CandyCoded/Scripts/CustomEditor/Structs.cs
  30. +38 βˆ’9 Assets/Plugins/CandyCoded/Scripts/CustomExtensions.cs
  31. +59 βˆ’3 Assets/Plugins/CandyCoded/Scripts/Debugger.cs
  32. +5 βˆ’3 Assets/Plugins/CandyCoded/Scripts/Materials.cs
  33. +3 βˆ’1 Assets/Plugins/CandyCoded/Scripts/Math.cs
  34. +3 βˆ’1 Assets/Plugins/CandyCoded/Scripts/Raycast.cs
  35. +4 βˆ’2 Assets/Plugins/CandyCoded/Scripts/Runner.cs
  36. +6 βˆ’0 sonar-project.properties
  37. +351 βˆ’0 sonar-quality-profile.ruleset
@@ -36,6 +36,7 @@ sysinfo.txt
*.apk
*.unitypackage

/.scannerwork/
/.vscode/

/Packages/
@@ -1,4 +1,6 @@
using NUnit.Framework;
// Copyright (c) Scott Doxey. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.

using NUnit.Framework;
using UnityEditor.SceneManagement;
using UnityEngine;

@@ -17,22 +19,22 @@ public void ResetScene()
public void BoundsCalculatedOnMultipleChildrenObjects()
{

GameObject parentGameObject = new GameObject("ParentGameObject");
var parentGameObject = new GameObject("ParentGameObject");
parentGameObject.transform.position = new Vector3(5f, 5f, 5f);

GameObject cube1 = GameObject.CreatePrimitive(PrimitiveType.Cube);
var cube1 = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube1.transform.position = Vector3.back * 2;
cube1.transform.parent = parentGameObject.transform;

GameObject cube2 = GameObject.CreatePrimitive(PrimitiveType.Cube);
var cube2 = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube2.transform.position = Vector3.left * 2;
cube2.transform.parent = parentGameObject.transform;

GameObject cube3 = GameObject.CreatePrimitive(PrimitiveType.Cube);
var cube3 = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube3.transform.position = Vector3.right;
cube3.transform.parent = parentGameObject.transform;

Bounds bounds = CandyCoded.Calculation.ParentBounds(parentGameObject);
var bounds = CandyCoded.Calculation.ParentBounds(parentGameObject);

Assert.AreEqual(new Vector3(-0.5f, 0, -1.0f), bounds.center);
Assert.AreEqual(new Vector3(-2.5f, -0.5f, -2.5f), bounds.min);
@@ -1,4 +1,6 @@
using System.Collections.Generic;
// Copyright (c) Scott Doxey. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Collections.Generic;
using NUnit.Framework;
using UnityEditor.SceneManagement;
using UnityEngine;
@@ -23,11 +25,11 @@ public void ResetScene()
public void AddOrGetComponent()
{

GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

Assert.IsNull(cube.GetComponent<SampleController>());

SampleController sampleController = cube.AddOrGetComponent<SampleController>();
var sampleController = cube.AddOrGetComponent<SampleController>();

Assert.IsNotNull(cube.GetComponent<SampleController>());

@@ -68,7 +70,7 @@ public void BitwiseContains()
public void EditKeyframeValueAnimationCurve()
{

AnimationCurve animationCurve = AnimationCurve.Linear(0, 0, 1, 1);
var animationCurve = AnimationCurve.Linear(0, 0, 1, 1);

animationCurve.EditKeyframeValue(0, 10);

@@ -80,7 +82,7 @@ public void EditKeyframeValueAnimationCurve()
public void EditKeyframeValueVector3AnimationCurve()
{

CandyCoded.Vector3AnimationCurve animationCurve = new CandyCoded.Vector3AnimationCurve();
var animationCurve = new CandyCoded.Vector3AnimationCurve();

animationCurve.x = AnimationCurve.Linear(0, 0, 1, 1);
animationCurve.y = AnimationCurve.Linear(0, 0, 1, 1);
@@ -102,7 +104,7 @@ public void EditKeyframeValueVector3AnimationCurve()
public void EditKeyframeValueVector2AnimationCurve()
{

CandyCoded.Vector2AnimationCurve animationCurve = new CandyCoded.Vector2AnimationCurve();
var animationCurve = new CandyCoded.Vector2AnimationCurve();

animationCurve.x = AnimationCurve.Linear(0, 0, 1, 1);
animationCurve.y = AnimationCurve.Linear(0, 0, 1, 1);
@@ -121,7 +123,7 @@ public void EditKeyframeValueVector2AnimationCurve()
public void IsLoopingAnimationCurve()
{

AnimationCurve animationCurve = AnimationCurve.Linear(0, 0, 1, 1);
var animationCurve = AnimationCurve.Linear(0, 0, 1, 1);

Assert.IsFalse(animationCurve.IsLooping());

@@ -135,7 +137,7 @@ public void IsLoopingAnimationCurve()
public void ListShuffle()
{

List<int> numberRange = new List<int>();
var numberRange = new List<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -150,7 +152,7 @@ public void ListShuffle()
public void ListShuffleWithoutChangingReference()
{

List<int> numberRange = new List<int>();
var numberRange = new List<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -170,7 +172,7 @@ public void ListShuffleWithoutChangingReference()
public void ListSlice()
{

List<int> numberRange = new List<int>();
var numberRange = new List<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -186,7 +188,7 @@ public void ListSlice()
public void ListSliceWithoutIndex()
{

List<int> numberRange = new List<int>();
var numberRange = new List<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -202,7 +204,7 @@ public void ListSliceWithoutIndex()
public void ListSplice()
{

List<int> numberRange = new List<int>();
var numberRange = new List<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -218,7 +220,7 @@ public void ListSplice()
public void ListSpliceWithoutIndex()
{

List<int> numberRange = new List<int>();
var numberRange = new List<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -234,7 +236,7 @@ public void ListSpliceWithoutIndex()
public void MaxTimeAnimationCurve()
{

AnimationCurve animationCurve = AnimationCurve.Linear(0, 0, 1, 1);
var animationCurve = AnimationCurve.Linear(0, 0, 1, 1);

Assert.AreEqual(1, animationCurve.MaxTime());

@@ -1,4 +1,6 @@
using System.Collections.Generic;
// Copyright (c) Scott Doxey. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using UnityEditor.SceneManagement;
@@ -21,7 +23,7 @@ public void ResetScene()
public void CreateObservableList()
{

ObservableList<int> list = new ObservableList<int>();
var list = new ObservableList<int>();

Assert.AreEqual(0, list.Count);

@@ -31,7 +33,7 @@ public void CreateObservableList()
public void CreateObservableListWithValues()
{

ObservableList<int> list = new ObservableList<int> { 1, 2, 3, 4, 5 };
var list = new ObservableList<int> { 1, 2, 3, 4, 5 };

Assert.AreEqual(5, list.Count);

@@ -41,7 +43,7 @@ public void CreateObservableListWithValues()
public void CreateObservableListWithList()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

Assert.AreEqual(5, list.Count);

@@ -51,7 +53,7 @@ public void CreateObservableListWithList()
public void GetObservableListItemValues()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

Assert.AreEqual(1, list[0]);
Assert.AreEqual(2, list[1]);
@@ -65,7 +67,7 @@ public void GetObservableListItemValues()
public void AddItemToObservableList()
{

ObservableList<int> list = new ObservableList<int>();
var list = new ObservableList<int>();

list.Add(1);

@@ -77,7 +79,7 @@ public void AddItemToObservableList()
public void ClearObservableList()
{

ObservableList<int> list = new ObservableList<int>();
var list = new ObservableList<int>();

list.Add(1);

@@ -93,7 +95,7 @@ public void ClearObservableList()
public void ContainsItemInObservableList()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

Assert.AreEqual(true, list.Contains(2));
Assert.AreEqual(false, list.Contains(10));
@@ -104,7 +106,7 @@ public void ContainsItemInObservableList()
public void CopyToArrayWithIndex()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

int[] array = new int[10];

@@ -122,7 +124,7 @@ public void CopyToArrayWithIndex()
public void IndexOfItemInObservableList()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

Assert.AreEqual(0, list.IndexOf(1));
Assert.AreEqual(1, list.IndexOf(2));
@@ -133,7 +135,7 @@ public void IndexOfItemInObservableList()
public void InsertItemIntoObservableList()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

Assert.AreEqual(1, list[0]);
Assert.AreEqual(2, list[1]);
@@ -150,7 +152,7 @@ public void InsertItemIntoObservableList()
public void RemoveItemFromObservableList()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

Assert.AreEqual(1, list[0]);
Assert.AreEqual(2, list[1]);
@@ -165,7 +167,7 @@ public void RemoveItemFromObservableList()
public void RemoveAtFromObservableList()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

Assert.AreEqual(1, list[0]);
Assert.AreEqual(2, list[1]);
@@ -180,9 +182,9 @@ public void RemoveAtFromObservableList()
public void GetRangeFromObservableList()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

ObservableList<int> newList = list.GetRange(1, 2);
var newList = list.GetRange(1, 2);

Assert.AreEqual(2, newList.Count);

@@ -195,7 +197,7 @@ public void GetRangeFromObservableList()
public void AddRangeToObservableListWithList()
{

ObservableList<int> list = new ObservableList<int>();
var list = new ObservableList<int>();

Assert.AreEqual(0, list.Count);

@@ -209,7 +211,7 @@ public void AddRangeToObservableListWithList()
public void AddRangeToObservableListWithObservableList()
{

ObservableList<int> list = new ObservableList<int>();
var list = new ObservableList<int>();

Assert.AreEqual(0, list.Count);

@@ -223,7 +225,7 @@ public void AddRangeToObservableListWithObservableList()
public void RemoveRangeFromObservableList()
{

ObservableList<int> list = new ObservableList<int>(sampleList);
var list = new ObservableList<int>(sampleList);

list.RemoveRange(1, 2);

@@ -235,7 +237,7 @@ public void RemoveRangeFromObservableList()
public void ObservableListShuffle()
{

ObservableList<int> numberRange = new ObservableList<int>();
var numberRange = new ObservableList<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -250,7 +252,7 @@ public void ObservableListShuffle()
public void ObservableListShuffleWithoutChangingReference()
{

ObservableList<int> numberRange = new ObservableList<int>();
var numberRange = new ObservableList<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -270,7 +272,7 @@ public void ObservableListShuffleWithoutChangingReference()
public void ObservableListSlice()
{

ObservableList<int> numberRange = new ObservableList<int>();
var numberRange = new ObservableList<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -286,7 +288,7 @@ public void ObservableListSlice()
public void ObservableListSliceWithoutIndex()
{

ObservableList<int> numberRange = new ObservableList<int>();
var numberRange = new ObservableList<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -302,7 +304,7 @@ public void ObservableListSliceWithoutIndex()
public void ObservableListSplice()
{

ObservableList<int> numberRange = new ObservableList<int>();
var numberRange = new ObservableList<int>();

for (int i = 0; i < 10; i += 1)
{
@@ -318,7 +320,7 @@ public void ObservableListSplice()
public void ObservableListSpliceWithoutIndex()
{

ObservableList<int> numberRange = new ObservableList<int>();
var numberRange = new ObservableList<int>();

for (int i = 0; i < 10; i += 1)
{

0 comments on commit 3e22a4b

Please sign in to comment.
You can’t perform that action at this time.