mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 19:28:49 -04:00
CI: Check for trailing spaces and (missing) newlines at the end of the file
fixes #737
This commit is contained in:
parent
fd43253f4a
commit
22488a28ae
@ -39,7 +39,6 @@
|
||||
.size_variation = 6,
|
||||
},
|
||||
.{
|
||||
|
||||
.id = "cubyz:ground_patch",
|
||||
.block = "cubyz:lava",
|
||||
.chance = 0.064,
|
||||
|
@ -75,4 +75,3 @@ void main() {
|
||||
vec3 vertexPosition = modelPosition + (vertexBuffer[vertexID]*chunks[chunkID].maxPos.xyz + (1 - vertexBuffer[vertexID])*chunks[chunkID].minPos.xyz)*chunks[chunkID].voxelSize;
|
||||
gl_Position = projectionMatrix*viewMatrix*vec4(vertexPosition, 1);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@ uniform int circleColor;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (center + vertex_pos*radius)/screen;
|
||||
|
||||
|
@ -15,7 +15,6 @@ uniform vec2 uvDim;
|
||||
uniform int color;
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vec2(vertex_pos.x*size.x, size.y - vertex_pos.y*size.y))/screen;
|
||||
|
||||
|
@ -14,7 +14,6 @@ uniform int lineColor;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos*direction)/screen;
|
||||
|
||||
|
@ -14,7 +14,6 @@ uniform int rectColor;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos*size)/screen;
|
||||
|
||||
|
@ -15,7 +15,6 @@ uniform int rectColor;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos.xy*size + vertex_pos.zw*lineWidth)/screen;
|
||||
|
||||
|
@ -19,7 +19,6 @@ vec2 convert2Proportional(vec2 original, vec2 full){
|
||||
return vec2(original.x/full.x, original.y/full.y);
|
||||
}
|
||||
|
||||
|
||||
void main() {
|
||||
vec4 texture_rect_percentage = vec4(convert2Proportional(texture_rect.xy, fontSize), convert2Proportional(texture_rect.zw, fontSize));
|
||||
vec2 texture_position = vec2(
|
||||
|
@ -20,7 +20,6 @@ vec2 convert2Proportional(vec2 original, vec2 full) {
|
||||
return vec2(original.x/full.x, original.y/full.y);
|
||||
}
|
||||
|
||||
|
||||
void main() {
|
||||
vec2 vertex_pos = face_pos*vec2(1, -1);
|
||||
vec2 position_percentage = convert2Proportional(floor(offset), scene);
|
||||
|
@ -13,7 +13,6 @@ uniform vec2 screen;
|
||||
uniform int color;
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos*size)/screen;
|
||||
startCoord.x = start.x;
|
||||
|
@ -14,7 +14,6 @@ uniform vec2 screen;
|
||||
uniform int color;
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos*size)/screen;
|
||||
startCoord.x = start.x;
|
||||
|
@ -331,5 +331,3 @@ fn patestCallback(
|
||||
addMusic(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ var failed: bool = false;
|
||||
fn printError(msg: []const u8, filePath: []const u8, data: []const u8, charIndex: usize) void {
|
||||
var lineStart: usize = 0;
|
||||
var lineNumber: usize = 1;
|
||||
var lineEnd: usize = 0;
|
||||
var lineEnd: usize = data.len;
|
||||
for(data[0..charIndex], 0..) |c, i| {
|
||||
if(c == '\n') {
|
||||
lineStart = i + 1;
|
||||
@ -47,6 +47,9 @@ fn checkFile(dir: std.fs.Dir, filePath: []const u8) !void {
|
||||
switch(c) {
|
||||
'\n' => {
|
||||
lineStart = true;
|
||||
if(i != 0 and (data[i - 1] == ' ' or data[i - 1] == '\t')) {
|
||||
printError("Line contains trailing whitespaces. Please remove them.", filePath, data, i - 1);
|
||||
}
|
||||
},
|
||||
'\r' => {
|
||||
printError("Incorrect line ending \\r. Please configure your editor to use LF instead CRLF.", filePath, data, i);
|
||||
@ -62,6 +65,9 @@ fn checkFile(dir: std.fs.Dir, filePath: []const u8) !void {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(data.len != 0 and data[data.len - 1] != '\n' or (data.len > 2 and data[data.len - 2] == '\n')) {
|
||||
printError("File should end with a single empty line", filePath, data, data.len - 1);
|
||||
}
|
||||
}
|
||||
|
||||
fn checkDirectory(dir: std.fs.Dir) !void {
|
||||
|
@ -1054,9 +1054,7 @@ pub const Item = union(enum) { // MARK: Item
|
||||
|
||||
pub fn deinit(self: Item) void {
|
||||
switch(self) {
|
||||
.baseItem => {
|
||||
|
||||
},
|
||||
.baseItem => {},
|
||||
.tool => |_tool| {
|
||||
_tool.deinit();
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user