Skip to content

Commit 3bc0d67

Browse files
Formatting improvements (#22)
Co-authored-by: Orsen Kucher <orsen.kucher@gmail.com>
1 parent dc8e19b commit 3bc0d67

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+842
-1178
lines changed
Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,12 @@
1-
===
1+
---
2+
23
/TEST_OUTPUT/workspace/consumer.go
3-
Location: Line 7, Column 28
4-
Message: not enough arguments in call to HelperFunction
4+
Diagnostics in File: 1
5+
ERROR at L7:C28: not enough arguments in call to HelperFunction
56
have ()
6-
want (int)
7-
Source: compiler
8-
Code: WrongArgCount
9-
===
7+
want (int) (Source: compiler, Code: WrongArgCount)
8+
109
6|func ConsumerFunction() {
1110
7|message := HelperFunction()
1211
8|fmt.Println(message)
1312
9|
14-
10|// Use shared struct
15-
11|s := &SharedStruct{
16-
12|ID: 1,
17-
13|Name: "test",
18-
14|Value: 42.0,
19-
15|Constants: []string{SharedConstant},
20-
16|}
21-
17|
22-
18|// Call methods on the struct
23-
19|fmt.Println(s.Method())
24-
20|s.Process()
25-
21|
26-
22|// Use shared interface
27-
23|var iface SharedInterface = s
28-
24|fmt.Println(iface.GetName())
29-
25|
30-
26|// Use shared type
31-
27|var t SharedType = 100
32-
28|fmt.Println(t)
33-
29|}
34-
Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
1-
===
2-
/TEST_OUTPUT/workspace/main.go
3-
Location: Line 8, Column 2
4-
Message: unreachable code
5-
Source: unreachable
6-
Code: default
7-
===
8-
6|func FooBar() string {
9-
7|return "Hello, World!"
10-
8|fmt.Println("Unreachable code") // This is unreachable code
11-
9|}
1+
---
122

13-
===
143
/TEST_OUTPUT/workspace/main.go
15-
Location: Line 9, Column 1
16-
Message: missing return
17-
Source: compiler
18-
Code: MissingReturn
19-
===
4+
Diagnostics in File: 2
5+
WARNING at L8:C2: unreachable code (Source: unreachable, Code: default)
6+
ERROR at L9:C1: missing return (Source: compiler, Code: MissingReturn)
7+
208
6|func FooBar() string {
219
7|return "Hello, World!"
2210
8|fmt.Println("Unreachable code") // This is unreachable code
2311
9|}
24-
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
===
1+
---
2+
23
/TEST_OUTPUT/workspace/consumer_clean.py
3-
Location: Line 9, Column 15
4-
Message: Argument missing for parameter "age"
5-
Source: Pyright
6-
Code: reportCallIssue
7-
===
4+
Diagnostics in File: 1
5+
ERROR at L9:C15: Argument missing for parameter "age" (Source: Pyright, Code: reportCallIssue)
6+
87
6|def consumer_function() -> None:
98
7| """Function that consumes the helper functions."""
109
8| # Use the helper function
1110
9| message = helper_function("World")
1211
10| print(message)
1312
11|
14-
12| # Get and process items from the helper
15-
13| items = get_items()
16-
14| for item in items:
17-
15| print(f"Processing {item}")
18-
Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,26 @@
1-
===
1+
---
2+
23
/TEST_OUTPUT/workspace/error_file.py
3-
Location: Line 31, Column 12
4-
Message: Type "Literal[42]" is not assignable to return type "str"
5-
  "Literal[42]" is not assignable to "str"
6-
Source: Pyright
7-
Code: reportReturnType
8-
===
4+
Diagnostics in File: 3
5+
ERROR at L31:C12: Type "Literal[42]" is not assignable to return type "str"
6+
  "Literal[42]" is not assignable to "str" (Source: Pyright, Code: reportReturnType)
7+
ERROR at L47:C15: "undefined_variable" is not defined (Source: Pyright, Code: reportUndefinedVariable)
8+
ERROR at L51:C19: Type "Literal[123]" is not assignable to declared type "str"
9+
  "Literal[123]" is not assignable to "str" (Source: Pyright, Code: reportAssignmentType)
10+
911
25|def function_with_type_error() -> str:
10-
26| """A function with a type error.
11-
27|
12-
28| Returns:
12+
...
1313
29| Should return a string but actually returns an int
1414
30| """
1515
31| return 42 # Type error: Incompatible return value type (got "int", expected "str")
16-
17-
===
18-
/TEST_OUTPUT/workspace/error_file.py
19-
Location: Line 47, Column 15
20-
Message: "undefined_variable" is not defined
21-
Source: Pyright
22-
Code: reportUndefinedVariable
23-
===
16+
...
2417
34|class ErrorClass:
25-
35| """A class with errors."""
26-
36|
27-
37| def __init__(self, value: dict[str, Any]):
28-
38| """Initialize with errors.
29-
39|
30-
40| Args:
31-
41| value: A dictionary
32-
42| """
33-
43| self.value = value
34-
44|
18+
...
3519
45| def method_with_undefined_variable(self) -> None:
3620
46| """A method that uses an undefined variable."""
3721
47| print(undefined_variable) # Error: undefined_variable is not defined
38-
39-
===
40-
/TEST_OUTPUT/workspace/error_file.py
41-
Location: Line 51, Column 19
42-
Message: Type "Literal[123]" is not assignable to declared type "str"
43-
  "Literal[123]" is not assignable to "str"
44-
Source: Pyright
45-
Code: reportAssignmentType
46-
===
22+
...
23+
49|
24+
50|# Variable with incompatible type annotation
25+
51|wrong_type: str = 123 # Type error: Incompatible types in assignment
26+
52|
Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
===
1+
---
2+
23
/TEST_OUTPUT/workspace/another_consumer.py
34
References in File: 1
4-
===
5-
Reference at Line 40, Column 19:
5+
At: L40:C19
6+
67
31|def another_consumer_function() -> None:
7-
32| """Another function that uses various shared components."""
8-
33| # Use shared constants
9-
34| print(f"Using constant: {SHARED_CONSTANT}")
8+
...
109
35|
1110
36| # Use shared class with a different type parameter
1211
37| shared = SharedClass[float]("another example", 3.14)
@@ -18,30 +17,15 @@ Reference at Line 40, Column 19:
1817
43|
1918
44| # Use our own implementation
2019
45| impl = AnotherImplementation()
21-
46| result = impl.do_something()
22-
47| print(f"Implementation result: {result}")
23-
48|
24-
49| # Use helper function
25-
50| output = helper_function("another direct call")
26-
51| print(f"Helper output: {output}")
27-
52|
28-
53| # Use enum-like class with a different color
29-
54| color = Color.GREEN
30-
55| print(f"Selected color: {color}")
3120

32-
===
21+
---
22+
3323
/TEST_OUTPUT/workspace/consumer.py
3424
References in File: 1
35-
===
36-
Reference at Line 47, Column 41:
25+
At: L47:C41
26+
3727
34|def consumer_function() -> None:
38-
35| """Function that consumes the helper functions."""
39-
36| # Use the helper function
40-
37| message = helper_function("World")
41-
38| print(message)
42-
39|
43-
40| # Get and process items from the helper
44-
41| items = get_items()
28+
...
4529
42| for item in items:
4630
43| print(f"Processing {item}")
4731
44|
@@ -53,8 +37,3 @@ Reference at Line 47, Column 41:
5337
50| impl = MyImplementation()
5438
51| result = impl.process(items)
5539
52| print(f"Processed items: {result}")
56-
53|
57-
54| # Use the enum
58-
55| color = Color.RED
59-
56| print(f"Selected color: {color}")
60-
Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
1-
===
1+
---
2+
23
/TEST_OUTPUT/workspace/another_consumer.py
34
References in File: 2
4-
===
5-
Reference at Line 54, Column 13:
5+
At: L7:C5, L54:C13
6+
7+
2|
8+
3|from helper import (
9+
4| SHARED_CONSTANT,
10+
5| SharedClass,
11+
6| helper_function,
12+
7| Color,
13+
8|)
14+
9|
15+
10|
16+
11|class AnotherImplementation:
17+
12| """A class that uses shared components but doesn't implement interfaces."""
18+
...
619
31|def another_consumer_function() -> None:
7-
32| """Another function that uses various shared components."""
8-
33| # Use shared constants
9-
34| print(f"Using constant: {SHARED_CONSTANT}")
10-
35|
11-
36| # Use shared class with a different type parameter
12-
37| shared = SharedClass[float]("another example", 3.14)
13-
38|
14-
39| # Use methods from shared class
15-
40| name = shared.get_name()
16-
41| value = shared.get_value()
17-
42| print(f"Name: {name}, Value: {value}")
18-
43|
19-
44| # Use our own implementation
20-
45| impl = AnotherImplementation()
21-
46| result = impl.do_something()
22-
47| print(f"Implementation result: {result}")
23-
48|
20+
...
2421
49| # Use helper function
2522
50| output = helper_function("another direct call")
2623
51| print(f"Helper output: {output}")
@@ -29,32 +26,30 @@ Reference at Line 54, Column 13:
2926
54| color = Color.GREEN
3027
55| print(f"Selected color: {color}")
3128

32-
===
29+
---
30+
3331
/TEST_OUTPUT/workspace/consumer.py
3432
References in File: 2
35-
===
36-
Reference at Line 55, Column 13:
33+
At: L9:C5, L55:C13
34+
35+
4| helper_function,
36+
5| get_items,
37+
6| SharedClass,
38+
7| SharedInterface,
39+
8| SHARED_CONSTANT,
40+
9| Color,
41+
10|)
42+
11|
43+
12|
44+
13|class MyImplementation(SharedInterface):
45+
14| """An implementation of the SharedInterface."""
46+
...
3747
34|def consumer_function() -> None:
38-
35| """Function that consumes the helper functions."""
39-
36| # Use the helper function
40-
37| message = helper_function("World")
41-
38| print(message)
42-
39|
43-
40| # Get and process items from the helper
44-
41| items = get_items()
45-
42| for item in items:
46-
43| print(f"Processing {item}")
47-
44|
48-
45| # Use the shared class
49-
46| shared = SharedClass[str]("consumer", SHARED_CONSTANT)
50-
47| print(f"Using shared class: {shared.get_name()} - {shared.get_value()}")
51-
48|
52-
49| # Use our implementation of the shared interface
48+
...
5349
50| impl = MyImplementation()
5450
51| result = impl.process(items)
5551
52| print(f"Processed items: {result}")
5652
53|
5753
54| # Use the enum
5854
55| color = Color.RED
5955
56| print(f"Selected color: {color}")
60-

0 commit comments

Comments
 (0)