forcedotcom / forcedotcom/code-analyzer

[Feature Request] File based regex rules

Đang mở
#1,972 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
240
Fork
52
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
5

Mô tả

### Product Area

The "code-analyzer" CLI

### Your Need or Problem

Allow for regex rules to be placed into their own files and referenced from `code-analyzer.yml` so that they can be more easily shared between projects instead of merging them into existing files.

### Your Desired Solution

Lets say we had the rule:
```yaml
name: Salesforce Code Analyzer Configuration
version: 1.0.0

rulesets: []

engines:
regex:
custom_rules:
ProhibitSuppressWarnings:
regex: /@SuppressWarnings\([^)]*\)|\/\/\s*NOPMD/gi
file_extensions: ['.apex', '.cls', '.trigger']
description:
'Prohibits the use of @SuppressWarnings annotations and
NOPMD comments in Apex code. Suppressions hide code quality
issues; prefer fixing the underlying problems or improving
rules instead.'
violation_message:
'Suppression of warnings is not allowed. Fix the underlying
issue or improve the rule instead of suppressing violations.'
severity: 'High'
tags: ['CodeStyle', 'Recommended']
```
I would like to take the details of that rule and put them in a different .yaml file, then refer to that .yaml file from code-analyzer.yml

### Alternatives Considered

Keep adding rules to code-analyzer.yml like today, using a pre-processor/script ahead of every run, etc

### Additional Context (Screenshots, Files, etc)

_No response_

### Workaround

_No response_

### Urgency

Low

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu tại điểm vào CLI tải code-analyzer.yml và theo dõi cách regex custom_rules được phân tích. Xem xét cách một tệp quy tắc YAML bên ngoài có thể được tham chiếu và dùng chung, sau đó xác minh rằng các quy tắc inline hiện có tiếp tục hoạt động cùng với các quy tắc dựa trên tệp trong một lần chạy CLI tiêu biểu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
cli, tooling
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.