Skip to content

Commit

Permalink
chore: improve issue templates (#1078)
Browse files Browse the repository at this point in the history
  • Loading branch information
latonz committed Jan 23, 2024
1 parent 030d92a commit 09f409b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
26 changes: 16 additions & 10 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,36 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Declare a mapper as an interface
2. Add a mapping method `CarDto CarToDto(Car car);`
3. ...
**Declaration code**
```csharp
// Relevant code of the Mapperly definition and all relevant classes
```

**Expected behavior**
A clear and concise description of what you expected to happen.
**Actual generated code**
```csharp
// Actual relevant code generated by Mapperly
// see also https://mapperly.riok.app/docs/configuration/generated-source/
```

**Code snippets**
If applicable, add code snippets to help explain your problem.
**Expected generated code**
```csharp
// The generated code how you expect it to look like
```

**Environment (please complete the following information):**
- Mapperly Version: [e.g. 1.0.1]
- .NET Version: [e.g. .NET 6.0.102]
- Target Framework: [e.g. .net6.0]
- Compiler Version: [e.g. 4.8.0-3.23524.11 (f43cd10b), obtain with `#error version` in any `.cs` file]
- C# Language Version: [e.g. 12.0]
- IDE: [e.g. Visual Studio v17.5.2 or Rider 2023.1]
- OS: [e.g. macOS 13.3]

Expand Down
11 changes: 8 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Feature request
about: Suggest an idea for this project
about: Suggest an idea for Mapperly
title: ''
labels: ''
labels: 'enhancement'
assignees: ''

---
Expand All @@ -11,7 +11,12 @@ assignees: ''
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
A clear and concise description of what you want to happen including a proposal on the API surface and the matching generated code.

```csharp
// Relevant new / adjusted API surface
// Expected generated code
```

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/configuration/generated-source.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ This is done for performance reasons,
otherwise the IDE could become laggy.
:::

## Static code analysis (SCA/SAST) on generated source code
## Identifying generated code

Many developers and businesses use static code analysis and security analysis tooling to identify the quality of their code/applications.
For example linting, code coverage, code smells, performance problems, vulnerabilities, and so on.
However, code generators (like Mapperly) do not always align with the guidelines/best practices of each individual project
and thus you may want to apply a different set of rules.
and thus you may want to apply a different set of rules or ignore the generated code completely.

The code generated by Mapperly can be identified in several ways:

- the path/location where the source code is saved (see previous section)
- each file has a `.g.cs` file extension
- each file starts with a commented out line: `// <auto-generated />`
- generated member types and classes are annotated with the `GeneratedCodeAttribute`:
```
```csharp
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "1.0.0.0")]
```
> Note: the version `1.0.0.0` will be the version of the NuGet package of Mapperly that you are using.
Using these identification points, you can configure most tooling to apply a different set or rules to the generated source.
Using these identification points, you can configure most tooling to apply a different set of rules to the generated source.

0 comments on commit 09f409b

Please sign in to comment.