Skip to content

Conversation

@Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Nov 7, 2024

Problem

Currently jscpd ci action filters on changed files in PR. This results in clones being returned from changes outside our changes (but within the same files).

jscpd is the most commonly failing CI task at the moment, so to keep CI green we want to reduce false positives.

Solution

  • jscpd only lists clones that includes lines from the changed lines in the changed files.
  • Included in this PR is a refactor of the action to simplify the bash scripting done in the action yml file.
  • Some tests for the filterDuplicates.ts script to make future changes easier.

See 12fc4d6 for an example failure.


License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions

This comment was marked as resolved.

@Hweinstock Hweinstock changed the title build(lint): use changed lines instead of changed files to avoid false positives (WIP IGNORE) build(lint): use changed lines instead of changed files to avoid false positives. Nov 12, 2024
@Hweinstock Hweinstock marked this pull request as ready for review November 18, 2024 19:28
@Hweinstock Hweinstock requested a review from a team as a code owner November 18, 2024 19:28
@Hweinstock Hweinstock marked this pull request as draft December 20, 2024 19:00
@Hweinstock Hweinstock changed the title build(lint): use changed lines instead of changed files to avoid false positives. build(jscpd): use changed lines instead of changed files to avoid false positives. Dec 20, 2024
@Hweinstock Hweinstock marked this pull request as ready for review December 20, 2024 19:42
@justinmk3 justinmk3 changed the title build(jscpd): use changed lines instead of changed files to avoid false positives. ci(jscpd): check changed lines instead of changed files to avoid false positives Dec 23, 2024
@justinmk3 justinmk3 merged commit 745306d into aws:master Dec 23, 2024
26 checks passed
karanA-aws pushed a commit to karanA-aws/aws-toolkit-vscode that referenced this pull request Jan 17, 2025
## Problem
The `jscpd` check checks changed *files*. So duplicate code may be
reported on lines outside of the actual changes (in the same file),
which may be considered false positives.

## Solution
- Only report "clones" (duplicate code) on actually changed lines.
- Refactor the action to simplify the bash scripting.
- Add tests for `filterDuplicates.ts`.
s7ab059789 pushed a commit to s7ab059789/aws-toolkit-vscode that referenced this pull request Feb 19, 2025
## Problem
The `jscpd` check checks changed *files*. So duplicate code may be
reported on lines outside of the actual changes (in the same file),
which may be considered false positives.

## Solution
- Only report "clones" (duplicate code) on actually changed lines.
- Refactor the action to simplify the bash scripting.
- Add tests for `filterDuplicates.ts`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants