Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve eslint complexity warnings #1248

Closed
samayer12 opened this issue Oct 9, 2024 · 0 comments
Closed

Resolve eslint complexity warnings #1248

samayer12 opened this issue Oct 9, 2024 · 0 comments
Labels

Comments

@samayer12
Copy link
Contributor

samayer12 commented Oct 9, 2024

Describe what should be investigated or refactored

ESlint has several warnings for complexity violations across the codebase. Resolve these warnings.

This is a large issue that will require multiple PRs to address. Contributors are welcome to open up a smaller, targeted issue and resolve a single complexity warning to keep the size of work to a smaller chunk. We'll use cross-references to this issue to correlate changes.

Definition of Done

  • There are zero eslint warnings for complexity
  • complexity is set to error from warn in .eslintrc.json

Additional context

Run the linter with npm format:check

@samayer12 samayer12 added the good first issue Good for newcomers label Oct 9, 2024
@cmwylie19 cmwylie19 removed the good first issue Good for newcomers label Oct 21, 2024
@cmwylie19 cmwylie19 added this to the v0.39.0 milestone Oct 23, 2024
@cmwylie19 cmwylie19 moved this from 🆕 New to 📋 Backlog in Pepr Project Board Oct 23, 2024
@samayer12 samayer12 self-assigned this Oct 24, 2024
btlghrants pushed a commit that referenced this issue Oct 30, 2024
…1333)

## Description

This PR is part of the effort to reduce complexity in the code. Instead
of using ternaries that are chained together, this refactor introduces a
[FilterChain](https://docs.spring.io/spring-security/reference/servlet/architecture.html#servlet-filterchainproxy)
analagous to what you might see in the Spring Framework to achieve the
same outcome, improving readability and maintenance.

## Related Issue

Relates to #1248 

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Checklist before merging
- [x] Unit,
[Journey](https://github.com/defenseunicorns/pepr/tree/main/journey),
[E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples),
[docs](https://github.com/defenseunicorns/pepr/tree/main/docs),
[adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or
updated as needed
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed

---------

Co-authored-by: Case Wylie <[email protected]>
@cmwylie19 cmwylie19 added the large large label Nov 4, 2024
@btlghrants btlghrants removed this from the v0.39.0 milestone Nov 4, 2024
@btlghrants btlghrants moved this from 📋 Backlog to 🏗 In progress in Pepr Project Board Nov 4, 2024
cmwylie19 pushed a commit that referenced this issue Nov 6, 2024
## Description

Reverts filter-chaining from #1333 due to regressions, but keeps
subsequent work.

End to End Test:  <!-- if applicable -->  
(See [Pepr Excellent
Examples](https://github.com/defenseunicorns/pepr-excellent-examples))

## Related Issue

Relates to #1248 
Closes #1389 

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging
- [x] Unit,
[Journey](https://github.com/defenseunicorns/pepr/tree/main/journey),
[E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples),
[docs](https://github.com/defenseunicorns/pepr/tree/main/docs),
[adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or
updated as needed
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed
cmwylie19 added a commit that referenced this issue Nov 12, 2024
… for readability (#1409)

## Description

Part of a series of smaller steps to address #1397 without giant PRs.

End to End Test:  <!-- if applicable -->  
(See [Pepr Excellent
Examples](https://github.com/defenseunicorns/pepr-excellent-examples))

## Related Issue

Relates to #1397, #1406, #1407, #1408, #1248

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Checklist before merging
- [x] Unit,
[Journey](https://github.com/defenseunicorns/pepr/tree/main/journey),
[E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples),
[docs](https://github.com/defenseunicorns/pepr/tree/main/docs),
[adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or
updated as needed
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed

Co-authored-by: Case Wylie <[email protected]>
cmwylie19 added a commit that referenced this issue Nov 13, 2024
…readability (#1408)

## Description

Break up a previously large test file in the interest of readability and
future refactors around the test suite and code complexity.

End to End Test:  <!-- if applicable -->  
(See [Pepr Excellent
Examples](https://github.com/defenseunicorns/pepr-excellent-examples))

## Related Issue

Relates to #1397, #1406, #1407, #1248

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Checklist before merging
- [x] Unit,
[Journey](https://github.com/defenseunicorns/pepr/tree/main/journey),
[E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples),
[docs](https://github.com/defenseunicorns/pepr/tree/main/docs),
[adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or
updated as needed
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed

Co-authored-by: Case Wylie <[email protected]>
cmwylie19 added a commit that referenced this issue Dec 2, 2024
## Description
Refactor to eliminate eslint warnings: max-statements, complexity in
`src/lib/controller/index.ts`.

## Related Issue

Relates to #1248 

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Checklist before merging
- [x] Unit,
[Journey](https://github.com/defenseunicorns/pepr/tree/main/journey),
[E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples),
[docs](https://github.com/defenseunicorns/pepr/tree/main/docs),
[adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or
updated as needed
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed

---------

Co-authored-by: Case Wylie <[email protected]>
github-merge-queue bot pushed a commit that referenced this issue Dec 4, 2024
…/lib/assets/index.ts` (#1497)

### Describe what should be investigated or refactored

Refactor of `src/lib/assets/index.ts` to reduce complexity warnings:
```
/pepr/src/lib/assets/index.ts
  82:23  warning  Async method 'generateHelmChart' has a complexity of 12. Maximum allowed is 10        complexity
  82:23  warning  Async method 'generateHelmChart' has too many statements (58). Maximum allowed is 20  max-statements
```

### Additional context
In support of #1248

---------

Co-authored-by: Sam Mayer <[email protected]>
github-merge-queue bot pushed a commit that referenced this issue Dec 5, 2024
… processing (#1402)

## Description

The adjudicators are untyped, which caused complications when merging PR
#1333. We should use TypeScript to enforce typing so that any refactors
to filtering are based upon a solid foundation that does not require
intermediate kludges with the typing system.

End to End Test:  <!-- if applicable -->  
(See [Pepr Excellent
Examples](https://github.com/defenseunicorns/pepr-excellent-examples))

## Related Issue

Relates to #1248, #1406, #1407, #1408, #1409, #1397

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Checklist before merging
- [x] Unit,
[Journey](https://github.com/defenseunicorns/pepr/tree/main/journey),
[E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples),
[docs](https://github.com/defenseunicorns/pepr/tree/main/docs),
[adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or
updated as needed
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed

---------

Co-authored-by: Case Wylie <[email protected]>
github-merge-queue bot pushed a commit that referenced this issue Dec 9, 2024
…alidate-processor.ts (#1529)

### Describe what should be investigated or refactored

Refactor of `src/lib/validate-processor.ts` to reduce complexity
warnings:
```
/pepr/src/lib/validate-processor.ts
  15:8  warning  Async function 'validateProcessor' has a complexity of 13. Maximum allowed is 10  complexity
  62:9  warning  Blocks are nested too deeply (4). Maximum allowed is 3                            max-depth

```

### Additional context
Fixes #1381 
In support of #1248
github-merge-queue bot pushed a commit that referenced this issue Dec 12, 2024
…utate-processor.ts (#1543)

### Describe what should be investigated or refactored

Refactor of `src/lib/mutate-processor.ts` to reduce complexity warnings:
```
/pepr/src/lib/mutate-processor.ts
  18:8  warning  Async function 'mutateProcessor' has a complexity of 18. Maximum allowed is 10        complexity
  18:8  warning  Async function 'mutateProcessor' has too many statements (49). Maximum allowed is 20  max-statements
  99:9  warning  Blocks are nested too deeply (4). Maximum allowed is 3                                max-depth
```

### Additional context
Fixes #1532 
In support of #1248
github-merge-queue bot pushed a commit that referenced this issue Dec 13, 2024
…eploy.ts (#1577)

### Describe what should be investigated or refactored

Refactor of `src/cli/deploy.ts` to reduce complexity warnings:
```
/pepr/src/cli/deploy.ts
  28:13  warning  Async arrow function has too many statements (27). Maximum allowed is 20  max-statements
  28:13  warning  Async arrow function has a complexity of 17. Maximum allowed is 10        complexity
```

### Additional context
Fixes #1538 
In support of #1248

---------

Co-authored-by: Case Wylie <[email protected]>
github-merge-queue bot pushed a commit that referenced this issue Dec 17, 2024
…rNoMatchReason.ts (#1585)

### Describe what should be investigated or refactored

Refactor of `src/lib/filter/filterNoMatchReason.ts` to reduce complexity
warnings:
```
/pepr/src/lib/filter/filterNoMatchReason.ts
  32:8  warning  Function 'filterNoMatchReason' has a complexity of 13. Maximum allowed is 10  complexity
```

### Additional context
Fixes #1584 
In support of #1248
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Pepr Project Board Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants