Skip to content

Commit ebcdccc

Browse files
committed
Fix linter problems
1 parent 5b18916 commit ebcdccc

File tree

4 files changed

+66
-69
lines changed

4 files changed

+66
-69
lines changed

json_config_file/json_properties/json_property.gd

Lines changed: 61 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
class_name JSONProperty
22

33

4-
const PRECISION_ERROR = 0.000001
5-
6-
74
enum Types {
85
BOOL,
96
NUMBER,
@@ -19,50 +16,6 @@ enum Types {
1916
IMAGE,
2017
}
2118

22-
23-
const MESSAGE_BOOL = "boolean"
24-
const MESSAGE_NUMBER = "number"
25-
const MESSAGE_INTEGER = "integer"
26-
const MESSAGE_PERCENTAGE = "percentage"
27-
const MESSAGE_STRING = "string"
28-
const MESSAGE_ENUM = "string"
29-
const MESSAGE_ARRAY = "array"
30-
const MESSAGE_COLOR = "color"
31-
const MESSAGE_OBJECT = "object"
32-
const MESSAGE_FILE = "file path"
33-
const MESSAGE_JSON_CONFIG_FILE = "JSON configuration file path"
34-
const MESSAGE_IMAGE = "image path"
35-
36-
37-
static func _type_as_text(type: int) -> String:
38-
match type:
39-
Types.BOOL:
40-
return MESSAGE_BOOL
41-
Types.NUMBER:
42-
return MESSAGE_NUMBER
43-
Types.INTEGER:
44-
return MESSAGE_INTEGER
45-
Types.PERCENTAGE:
46-
return MESSAGE_PERCENTAGE
47-
Types.STRING:
48-
return MESSAGE_STRING
49-
Types.ENUM:
50-
return MESSAGE_ENUM
51-
Types.ARRAY:
52-
return MESSAGE_ARRAY
53-
Types.COLOR:
54-
return MESSAGE_COLOR
55-
Types.OBJECT:
56-
return MESSAGE_OBJECT
57-
Types.FILE:
58-
return MESSAGE_FILE
59-
Types.JSON_CONFIG_FILE:
60-
return MESSAGE_JSON_CONFIG_FILE
61-
Types.IMAGE:
62-
return MESSAGE_IMAGE
63-
_:
64-
return "This type message is not defined"
65-
6619
enum Errors {
6720
COULD_NOT_OPEN_FILE,
6821
COULD_NOT_OPEN_IMAGE,
@@ -91,6 +44,25 @@ enum Errors {
9144
IMAGE_WRONG_SIZE,
9245
}
9346

47+
enum Warnings {
48+
IMAGE_WRONG_SIZE,
49+
}
50+
51+
52+
const PRECISION_ERROR = 0.000001
53+
54+
const MESSAGE_BOOL = "boolean"
55+
const MESSAGE_NUMBER = "number"
56+
const MESSAGE_INTEGER = "integer"
57+
const MESSAGE_PERCENTAGE = "percentage"
58+
const MESSAGE_STRING = "string"
59+
const MESSAGE_ENUM = "string"
60+
const MESSAGE_ARRAY = "array"
61+
const MESSAGE_COLOR = "color"
62+
const MESSAGE_OBJECT = "object"
63+
const MESSAGE_FILE = "file path"
64+
const MESSAGE_JSON_CONFIG_FILE = "JSON configuration file path"
65+
const MESSAGE_IMAGE = "image path"
9466

9567
const MESSAGE_COULD_NOT_OPEN_FILE = "Could not open the file"
9668
const MESSAGE_COULD_NOT_OPEN_IMAGE = "Could not open the image"
@@ -125,6 +97,45 @@ const MESSAGE_WITH_CONTEXT = ", at '%s'."
12597
const MESSAGE_WITHOUT_CONTEXT = "."
12698

12799

100+
var _result
101+
var _errors := []
102+
var _warnings := []
103+
var _public_variables := {}
104+
var _private_variables := {}
105+
var _preprocessor := JSONConfigProcessor.new()
106+
var _postprocessor := JSONConfigProcessor.new()
107+
108+
109+
static func _type_as_text(type: int) -> String:
110+
match type:
111+
Types.BOOL:
112+
return MESSAGE_BOOL
113+
Types.NUMBER:
114+
return MESSAGE_NUMBER
115+
Types.INTEGER:
116+
return MESSAGE_INTEGER
117+
Types.PERCENTAGE:
118+
return MESSAGE_PERCENTAGE
119+
Types.STRING:
120+
return MESSAGE_STRING
121+
Types.ENUM:
122+
return MESSAGE_ENUM
123+
Types.ARRAY:
124+
return MESSAGE_ARRAY
125+
Types.COLOR:
126+
return MESSAGE_COLOR
127+
Types.OBJECT:
128+
return MESSAGE_OBJECT
129+
Types.FILE:
130+
return MESSAGE_FILE
131+
Types.JSON_CONFIG_FILE:
132+
return MESSAGE_JSON_CONFIG_FILE
133+
Types.IMAGE:
134+
return MESSAGE_IMAGE
135+
_:
136+
return "This type message is not defined"
137+
138+
128139
static func _array_as_text(array: Array) -> String:
129140
var array_as_text = ""
130141

@@ -216,11 +227,6 @@ static func _error_as_text(error: Dictionary) -> String:
216227
return error_as_text
217228

218229

219-
enum Warnings {
220-
IMAGE_WRONG_SIZE,
221-
}
222-
223-
224230
static func _warning_as_text(warning: Dictionary) -> String:
225231
var warning_as_text
226232

@@ -241,15 +247,6 @@ static func _warning_as_text(warning: Dictionary) -> String:
241247
return warning_as_text
242248

243249

244-
var _result
245-
var _errors := []
246-
var _warnings := []
247-
var _public_variables := {}
248-
var _private_variables := {}
249-
var _preprocessor := JSONConfigProcessor.new()
250-
var _postprocessor := JSONConfigProcessor.new()
251-
252-
253250
func set_preprocessor(processor: JSONConfigProcessor) -> void:
254251
_preprocessor = processor
255252

@@ -337,11 +334,11 @@ func _get_file_path(file: String) -> String:
337334

338335

339336
func _update_context(error_or_warning: Dictionary, context) -> void:
340-
var _index_regex = RegEx.new()
341-
_index_regex.compile("^\\[([0-9]|[1-9]+[0-9]+)\\]")
337+
var index_regex = RegEx.new()
338+
index_regex.compile("^\\[([0-9]|[1-9]+[0-9]+)\\]")
342339

343340
if error_or_warning.has("context"):
344-
if _index_regex.search(error_or_warning.context) == null:
341+
if index_regex.search(error_or_warning.context) == null:
345342
error_or_warning.context = context + "." + error_or_warning.context
346343
else:
347344
error_or_warning.context = context + error_or_warning.context

json_config_file/json_properties/json_property_array.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func _are_equal_arrays(array_1 : Array, array_2 : Array) -> bool:
123123
for i in array_1.size():
124124
if not _are_equal(array_1[i], array_2[i]):
125125
return false
126-
126+
127127
return true
128128

129129

@@ -146,7 +146,7 @@ func _are_equal_dictionaries(dic_1 : Dictionary, dic_2 : Dictionary) -> bool:
146146
return false
147147
else:
148148
return false
149-
149+
150150
return true
151151

152152
func _can_apply_unique_key(dic_1 : Dictionary, dic_2 : Dictionary) -> bool:

json_config_file/json_properties/json_property_color.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func _validate_type(color) -> void:
5151
result.b8 = value
5252
3:
5353
result.a8 = value
54-
54+
5555
if correct_color:
5656
_result = result
5757
else:

json_config_file/json_properties/json_property_object.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ func add_property(name: String, property: JSONProperty,
1616
if property != null:
1717
_properties[name] = property
1818
_properties_in_order.append(name)
19-
19+
2020
if required:
2121
_required_properties.append(name)
22-
22+
2323
if default_value != null:
2424
property._reset()
2525
property._validate(self, default_value)

0 commit comments

Comments
 (0)