-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnew_readme
More file actions
311 lines (210 loc) · 10.9 KB
/
Copy pathnew_readme
File metadata and controls
311 lines (210 loc) · 10.9 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
---
First, [install the CodeLingo GitHub App](https://github.com/apps/codelingo). This will enable CodeLingo Flows to be run on your repositories. The Review Action is enabled by default and reviews pull requests to you repos, using Rules stored in your repository inside a codelingo.yaml file. A Rule is made up of a `name`, a `doc` specifiying what the Rule does, `actions` that use this Rule and a `query` used by the Action:
```yaml
rules:
- name: sprintf-error
actions:
codelingo/docs:
body: Find instances of 'errors.New(fmt.Sprintf(...))'.
codelingo/review:
comment: Should replace errors.New(fmt.Sprintf(...)) with errors.Errorf(...).
query: |
import codelingo/ast/go
@review.comment
go.call_expr(depth = any):
go.selector_expr:
go.ident:
name: "errors"
go.ident:
name: "New"
go.args:
go.call_expr:
go.selector_expr:
go.ident:
name: "fmt"
go.ident:
name: "Sprintf"
```
## Rules
Rules live in codelingo.yaml files in your repository and are used by Flows to automate tasks. You can think of a Rule as an underlying principle guiding a workflow.
In the sprintf-error Rule above, the Review Action uses the Rule to make sure `errors.New` is being used correctly and attaches a comment to the line where the `go.call_expr` is found, using the `@review.comment` decorator.
### Adding Rules
There are three ways to add Rules to a codelingo.yaml file:
1. The easist is to import a bundle of Rules:
```yaml
rules:
- import: codelingo/go
```
In the example above `codelingo` is the bundle owner and `go` is the bundle name. More Rule bundles from the community can be found [here](https://github.com/codelingo/hub/tree/master/rules).https://github.com/codelingo/hub/tree/master/rules
2. The second way is to import individual Rules from a bundle:
```yaml
rules:
- import: codelingo/go/goto
- import: codelingo/go/sprintf
```
3. The third way is to write a new Rule directly in the codelingo.yaml file:
```
rules:
- name: find-funcs
actions:
codelingo/docs:
title: "example Rule that finds all func decls"
codelingo/review:
comment: "this is a function"
query:
import go
@review.comment
go.func_decl
```
---
Publishing a Rule Bundle
To publish a Rule Bundle, make a pull request to github.com/codelingo/hub and add a folder under:
```
rules/
<your-codelingo-username>/
<bundle-name>/
<rule-name>/
codelingo.yaml
```
---
_Find and Share CodeLingo Resources_
The CodeLingo Hub is an Open source collection of CodeLingo Resources.
* Lexicons - Libraries for DSLs, such as a language AST or VCS. Provides facts for queries.
* Rules - Patterns and anti-patterns in your software stack written in CLQL.
* Flows - pipelines for process augmentation and automation.
* Bots - agents that integrate with your services and data stores.
If you are first getting started with CodeLingo please [check out the getting started guide](https://codelingo.io/docs/getting-started).
To use CodeLingo locally, you will need to install the CLI tool which [can be found here](https://github.com/codelingo/lingo)
For any questions please **[join the conversation in Slack](https://join.slack.com/t/codelingo/shared_invite/enQtMzY4MzA5ODYwOTYzLWVhMjI1ODU1YmM3ODAxYWUxNWU5ZTI0NWI0MGVkMmUwZDZhNWYxNGRiNWY4ZDY0NzRkMjU5YTRiYWY2N2FlMmU)**
## Lexicons
Lexicons provide the DSL for querying against a particular domain, specifically programming languages, version control, runtime, and databases.
Lexicons are imported as part of a CLQL query. Please see the documentation for more information about using Lexicons.
Lexicons are currently available for the follow programming languages:
[Go](lexicons/ast/codelingo/go), [Python](lexicons/ast/codelingo/python), [PHP](lexicons/`ast/codelingo/php), [C++](lexicons/ast/codelingo/c++), [C#](lexicons/ast/codelingo/csharp)
If you are interested in writing your own lexicon, please contact us at hello@codelingo.io
## Rules
Rules are stored patterns and queries that can be applied to your software stack. All Rules are constructed in CLQL and rely on specific lexicons.
Pre-written Rules found in the Hub can be imported within your lingo file as follows:
```
rules:
- import codelingo/go/empty-slice
```
All pre-written Rules are available within this repository, and simply be explored through the file structure. For example, [here is a Rule for Go](rules/codelingo/go/goto) that uses of goto
For more information and about writing your own Rules, please [see the documentation](https://codelingo.io/docs/concepts/rules/)
**[Explore all Rules](/rules)**
## Flows
Rules are integrated into your workflow through Flows. Flows are automated and semi-automated processes that rely heavily on bots (integrations) to drive your software development lifecycle. They are completely customizable pipelines and can be configured directly in YAML or via the UI.
Currently the default Action is the review Action. Custom Flows are currently in development.
## Bots
Bots are agents that integrate with all your data sources, t
---
First, [install the CodeLingo GitHub App](https://github.com/apps/codelingo-clair). This will enable CodeLingo Flows to be run on your repositories. The Review Action is enabled by default and reviews pull requests to you repos, using Rules stored in your repository inside a codelingo.yaml file. A Rule is made up of a `name`, a `doc` specifiying what the Rule does, `actions` that use this Rule and a `query` used by the Action:
```yaml
rules:
- name: sprintf-error
actions:
codelingo/docs:
body: Find instances of 'errors.New(fmt.Sprintf(...))'.
codelingo/review:
comment: Should replace errors.New(fmt.Sprintf(...)) with errors.Errorf(...).
query: |
import codelingo/ast/go
@review.comment
go.call_expr(depth = any):
go.selector_expr:
go.ident:
name: "errors"
go.ident:
name: "New"
go.args:
go.call_expr:
go.selector_expr:
go.ident:
name: "fmt"
go.ident:
name: "Sprintf"
```
## Rules
Rules live in codelingo.yaml files in your repository and are used by Flows to automate tasks. You can think of a Rule as an underlying principle guiding a workflow.
In the sprintf-error Rule above, the Review Action uses the Rule to make sure `errors.New` is being used correctly and attaches a comment to the line where the `go.call_expr` is found, using the `@review.comment` decorator.
### Adding Rules
There are three ways to add Rules to a codelingo.yaml file:
1. The easist is to import a bundle of Rules:
```yaml
rules:
- import: codelingo/go
```
In the example above `codelingo` is the bundle owner and `go` is the bundle name. More Rule bundles from the community can be found [here](https://github.com/codelingo/hub/tree/master/rules).https://github.com/codelingo/hub/tree/master/rules
2. The second way is to import individual Rules from a bundle:
```yaml
rules:
- import: codelingo/go/goto
- import: codelingo/go/sprintf
```
3. The third way is to write a new Rule directly in the codelingo.yaml file:
```
rules:
- name: find-funcs
actions:
codelingo/docs:
title: "example Rule that finds all func decls"
codelingo/review:
comment: "this is a function"
query:
import go
@review.comment
go.func_decl
```
---
Publishing a Rule Bundle
To publish a Rule Bundle, make a pull request to github.com/codelingo/hub and add a folder under:
```
rules/
<your-codelingo-username>/
<bundle-name>/
<rule-name>/
codelingo.yaml
```
---
_Find and Share CodeLingo Resources_
The CodeLingo Hub is an Open source collection of CodeLingo Resources.
* Lexicons - Libraries for DSLs, such as a language AST or VCS. Provides facts for queries.
* Rules - Patterns and anti-patterns in your software stack written in CLQL.
* Flows - pipelines for process augmentation and automation.
* Bots - agents that integrate with your services and data stores.
If you are first getting started with CodeLingo please [check out the getting started guide](https://codelingo.io/docs/getting-started).
To use CodeLingo locally, you will need to install the CLI tool which [can be found here](https://github.com/codelingo/lingo)
For any questions please **[join the conversation in Slack](https://join.slack.com/t/codelingo/shared_invite/enQtMzY4MzA5ODYwOTYzLWVhMjI1ODU1YmM3ODAxYWUxNWU5ZTI0NWI0MGVkMmUwZDZhNWYxNGRiNWY4ZDY0NzRkMjU5YTRiYWY2N2FlMmU)**
## Lexicons
Lexicons provide the DSL for querying against a particular domain, specifically programming languages, version control, runtime, and databases.
Lexicons are imported as part of a CLQL query. Please see the documentation for more information about using Lexicons.
Lexicons are currently available for the follow programming languages:
[Go](lexicons/ast/codelingo/go), [Python](lexicons/ast/codelingo/python), [PHP](lexicons/`ast/codelingo/php), [C++](lexicons/ast/codelingo/c++), [C#](lexicons/ast/codelingo/csharp)
If you are interested in writing your own lexicon, please contact us at hello@codelingo.io
## Rules
Rules are stored patterns and queries that can be applied to your software stack. All Rules are constructed in CLQL and rely on specific lexicons.
Pre-written Rules found in the Hub can be imported within your lingo file as follows:
```
rules:
- import codelingo/go/empty-slice
```
All pre-written Rules are available within this repository, and simply be explored through the file structure. For example, [here is a Rule for Go](rules/codelingo/go/goto) that uses of goto
For more information and about writing your own Rules, please [see the documentation](https://codelingo.io/docs/concepts/rules/)
**[Explore all Rules](/rules)**
## Flows
Rules are integrated into your workflow through Flows. Flows are automated and semi-automated processes that rely heavily on bots (integrations) to drive your software development lifecycle. They are completely customizable pipelines and can be configured directly in YAML or via the UI.
Currently the default Action is the review Action. Custom Flows are currently in development.
## Bots
Bots are agents that integrate with all your data sources, tools, and services. They can be used to:
* ingest your codebase into a action
* make a comment on Github
* create Slack messages on results
* integrate with other external services
## Contributing
If you have new Rules or Flows that you would like to contribute to the Hub, please raise a Pull Request directly against the repo.
## Other Resources
* [Roadmap](/company/ROADMAP.md)
* [Join Slack](https://join.slack.com/t/codelingo/shared_invite/enQtMzY4MzA5ODYwOTYzLWVhMjI1ODU1YmM3ODAxYWUxNWU5ZTI0NWI0MGVkMmUwZDZhNWYxNGRiNWY4ZDY0NzRkMjU5YTRiYWY2N2FlMmU)
* [Documentation](https://codelingo.io/docs)
---
[hello@codelingo.io](mailto:hello@codelingo.io) | [codelingo.io](https://codelingo.io)