Skip to content

Commit

Permalink
run haxelib formatter, and a handful of checkstyle changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjamuffin99 committed Jul 11, 2024
1 parent f2c3da6 commit 3520205
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 121 deletions.
87 changes: 2 additions & 85 deletions checkstyle.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"props": {
"allowReturn": false,
"allowFunction": false,
"allowCurlyBody": false,
"allowCurlyBody": true,
"allowSingleArgParens": false
}
},
Expand All @@ -39,10 +39,6 @@
"type": "AvoidStarImport",
"props": {}
},
{
"type": "AvoidTernaryOperator",
"props": {}
},
{
"type": "BlockBreakingConditional",
"props": {}
Expand All @@ -61,38 +57,13 @@
"thresholdSimilar": 120
}
},
{
"type": "CommentedOutCode",
"props": {}
},
{
"type": "ConditionalCompilation",
"props": {
"policy": "aligned",
"allowSingleline": true
}
},
{
"type": "ConstantName",
"props": {
"severity": "IGNORE"
}
},
{
"type": "CyclomaticComplexity",
"props": {
"thresholds": [
{
"severity": "WARNING",
"complexity": 20
},
{
"severity": "ERROR",
"complexity": 25
}
]
}
},
{
"type": "DefaultComesLast",
"props": {}
Expand Down Expand Up @@ -158,12 +129,6 @@
"atleast": []
}
},
{
"type": "FieldDocComment",
"props": {
"severity": "IGNORE"
}
},
{
"type": "FileLength",
"props": {
Expand Down Expand Up @@ -271,13 +236,6 @@
"maxPublic": 100
}
},
{
"type": "MethodLength",
"props": {
"max": 50,
"ignoreEmptyLines": true
}
},
{
"type": "MethodName",
"props": {
Expand All @@ -300,36 +258,16 @@
]
}
},
{
"type": "MultipleStringLiterals",
"props": {
"allowDuplicates": 2,
"minLength": 2,
"ignore": "^\\s+$"
}
},
{
"type": "MultipleVariableDeclarations",
"props": {}
},
{
"type": "NestedControlFlow",
"props": {
"max": 3
}
},
{
"type": "NestedForDepth",
"props": {
"max": 1
}
},
{
"type": "NestedIfDepth",
"props": {
"max": 1
}
},
{
"type": "NestedTryDepth",
"props": {
Expand All @@ -354,7 +292,7 @@
"boolOpPolicy": "around",
"intervalOpPolicy": "none",
"arrowPolicy": "around",
"arrowFunctionPolicy": "around",
"arrowFunctionPolicy": "ignore",
"oldFunctionTypePolicy": "around",
"newFunctionTypePolicy": "around"
}
Expand Down Expand Up @@ -402,15 +340,6 @@
"option": "eol"
}
},
{
"type": "ParameterName",
"props": {
"format": "^(_|[a-z][a-zA-Z0-9]*$)",
"tokens": [],
"ignoreExtern": true,
"severity": "IGNORE"
}
},
{
"type": "ParameterNumber",
"props": {
Expand All @@ -434,12 +363,6 @@
"prohibitMeta": false
}
},
{
"type": "RedundantModifier",
"props": {
"severity": "IGNORE"
}
},
{
"type": "Return",
"props": {
Expand Down Expand Up @@ -532,12 +455,6 @@
"ignorePattern": "^$"
}
},
{
"type": "Trace",
"props": {
"severity": "IGNORE"
}
},
{
"type": "TrailingWhitespace",
"props": {}
Expand Down
5 changes: 5 additions & 0 deletions hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"type": "haxelib",
"version": "5.8.0"
},
{
"name": "formatter",
"type": "haxelib",
"version": "1.16.0"
},
{
"name": "hmm",
"type": "haxelib",
Expand Down
3 changes: 2 additions & 1 deletion hxformat.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
"emptyCurly": "noBreak"
},
"sameLine": {
"ifBody": "next",
"ifElse": "next",
"doWhile": "next",
"tryBody": "next",
"tryCatch": "next",
"elseBody": "same"
"elseBody": "next"
}
}
3 changes: 2 additions & 1 deletion source/BG.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class BG extends FlxSprite
x += FlxG.random.int(FlxG.width * 10, FlxG.width * 20);
scrollFactor.x = FlxG.random.float(2, 5);
}
else x += width * 2;
else
x += width * 2;
}
}
}
3 changes: 2 additions & 1 deletion source/CBlock.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class CBlock extends FlxTilemap
{
index = 2;
}
else index = 1;
else
index = 1;

mapData.push(index);
}
Expand Down
2 changes: 1 addition & 1 deletion source/CraneTrigger.hx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CraneTrigger extends FlxObject
_p = P;
}

override public function update(elapsed:Float):Void
override public function update(elapsed:Float)
{
if (overlaps(_p))
{
Expand Down
2 changes: 1 addition & 1 deletion source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import openfl.display.Sprite;
class Main extends Sprite
{
// Why can't Safari play .ogg in 2024.... :(
public static var SOUND_EXT:String = #if web ".mp3" #else ".ogg" #end;
public static final SOUND_EXT:String = #if web ".mp3" #else ".ogg" #end;

#if web
var framerate:Int = 60;
Expand Down
3 changes: 2 additions & 1 deletion source/MenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class MenuState extends FlxState
{
if (FlxG.onMobile)
notifString += ". Tap here to login";
else notifString += ". Press N to login";
else
notifString += ". Press N to login";
}

new FlxTimer().start(4, _ ->
Expand Down
19 changes: 12 additions & 7 deletions source/Player.hx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class Player extends FlxSprite
acceleration.x = 20;
else if (velocity.x < 600)
acceleration.x = 10;
else acceleration.x = 4;
else
acceleration.x = 4;

// Jumping
jumpLimit = velocity.x / (maxVelocity.x * 2.5);
Expand Down Expand Up @@ -146,7 +147,8 @@ class Player extends FlxSprite
_craneFeet = false;
if (_jump < 0.08)
velocity.y = -maxVelocity.y * 0.65;
else velocity.y = -maxVelocity.y;
else
velocity.y = -maxVelocity.y;
}

// Animation
Expand All @@ -165,7 +167,8 @@ class Player extends FlxSprite
FlxG.sound.play("assets/sounds/footc" + FlxG.random.int(1, 4) + "" + Main.SOUND_EXT + "");
_craneFeet = false;
}
else FlxG.sound.play("assets/sounds/foot" + FlxG.random.int(1, 4) + "" + Main.SOUND_EXT + "");
else
FlxG.sound.play("assets/sounds/foot" + FlxG.random.int(1, 4) + "" + Main.SOUND_EXT + "");
}

// Stumble / run animations
Expand All @@ -179,7 +182,8 @@ class Player extends FlxSprite
animation.play("run2");
else if (velocity.x < 600)
animation.play("run3");
else animation.play("run4");
else
animation.play("run4");
}
}
else if (velocity.y < -140)
Expand All @@ -202,7 +206,7 @@ class Player extends FlxSprite
_my += FlxG.elapsed;
}

public function stumble():Void
public function stumble()
{
FlxG.sound.play("assets/sounds/tumble" + Main.SOUND_EXT + "");
_stumble = true;
Expand All @@ -212,10 +216,11 @@ class Player extends FlxSprite
animation.play("stumble3", true);
else if (velocity.x > 150)
animation.play("stumble2", true);
else animation.play("stumble1", true);
else
animation.play("stumble1", true);
}

public function craneFeet():Void
public function craneFeet()
{
_craneFeet = true;
}
Expand Down
8 changes: 4 additions & 4 deletions source/Preloader.hx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Preloader extends FlxBasePreloader
super(MinDisplayTime, AllowedURLs);
}

override function create():Void
override function create()
{
_buffer = new Sprite();
_buffer.scaleX = _buffer.scaleY = 2;
Expand Down Expand Up @@ -74,7 +74,7 @@ class Preloader extends FlxBasePreloader
* Cleanup your objects!
* Make sure you call super.destroy()!
*/
override function destroy():Void
override function destroy()
{
if (_buffer != null)
{
Expand All @@ -93,7 +93,7 @@ class Preloader extends FlxBasePreloader
* Update is called every frame, passing the current percent loaded. Use this to change your loading bar or whatever.
* @param Percent The percentage that the project is loaded
*/
override public function update(Percent:Float):Void
override public function update(Percent:Float)
{
_bmpBar.scaleX = lerp(_bmpBar.scaleX, Percent, 0.1);
prevPercentage = lerp(prevPercentage, Percent, 0.1);
Expand Down Expand Up @@ -165,7 +165,7 @@ class Preloader extends FlxBasePreloader
}, 600);
}

function genNoise(Percent:Float):Void
function genNoise(Percent:Float)
{
noiseOverlay.lock();
for (i in 0...noiseOverlay.width)
Expand Down
6 changes: 4 additions & 2 deletions source/Sequence.hx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ class Sequence extends FlxObject
hallHeight = 5;
else if (_player.velocity.x > 320)
hallHeight = 4;
else hallHeight = 3;
else
hallHeight = 3;
}

// Figure out building position and dimensions
Expand Down Expand Up @@ -302,7 +303,8 @@ class Sequence extends FlxObject
{
if (type == HALLWAY)
_layer.add(new CBlock(Std.int(x), Std.int(y), Std.int(width), _tileSize, "assets/images/floor" + FlxG.random.int(1, 2) + ".png"));
else _layer.add(new CBlock(Std.int(x), Std.int(y), Std.int(width), _tileSize, "assets/images/roof" + FlxG.random.int(1, 5) + ".png"));
else
_layer.add(new CBlock(Std.int(x), Std.int(y), Std.int(width), _tileSize, "assets/images/roof" + FlxG.random.int(1, 5) + ".png"));

_layer.add(new CBlock(Std.int(x), Std.int(y + _tileSize), Std.int(width), Std.int(height - _tileSize), wallPath));

Expand Down
Loading

0 comments on commit 3520205

Please sign in to comment.