Skip to content

Commit

Permalink
Revert "Add release toolkit dictionary (NR-112268) (#13)" (#14)
Browse files Browse the repository at this point in the history
This reverts commit ca7ab5b.
  • Loading branch information
gsanchezgavier committed May 5, 2023
1 parent ca7ab5b commit dd59c63
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/selftest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
test_local:
runs-on: ubuntu-latest
name: Test local files are not override by the ones coming from the action
name: Test get config files with local files
steps:
- uses: actions/checkout@v2
- name: Get test local files
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/.semgrep.yml
/.semgrep-bck.yml
/.semgrepignore
/.rt-dictionary.yml
test/tmp
semgrep-go
yq
Expand Down
32 changes: 9 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,21 @@

# newrelic-infra-checkers

Common configuration files for tools used in New Relic integrations and agent repositories.
Default configuration files for the static analysis tools used in New Relic integrations and agent repositories.

Configuration files are placed in hardcoded paths that meets the tools expectations.

If those file already exists in the repo they are not overwritten.


## Supported tools

- semgrep: common configuration for [semgrep](https://semgrep.dev/).
- golangci-lint: common configuration for [golangci-lint](https://golangci-lint.run/).
- golangci-lint limited: contains a limited amount of linters, meant to be added to projects already developed that are not compliant with those removed linters.
- release toolkit dictionary: dictionary used by the [link-dependencies](https://github.com/newrelic/release-toolkit/tree/main/link-dependencies) action.
Action to get those default config files.

## Usage

Example of usage:
Usage and defaults:
```yaml
jobs:
static-analysis:
name: Run tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: newrelic/newrelic-infra-checkers@v1
# Tools running after will use the configuration obtained from 'newrelic-infra-checkers' action.
- uses: returntocorp/semgrep-action@v1
- uses: golangci/golangci-lint-action@v2
- name: Get default configuration files for NR static analysis tools
uses: newrelic/newrelic-infra-checkers@v1
with:
semgrep-append: false # Optional, if set to true, local semgrep file policies will join the ones in this repository.
golangci-lint-limited: true # Optional, if set to true, `golangci-lint-limited` config will be used instead of `golangci-lint`.
```
If local config file for the linters exist, the ones in this repository won't overwrite them.
## Support
Expand Down
17 changes: 0 additions & 17 deletions action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ set -o pipefail
[[ -n $GITHUB_ACTION_PATH ]] || GITHUB_ACTION_PATH=$(pwd)
[[ -n $SEMGREP_APPEND ]] || SEMGREP_APPEND="true"
[[ -n $GOLANGCI_LINT_CONFIG ]] || GOLANGCI_LINT_CONFIG="golangci-lint-limited"
[[ -n $RT_DICTIONARY ]] || RT_DICTIONARY="rt-dictionary"

echo "Using $GOLANGCI_LINT_CONFIG golangci-lint configuration folder"

Expand Down Expand Up @@ -44,20 +43,4 @@ do
fi
done


echo "Using $RT_DICTIONARY release toolkit dictionary folder"

find $GITHUB_ACTION_PATH/$RT_DICTIONARY -type f | while read -r file
do
fileBasename=$(basename $file)

if [[ ! -f "$fileBasename" ]]
then
echo "ℹ️ Copying $fileBasename file to repo root directory"
cp "$file" "$fileBasename"
else
echo "ℹ️ Local $fileBasename file detected skipping overwrite"
fi
done

echo "ℹ️ Configuration files correctly copied"
5 changes: 0 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ inputs:
description: Set it to use a different folder for golangci-lint settings, by default it uses golangci-lint-limited.
required: false
default: golangci-lint-limited
rt-dictionary:
description: Set it to use a different folder for release toolkit dictionary, by default it uses rt-dictionary.
required: false
default: rt-dictionary
runs:
using: "composite"
steps:
Expand All @@ -26,4 +22,3 @@ runs:
env:
SEMGREP_APPEND: ${{ inputs.semgrep-append }}
GOLANGCI_LINT_CONFIG: ${{ inputs.golangci-lint-config }}
RT_DICTIONARY: ${{ inputs.rt-dictionary }}
24 changes: 0 additions & 24 deletions rt-dictionary/.rt-dictionary.yml

This file was deleted.

2 changes: 0 additions & 2 deletions test/data/rt-dictionary.yml

This file was deleted.

0 comments on commit dd59c63

Please sign in to comment.