Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor issues shown by SonarQube has been fixed #61

Open
wants to merge 59 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
412e26d
Slack notification added to the yml file.
odmehb Apr 9, 2017
5756e31
SonarQube added
odmehb Apr 10, 2017
1630a72
dev branch added to sonarQube
odmehb Apr 10, 2017
7427320
Update .travis.yml
odmehb Apr 18, 2017
3da628d
test commit
makadimilan Apr 19, 2017
e24809b
sonarcube remove
makadimilan Apr 19, 2017
d08c239
verbose enabled
makadimilan Apr 19, 2017
fc0dc40
revert
makadimilan Apr 19, 2017
9d76728
sonarcube integration
makadimilan Apr 20, 2017
f2b64a3
sonarQube branches setup
makadimilan Apr 20, 2017
991271c
sonarqube revert
makadimilan Apr 20, 2017
2287b0e
sonarqube setup
makadimilan Apr 20, 2017
763ca1f
sad but successful build
makadimilan Apr 20, 2017
811a414
slack reintegration
makadimilan Apr 20, 2017
595864d
testify test
makadimilan May 4, 2017
d3774ec
Uniject-master
makadimilan May 4, 2017
04ea1dd
unit test fail
makadimilan May 4, 2017
5e1f6e4
build.sh in travis.yml
makadimilan May 4, 2017
2b64068
Merge branch 'milan_dev' of https://github.com/odmehb/UnitySteer into…
makadimilan May 5, 2017
efe7b17
new file hierarchy + unity project
makadimilan May 5, 2017
8376396
fix
makadimilan May 5, 2017
77a7eec
travis
makadimilan May 5, 2017
bad80de
deprecated .sh removed from the travis.yml file
makadimilan May 5, 2017
a7a081c
test unit tests
makadimilan May 5, 2017
7327f51
failed unittest test
makadimilan May 5, 2017
c20a7b5
example integration an unit tests
makadimilan May 5, 2017
c2d7827
run unit tests on travis
makadimilan May 5, 2017
c601965
auto start unit tests
makadimilan May 5, 2017
327cbad
fix
makadimilan May 5, 2017
54d224f
after script
makadimilan May 5, 2017
c932808
gitmodules test
makadimilan May 8, 2017
cca96ae
revert
makadimilan May 10, 2017
13c5c2c
fix
makadimilan May 10, 2017
1629f48
unity test tools reimport
makadimilan May 10, 2017
4a5a34b
missing files
makadimilan May 10, 2017
b446d9a
unit test
makadimilan May 10, 2017
1e3edd8
debug ls
makadimilan May 10, 2017
a76786a
unity path test
makadimilan May 10, 2017
3eb2738
ls commands
makadimilan May 10, 2017
1bb7f78
ls ./.deploy
makadimilan May 10, 2017
2c4dde0
more ls
makadimilan May 11, 2017
89cee02
find / -name Unity
makadimilan May 11, 2017
6845fe8
force install
makadimilan May 11, 2017
5988f10
install test
makadimilan May 11, 2017
5a73ba7
running unit tests
makadimilan May 11, 2017
73f18eb
fix
makadimilan May 11, 2017
13f3e6b
unity path fix and exit code
makadimilan May 11, 2017
07662fb
batchmode and nogui
makadimilan May 11, 2017
344235b
fallback
makadimilan May 11, 2017
cc06823
running without -nographics
makadimilan May 11, 2017
05ad4f2
unit tests
makadimilan May 12, 2017
118d82b
examples
makadimilan May 12, 2017
aa0eec5
Integration test
makadimilan May 12, 2017
718adbe
IntegrationTestScene update
makadimilan May 12, 2017
5801d95
SonarQube bux fixes
odmehb May 14, 2017
89ac783
SonarQube bux fixes
odmehb May 14, 2017
dcd54a7
Merge branch 'development' of https://github.com/odmehb/UnitySteer in…
odmehb May 14, 2017
d5c830e
original file structure
makadimilan May 14, 2017
42f1994
minor issues fixed
odmehb May 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .deploy.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Misc]
#if set to true, all logs from commands will be shown. Default is false.
verbose=false
verbose=true

#if set to true, Travis will always try to build the package/asset, even when there isn't a tag. Default is true.
always_run=true
Expand Down
1 change: 0 additions & 1 deletion .deploy/travis/main_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,3 @@
print '------------------------------------------------------------------------------------------------------------------------'
print "Skipping build steps. ---------------------------------------------------------------------------------------------------"
print '------------------------------------------------------------------------------------------------------------------------'

35 changes: 35 additions & 0 deletions .deploy/travis/run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#! /bin/sh

echo "------------------------------------------------------------------------------------------------------------------------"
echo "Starting Unit Tests; ---------------------------------------------------------------------------------------------------"
echo "------------------------------------------------------------------------------------------------------------------------"

directory=/Applications/Unity/Unity.app/Contents/MacOS/Unity
if [ ! -d "$directory" ];
then
echo "\nUnity is missing from: $directory\n"
sh ./.deploy/travis/unity_install.sh
fi

echo "\nRunning unit tests.\n"
/Applications/Unity/Unity.app/Contents/MacOS/Unity \
-batchmode \
-runEditorTests \
-projectPath ./ \
-editorTestsResultFile ./testresults.xml

exitcode=$?;

echo "DEBUG - exitcode is $exitcode"
echo "DEBUG - ls -al ./"
ls -al ./


echo "\nTest result saved to ./testresults.xml\n\t - results:"
cat ./testresults.xml

if [[ $exitcode != 0 ]];
then
echo "\nUnit tests are FAILED, exit code is $exitcode\n"
exit $exitcode;
fi
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.svn
.git
Temp/*
Assembly*
*.sln
*.userprefs
/Library
23 changes: 21 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
language: objective-c

install:
- sh ./.deploy/travis/py_set_up.sh
- sh ./.deploy/travis/py_set_up.sh

script:
- python ./.deploy/travis/main_parser.py
- python ./.deploy/travis/main_parser.py

after_script:
- sh ./.deploy/travis/run_unit_tests.sh

addons:
sonarqube:
organization: "odmehb-github"
token:
secure: "aCpEzF7VFed9bhZ1Lb/Jm4t+zvR3o2R8RyjNfwoN776ODi8NzDqt/R9nuZmSA2zfT6XNL4AacFAmEgjt52v27wdLwDTSqUW1w3s+xcVOj7uNj/MMap0FhtilJNE7VTyPtkhH+bVGPrjZaLvRHlqt/tYPbK4Pz7Y8RCz4wZrowOvLbt87lJUJsVM2/VbMZjrRm9M2JHzdbn6afTlquCQsIvsTQCIttP3mRAYEEUMTkO4CfdlxThRUJTc+8QmGD/avA9M56+FyRjo+sTVIsK49NYykn2opkosRPHIlGJHP3XmVss0srCuK1oUq4T+ZMDe0EvyIIGQtT+P4msbZVVb1PnlyWwHtDncRZI/ge+SpZlqzhJkT+RGj7fEe66LVXy162DZdMEu3lgCpyci6+kqAvDwj/sLlSqvBiAwpIuAnyd38l1cQtIFr6L9a3/Tx5x+eLi/9SbRZEoaR6io367FEGQMT7pfnyya045flfBbxD2mdGgJkz9iQqSubM5Oj4A5PXtEn52COJzeCxCcH8VEVSW7JJ67LsjLqEyFvl0c3B8YVsSENm02pFXuUMjZOHu+hOq1b9v799C7LXys6Q2CrK4IS4yipHOAudxbACy6vrTNaiovN1FBqQvkafmTmEy8RN/C72NmmWsqMWtsB9tqbkuqmMmwbXdMtMu/YGvnxG5Y="
branches:
- master
- development

script:
# other script steps might be done before running the actual SonarQube analysis
- sonar-scanner

notifications:
slack: csapatnevteam:pOaxl7fQfoNZj97ERSgqZGL6
4 changes: 2 additions & 2 deletions 2D/Behaviors/AutonomousVehicle2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public class AutonomousVehicle2D : TickedVehicle2D
/// of 1 means that we interpolate across 1 second; a rate of 5 means
/// we do it five times as fast.
/// </summary>
[SerializeField] private float _accelerationRate = 5;
[SerializeField] private readonly float _accelerationRate = 5;

/// <summary>
/// Deceleration rate - it'll be used as a multiplier for the speed
/// at which the velocity is interpolated when decelerating. A rate
/// of 1 means that we interpolate across 1 second; a rate of 5 means
/// we do it five times as fast.
/// </summary>
[SerializeField] private float _decelerationRate = 8;
[SerializeField] private readonly float _decelerationRate = 8;


/// <summary>
Expand Down
26 changes: 13 additions & 13 deletions 2D/Behaviors/Radar2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Radar2D : MonoBehaviour
private TickedObject _tickedObject;
private UnityTickedQueue _steeringQueue;

[SerializeField] private string _queueName = "Radar2D";
[SerializeField] private readonly string _queueName = "Radar2D";

/// <summary>
/// The maximum number of radar update calls processed on the queue per update
Expand All @@ -47,7 +47,7 @@ public class Radar2D : MonoBehaviour
/// the queue will win. Make sure your settings are consistent for objects of
/// the same queue.
/// </remarks>
[SerializeField] private int _maxQueueProcessedPerUpdate = 20;
[SerializeField] private readonly int _maxQueueProcessedPerUpdate = 20;

/// <summary>
/// How often is the radar updated
Expand All @@ -62,7 +62,7 @@ public class Radar2D : MonoBehaviour

[SerializeField] private bool _drawGizmos;

[SerializeField] private int _preAllocateSize = 30;
[SerializeField] private readonly int _preAllocateSize = 30;

private Collider2D[] _detectedColliders;
private List<DetectableObject2D> _detectedObjects;
Expand Down Expand Up @@ -206,14 +206,14 @@ private void OnDisable()

private void OnUpdateRadar(object obj)
{
Profiler.BeginSample("OnUpdateRadar");
UnityEngine.Profiling.Profiler.BeginSample("OnUpdateRadar");
_detectedColliders = Detect();
FilterDetected();
if (OnDetected != null)
{
Profiler.BeginSample("Detection event handler");
UnityEngine.Profiling.Profiler.BeginSample("Detection event handler");
OnDetected(this);
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
}
#if TRACEDETECTED
if (DrawGizmos)
Expand All @@ -237,7 +237,7 @@ private void OnUpdateRadar(object obj)
Debug.Log(sb.ToString());
}
#endif
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
}

public void UpdateRadar()
Expand All @@ -264,14 +264,14 @@ protected virtual void FilterDetected()
* took about 75% of the time used for the frame.
*
*/
Profiler.BeginSample("Base FilterDetected");
UnityEngine.Profiling.Profiler.BeginSample("Base FilterDetected");

_vehicles.Clear();
_obstacles.Clear();
_detectedObjects.Clear();


Profiler.BeginSample("Initial detection");
UnityEngine.Profiling.Profiler.BeginSample("Initial detection");
for (var i = 0; i < _detectedColliders.Length; i++)
{
var id = _detectedColliders[i].GetInstanceID();
Expand All @@ -288,9 +288,9 @@ protected virtual void FilterDetected()
_detectedObjects.Add(detectable);
}
}
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();

Profiler.BeginSample("Filtering out vehicles");
UnityEngine.Profiling.Profiler.BeginSample("Filtering out vehicles");
for (var i = 0; i < _detectedObjects.Count; i++)
{
var d = _detectedObjects[i];
Expand All @@ -304,8 +304,8 @@ protected virtual void FilterDetected()
_obstacles.Add(d);
}
}
Profiler.EndSample();
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
}
#endregion

Expand Down
4 changes: 2 additions & 2 deletions 2D/Behaviors/SteerForFear2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected override void Start()

protected override Vector2 CalculateForce()
{
Profiler.BeginSample("Accumulating repulsion");
UnityEngine.Profiling.Profiler.BeginSample("Accumulating repulsion");
var accumulator = Vector2.zero;
var totalCount = 0;
var now = Time.time;
Expand Down Expand Up @@ -98,7 +98,7 @@ protected override Vector2 CalculateForce()
Debug.DrawLine(position, futurePosition, Color.blue);
Debug.DrawLine(position + accumulator, futurePosition, Color.magenta);
#endif
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();

return accumulator;
}
Expand Down
12 changes: 6 additions & 6 deletions 2D/Behaviors/SteerForNeighborGroup2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected override Vector2 CalculateForce()
{
// steering accumulator and count of neighbors, both initially zero
var steering = Vector2.zero;
Profiler.BeginSample("SteerForNeighborGroup.Looping over neighbors");
UnityEngine.Profiling.Profiler.BeginSample("SteerForNeighborGroup.Looping over neighbors");
// I'd prefer an iterator, but trying to cut down on allocations
for (var i = 0; i < _neighbors.Count; i++)
{
Expand All @@ -185,7 +185,7 @@ protected override Vector2 CalculateForce()
{
Debug.DrawLine(Vehicle.Position, other.Position, Color.magenta);
}
Profiler.BeginSample("SteerForNeighborGroup.Adding");
UnityEngine.Profiling.Profiler.BeginSample("SteerForNeighborGroup.Adding");
for (var bi = 0; bi < _behaviors.Length; bi++)
{
var behavior = _behaviors[bi];
Expand All @@ -194,16 +194,16 @@ protected override Vector2 CalculateForce()
steering += behavior.CalculateNeighborContribution(other) * behavior.Weight;
}
}
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
}
}
;
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();

Profiler.BeginSample("Normalizing");
UnityEngine.Profiling.Profiler.BeginSample("Normalizing");
// Normalize for pure direction
steering.Normalize();
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();

return steering;
}
Expand Down
4 changes: 2 additions & 2 deletions 2D/Behaviors/SteerForSphericalObstacles2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected override Vector2 CalculateForce()
* and distance to affect the avoidance - the further away the intersection
* is, the less weight they'll carry.
*/
Profiler.BeginSample("Accumulate spherical obstacle influences");
UnityEngine.Profiling.Profiler.BeginSample("Accumulate spherical obstacle influences");
for (var i = 0; i < Vehicle.Radar.Obstacles.Count; i++)
{
var sphere = Vehicle.Radar.Obstacles[i];
Expand All @@ -129,7 +129,7 @@ protected override Vector2 CalculateForce()
var oppositeDirection = Vehicle.Position - sphere.Position;
avoidance += avoidanceMultiplier * oppositeDirection;
}
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();

avoidance /= Vehicle.Radar.Obstacles.Count;

Expand Down
12 changes: 6 additions & 6 deletions 2D/Behaviors/TickedVehicle2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ protected void CalculateForces()
{
return;
}
Profiler.BeginSample("Calculating vehicle forces");
UnityEngine.Profiling.Profiler.BeginSample("Calculating vehicle forces");

var force = Vector2.zero;

Profiler.BeginSample("Adding up basic steerings");
UnityEngine.Profiling.Profiler.BeginSample("Adding up basic steerings");
for (var i = 0; i < Steerings.Length; i++)
{
var s = Steerings[i];
Expand All @@ -181,7 +181,7 @@ protected void CalculateForces()
force += s.WeighedForce;
}
}
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
LastRawForce = force;

// Enforce speed limit. Steering behaviors are expected to return a
Expand All @@ -205,7 +205,7 @@ protected void CalculateForces()
// but things are working just fine for now, and it seems like
// overkill.
var adjustedVelocity = Vector2.zero;
Profiler.BeginSample("Adding up post-processing steerings");
UnityEngine.Profiling.Profiler.BeginSample("Adding up post-processing steerings");
for (var i = 0; i < SteeringPostprocessors.Length; i++)
{
var s = SteeringPostprocessors[i];
Expand All @@ -215,7 +215,7 @@ protected void CalculateForces()
adjustedVelocity += s.WeighedForce;
}
}
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();


if (adjustedVelocity != Vector2.zero)
Expand All @@ -228,7 +228,7 @@ protected void CalculateForces()

// Update vehicle velocity
SetCalculatedVelocity(newVelocity);
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
}


Expand Down
20 changes: 10 additions & 10 deletions 3D/Behaviors/Radar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ private void OnDisable()

private void OnUpdateRadar(object obj)
{
Profiler.BeginSample("OnUpdateRadar");
UnityEngine.Profiling.Profiler.BeginSample("OnUpdateRadar");
_detectedColliders = Detect();
FilterDetected();
if (OnDetected != null)
{
Profiler.BeginSample("Detection event handler");
UnityEngine.Profiling.Profiler.BeginSample("Detection event handler");
OnDetected(this);
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
}
#if TRACEDETECTED
if (DrawGizmos)
Expand All @@ -237,7 +237,7 @@ private void OnUpdateRadar(object obj)
Debug.Log(sb.ToString());
}
#endif
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
}

public void UpdateRadar()
Expand Down Expand Up @@ -265,14 +265,14 @@ protected virtual void FilterDetected()
* took about 75% of the time used for the frame.
*
*/
Profiler.BeginSample("Base FilterDetected");
UnityEngine.Profiling.Profiler.BeginSample("Base FilterDetected");

_vehicles.Clear();
_obstacles.Clear();
_detectedObjects.Clear();


Profiler.BeginSample("Initial detection");
UnityEngine.Profiling.Profiler.BeginSample("Initial detection");
for (var i = 0; i < _detectedColliders.Length; i++)
{
var id = _detectedColliders[i].GetInstanceID();
Expand All @@ -289,9 +289,9 @@ protected virtual void FilterDetected()
_detectedObjects.Add(detectable);
}
}
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();

Profiler.BeginSample("Filtering out vehicles");
UnityEngine.Profiling.Profiler.BeginSample("Filtering out vehicles");
for (var i = 0; i < _detectedObjects.Count; i++)
{
var d = _detectedObjects[i];
Expand All @@ -305,8 +305,8 @@ protected virtual void FilterDetected()
_obstacles.Add(d);
}
}
Profiler.EndSample();
Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
UnityEngine.Profiling.Profiler.EndSample();
}
#endregion

Expand Down
Loading