Skip to content

Commit cc827eb

Browse files
authored
[APIView Copilot] Add basic filtering for each language. (Azure#10538)
* Add C# and iOS tuning filter files. * Add basic filters for all languages.
1 parent d637c28 commit cc827eb

20 files changed

Lines changed: 3036 additions & 174 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
exceptions: |
2+
1. Comment on lack of documentation comments
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
exceptions: |
2+
1. Comment on lack of XML documentation comments
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
exceptions: |
2+
1. Comment on lack of documentation comments
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
exceptions: |
2+
1. Comment on lack of documentation comments
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
exceptions: |
2+
1. Comment on lack of documentation comments
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
exceptions: |
2+
1. Comment on lack of documentation comments
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
exceptions: |
2+
1. Comment on lack of documentation comments
3+
2. Comment on the use of "."

packages/python-packages/apiview-copilot/scratch/output/android/ui_chat.json

Lines changed: 64 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
{
22
"comments": [
3+
{
4+
"rule_ids": [],
5+
"line_no": 1,
6+
"bad_code": "",
7+
"suggestion": null,
8+
"comment": "Here is a summary of the service described by this APIView:\n\nThis API provides chat UI capabilities for Android applications by integrating Azure Communication Chat services. It enables developers to establish chat sessions, manage connection lifecycles, and handle errors through event-driven mechanisms while offering a dedicated user interface component to render chat threads.\n\nThe latest artifact version is 1.0.0-beta.3.\n\nThe core functional components include the `ChatAdapter` and its associated `ChatAdapterBuilder`. The `ChatAdapter` offers methods such as `addOnErrorEventHandler`, `connect`, `disconnect`, and `removeOnErrorEventHandler`. The `ChatAdapterBuilder` provides the configuration steps via methods like `credential`, `displayName`, `endpoint`, `identity`, `threadId`, and culminates with the `build` method.\n\nSupporting classes and interfaces include the `ChatCompositeEventHandler` for event handling, model classes such as `ChatCompositeErrorCode`, `ChatCompositeErrorEvent`, and `ChatCompositeException` that encapsulate error conditions, and the `ChatThreadView` which is a specialized UI component for presenting chat threads.\n\nThe API employs asynchronous operations and a builder pattern to offer a structured approach for integrating chat functionalities in Android environments. It bridges communication services with user interface elements, supporting robust error propagation and handling to facilitate a responsive chat experience.",
9+
"source": "summary"
10+
},
311
{
412
"rule_ids": [
513
"android_design.html#android-library-java-lang"
614
],
715
"line_no": 10,
816
"bad_code": "org.jetbrains.kotlin:kotlin-stdlib-jdk8 1.7.20",
9-
"suggestion": "Remove the Kotlin dependency and implement the library in Java.",
10-
"comment": "Azure SDK guidelines dictate that client libraries be written in Java to avoid forcing customers to depend on the Kotlin runtime. Including the Kotlin stdlib violates these guidelines.",
17+
"suggestion": null,
18+
"comment": "Client libraries should be written in Java to avoid requiring consumers to depend on the Kotlin runtime.",
1119
"source": "guideline"
1220
},
1321
{
@@ -16,26 +24,34 @@
1624
],
1725
"line_no": 31,
1826
"bad_code": "public final class ChatAdapter {",
19-
"suggestion": "@ServiceClient\npublic final class ChatAdapter {",
20-
"comment": "Service client types must be annotated with @ServiceClient. This helps document the client as the main entry point for calling Azure services.",
27+
"suggestion": "@ServiceClient(builder = ChatAdapterBuilder.class)",
28+
"comment": "Service client types must be annotated with @ServiceClient so that consumers know how to build and interact with the client.",
2129
"source": "guideline"
2230
},
31+
{
32+
"rule_ids": [],
33+
"line_no": 33,
34+
"bad_code": "public void addOnErrorEventHandler(ChatCompositeEventHandler<ChatCompositeErrorEvent> errorHandler)",
35+
"suggestion": "public void addErrorListener(ChatErrorListener<ChatCompositeErrorEvent> errorListener)",
36+
"comment": "Renaming the method to addErrorListener improves clarity and aligns with Android listener naming conventions.",
37+
"source": "generic"
38+
},
2339
{
2440
"rule_ids": [
25-
"android_design.html#android-async-framework"
41+
"android_design.html#android-service-client-context-async"
2642
],
2743
"line_no": 34,
2844
"bad_code": "public CompletableFuture<Void> connect(Context context)",
29-
"suggestion": "public com.azure.core.android.util.CompletableFuture<Void> connect(Context context)",
30-
"comment": "The async API method returns a CompletableFuture. According to the guidelines, you should use Android retrofuture's CompletableFuture rather than the JDK version to ensure compatibility across Android devices.",
31-
"source": "guideline"
45+
"suggestion": "public CompletableFuture<Void> connect()",
46+
"comment": "Async client methods should not accept a Context parameter; use the built-in subscriber context for asynchronous operations. Additionally, consider providing a Kotlin suspend function or callback alternative to better align with Android asynchronous programming patterns.",
47+
"source": "merged"
3248
},
3349
{
3450
"rule_ids": [],
35-
"line_no": 35,
36-
"bad_code": "public void disconnect()",
37-
"suggestion": "public CompletableFuture<Void> disconnect()",
38-
"comment": "There is an asymmetry between the asynchronous connect() and the synchronous disconnect(). For consistency, either make disconnect asynchronous as well or document clearly why disconnect operates synchronously.",
51+
"line_no": 36,
52+
"bad_code": "public void removeOnErrorEventHandler(ChatCompositeEventHandler<ChatCompositeErrorEvent> errorHandler)",
53+
"suggestion": "public void removeErrorListener(ChatErrorListener<ChatCompositeErrorEvent> errorListener)",
54+
"comment": "Renaming the method to removeErrorListener ensures consistency with Android’s event listener patterns.",
3955
"source": "generic"
4056
},
4157
{
@@ -44,40 +60,60 @@
4460
],
4561
"line_no": 38,
4662
"bad_code": "public final class ChatAdapterBuilder {",
47-
"suggestion": "@ServiceClientBuilder(serviceClients = { ChatAdapter.class })\npublic final class ChatAdapterBuilder {",
48-
"comment": "Fluent builders constructing service clients should be annotated with @ServiceClientBuilder. This annotation ensures the builder is recognized as the instantiation mechanism for the service client.",
63+
"suggestion": "@ServiceClientBuilder(serviceClients = {ChatAdapter.class})",
64+
"comment": "Service client builders must be annotated with @ServiceClientBuilder to clearly indicate their role in constructing clients.",
4965
"source": "guideline"
5066
},
5167
{
5268
"rule_ids": [],
53-
"line_no": 44,
54-
"bad_code": "public ChatAdapterBuilder threadId(String threadId)",
55-
"suggestion": "public ChatAdapterBuilder chatThreadId(String chatThreadId)",
56-
"comment": "Renaming the parameter to something more descriptive (e.g. chatThreadId) improves clarity regarding its purpose.",
69+
"line_no": 39,
70+
"bad_code": "public ChatAdapterBuilder ()",
71+
"suggestion": null,
72+
"comment": "Consider adding a static factory method (e.g., ChatAdapter.builder()) on ChatAdapter to improve builder discoverability.",
5773
"source": "generic"
5874
},
5975
{
6076
"rule_ids": [],
6177
"line_no": 47,
6278
"bad_code": "public interface ChatCompositeEventHandler<T> {",
63-
"suggestion": "public interface ChatErrorEventHandler { void handle(ChatCompositeErrorEvent eventArgs); }",
64-
"comment": "If the event handler is intended only for error events, consider removing the generic type and renaming the interface to ChatErrorEventHandler to improve specificity and clarity.",
79+
"suggestion": "public interface ChatErrorListener<T> {",
80+
"comment": "Rename the interface to use a 'Listener' suffix to match standard Android event handling nomenclature.",
6581
"source": "generic"
6682
},
6783
{
68-
"rule_ids": [],
69-
"line_no": 52,
70-
"bad_code": "public final class ChatCompositeErrorCode extends ExpandableStringEnum<ChatCompositeErrorCode> {",
71-
"suggestion": "public final class ChatErrorCode extends ExpandableStringEnum<ChatErrorCode> {",
72-
"comment": "The term 'ChatCompositeErrorCode' is somewhat verbose. If the 'Composite' prefix is not essential to distinguish behavior, consider renaming to 'ChatErrorCode' for simplicity and clarity.",
73-
"source": "generic"
84+
"rule_ids": [
85+
"android_design.html#android-naming-enum-uppercase"
86+
],
87+
"line_no": 53,
88+
"bad_code": "public static final ChatCompositeErrorCode JOIN_FAILED = fromString(\"joinFailed\");",
89+
"suggestion": "public static final ChatCompositeErrorCode JOIN_FAILED = fromString(\"JOIN_FAILED\");",
90+
"comment": "Expandable enum values should use uppercase strings that match the constant names for consistency and clarity.",
91+
"source": "guideline"
92+
},
93+
{
94+
"rule_ids": [
95+
"android_design.html#android-models-constructors"
96+
],
97+
"line_no": 60,
98+
"bad_code": "public ChatCompositeErrorCode ()",
99+
"suggestion": "protected ChatCompositeErrorCode ()",
100+
"comment": "The constructor should not be public, as this model type is not intended for direct instantiation. Restricting visibility to protected helps prevent improper usage while still allowing controlled creation.",
101+
"source": "merged"
74102
},
75103
{
76104
"rule_ids": [],
77105
"line_no": 76,
78106
"bad_code": "public ChatThreadView(Context context, ChatAdapter chatAdapter)",
79-
"suggestion": "public ChatThreadView(Context context) { ... } // and add public void setChatAdapter(ChatAdapter adapter)",
80-
"comment": "Custom views in Android typically follow standard constructor patterns to support XML inflation. Instead of including non-standard parameters (like ChatAdapter) in constructors, provide a setter method to attach the adapter after inflation.",
107+
"suggestion": "public ChatThreadView(Context context)",
108+
"comment": "Avoid including business logic (ChatAdapter) in view constructors; provide a separate setter for configuring the adapter.",
109+
"source": "generic"
110+
},
111+
{
112+
"rule_ids": [],
113+
"line_no": 78,
114+
"bad_code": "public ChatThreadView(Context context, AttributeSet attrs, ChatAdapter chatAdapter)",
115+
"suggestion": "public ChatThreadView(Context context, AttributeSet attrs)",
116+
"comment": "Exclude adapter parameters from XML-inflation constructors to follow Android conventions; set the adapter via a setter.",
81117
"source": "generic"
82118
}
83119
]

0 commit comments

Comments
 (0)