-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathframework_patterns.toml
More file actions
173 lines (157 loc) · 5.66 KB
/
framework_patterns.toml
File metadata and controls
173 lines (157 loc) · 5.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# Framework Pattern Detection Configuration
#
# This file defines patterns for detecting framework-specific code across
# multiple programming languages. Patterns are used to identify functions
# based on decorators, attributes, naming conventions, imports, and more.
[rust.web.axum]
name = "Axum Web Framework"
category = "HTTP Request Handler"
patterns = [
{ type = "import", pattern = "axum" },
{ type = "parameter", pattern = "axum::extract::" },
{ type = "parameter", pattern = "Path<" },
{ type = "parameter", pattern = "Query<" },
{ type = "parameter", pattern = "Json<" },
{ type = "return_type", pattern = "axum::response::" },
{ type = "return_type", pattern = "Response" },
]
[rust.web.actix]
name = "Actix Web Framework"
category = "HTTP Request Handler"
patterns = [
{ type = "import", pattern = "actix_web" },
{ type = "parameter", pattern = "HttpRequest" },
{ type = "parameter", pattern = "HttpResponse" },
{ type = "parameter", pattern = "web::" },
{ type = "return_type", pattern = "Result<HttpResponse" },
]
[rust.testing.builtin]
name = "Rust Built-in Testing"
category = "Test Function"
patterns = [
{ type = "attribute", pattern = "#\\[test\\]" },
{ type = "attribute", pattern = "#\\[cfg\\(test\\)\\]" },
{ type = "attribute", pattern = "#\\[tokio::test\\]" },
{ type = "name", pattern = "^test_.*" },
]
[rust.cli.clap]
name = "Clap CLI Parser"
category = "CLI Argument Parsing"
patterns = [
{ type = "derive", pattern = "Parser" },
{ type = "derive", pattern = "Args" },
{ type = "derive", pattern = "Subcommand" },
{ type = "import", pattern = "clap::" },
]
[rust.database.diesel]
name = "Diesel ORM"
category = "Database Query"
patterns = [
{ type = "import", pattern = "diesel::" },
{ type = "call", pattern = "\\.execute\\(" },
{ type = "call", pattern = "\\.load\\(" },
{ type = "call", pattern = "\\.get_results?\\(" },
{ type = "derive", pattern = "Queryable" },
{ type = "derive", pattern = "Insertable" },
]
[rust.async.tokio]
name = "Tokio Async Runtime"
category = "Async Task Management"
patterns = [
{ type = "attribute", pattern = "#\\[tokio::main\\]" },
{ type = "import", pattern = "tokio::" },
{ type = "call", pattern = "tokio::spawn" },
]
[python.web.fastapi]
name = "FastAPI"
category = "HTTP Request Handler"
patterns = [
{ type = "decorator", pattern = "@app\\.(get|post|put|delete|patch|head|options)" },
{ type = "decorator", pattern = "@router\\.(get|post|put|delete|patch)" },
{ type = "import", pattern = "from fastapi import" },
{ type = "import", pattern = "import fastapi" },
{ type = "parameter", pattern = ": Request" },
{ type = "parameter", pattern = ": Response" },
]
[python.web.flask]
name = "Flask"
category = "HTTP Request Handler"
patterns = [
{ type = "decorator", pattern = "@app\\.route" },
{ type = "decorator", pattern = "@blueprint\\.route" },
{ type = "decorator", pattern = "@app\\.before_request" },
{ type = "decorator", pattern = "@app\\.after_request" },
{ type = "decorator", pattern = "@app\\.errorhandler" },
{ type = "import", pattern = "from flask import" },
{ type = "import", pattern = "import flask" },
]
[python.web.django]
name = "Django"
category = "HTTP Request Handler"
patterns = [
{ type = "import", pattern = "from django" },
{ type = "import", pattern = "import django" },
{ type = "name", pattern = "^(get|post|put|patch|delete|head|options)$" },
{ type = "decorator", pattern = "@login_required" },
{ type = "decorator", pattern = "@permission_required" },
{ type = "decorator", pattern = "@require_http_methods" },
]
[python.testing.pytest]
name = "Pytest"
category = "Test Function"
patterns = [
{ type = "decorator", pattern = "@pytest\\.fixture" },
{ type = "decorator", pattern = "@pytest\\.mark\\." },
{ type = "decorator", pattern = "@fixture" },
{ type = "name", pattern = "^test_.*" },
{ type = "name", pattern = ".*_test$" },
{ type = "file_path", pattern = ".*/tests?/.*" },
{ type = "file_path", pattern = ".*test_.*\\.py$" },
]
[python.testing.unittest]
name = "unittest"
category = "Test Function"
patterns = [
{ type = "import", pattern = "import unittest" },
{ type = "import", pattern = "from unittest import" },
{ type = "name", pattern = "^test.*" },
{ type = "name", pattern = "^setUp$" },
{ type = "name", pattern = "^tearDown$" },
]
[python.cli.click]
name = "Click CLI Framework"
category = "CLI Command Handler"
patterns = [
{ type = "decorator", pattern = "@click\\.command" },
{ type = "decorator", pattern = "@click\\.group" },
{ type = "decorator", pattern = "@click\\.option" },
{ type = "decorator", pattern = "@click\\.argument" },
{ type = "import", pattern = "import click" },
]
[python.database.sqlalchemy]
name = "SQLAlchemy ORM"
category = "Database Model"
patterns = [
{ type = "import", pattern = "from sqlalchemy import" },
{ type = "import", pattern = "import sqlalchemy" },
{ type = "decorator", pattern = "@validates" },
{ type = "decorator", pattern = "@hybrid_property" },
{ type = "decorator", pattern = "@event\\.listens_for" },
]
[python.async.asyncio]
name = "asyncio"
category = "Async Task"
patterns = [
{ type = "import", pattern = "import asyncio" },
{ type = "name", pattern = "^async_.*" },
{ type = "call", pattern = "asyncio\\." },
]
[python.celery]
name = "Celery Task Queue"
category = "Background Task"
patterns = [
{ type = "decorator", pattern = "@app\\.task" },
{ type = "decorator", pattern = "@celery\\.task" },
{ type = "import", pattern = "from celery import" },
{ type = "import", pattern = "import celery" },
]