mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Don't force public variables to use Hungarian notation (#8774)
People generally have expressed a dislike for the Hungarian notation used in member variables, especially in examples/templates, and our styleguide shouldn't be forced on downstream consumers, so this removes all Hungarian notation from the examples/templates. There are _some_ benefits to Hungarian for private member variables (like knowing what's a member vs. local in a PR review) so we'll keep private member variables the same for now, but public variables should no longer use Hungarian notation, since it looks much worse. A new PMD XPath rule has been added to accomplish this goal. Some other non-compliant variables were fixed for the new rule.
This commit is contained in:
@@ -17,39 +17,38 @@ import java.nio.file.Path;
|
||||
public class FieldConfig {
|
||||
public static class Corners {
|
||||
@Json.Property("top-left")
|
||||
public double[] m_topLeft;
|
||||
public double[] topLeft;
|
||||
|
||||
@Json.Property("bottom-right")
|
||||
public double[] m_bottomRight;
|
||||
public double[] bottomRight;
|
||||
}
|
||||
|
||||
@Json.Property("game")
|
||||
public String m_game;
|
||||
public String game;
|
||||
|
||||
@Json.Property("field-image")
|
||||
public String m_fieldImage;
|
||||
public String fieldImage;
|
||||
|
||||
@Json.Property("field-corners")
|
||||
public Corners m_fieldCorners;
|
||||
public Corners fieldCorners;
|
||||
|
||||
@Json.Property("field-size")
|
||||
public double[] m_fieldSize;
|
||||
public double[] fieldSize;
|
||||
|
||||
@Json.Property("field-unit")
|
||||
public String m_fieldUnit;
|
||||
public String fieldUnit;
|
||||
|
||||
@Json.Property("program")
|
||||
public String m_program;
|
||||
public String program;
|
||||
|
||||
public FieldConfig() {}
|
||||
|
||||
public URL getImageUrl() {
|
||||
return getClass().getResource(Fields.BASE_RESOURCE_DIR + m_program + "/" + m_fieldImage);
|
||||
return getClass().getResource(Fields.BASE_RESOURCE_DIR + program + "/" + fieldImage);
|
||||
}
|
||||
|
||||
public InputStream getImageAsStream() {
|
||||
return getClass()
|
||||
.getResourceAsStream(Fields.BASE_RESOURCE_DIR + m_program + "/" + m_fieldImage);
|
||||
return getClass().getResourceAsStream(Fields.BASE_RESOURCE_DIR + program + "/" + fieldImage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,6 @@ public enum Fields {
|
||||
|
||||
public static final String BASE_RESOURCE_DIR = "/org/wpilib/fields/";
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final String resourceFile;
|
||||
|
||||
Fields(String resourceFile) {
|
||||
|
||||
Reference in New Issue
Block a user