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

Linting and Code Scanning #178

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
90a35df
add code quality tooling that was removed by l1 team
faddat Mar 1, 2023
47ab0e8
tidy and go 1.20
faddat Mar 1, 2023
2139232
begin cleanup (again). Linting makes issues more obvious, gives them…
faddat Mar 1, 2023
d93ed17
Delete CODEOWNERS
faddat Mar 1, 2023
7f5a812
fix
faddat Mar 1, 2023
ae71640
Merge branch 'cleanup-again' of https://github.com/faddat/core-3 into…
faddat Mar 1, 2023
22c3f0b
continue cleaning
faddat Mar 1, 2023
2b3d4ad
144 quality issues that were resolved motnhs ago to re-resolve before…
faddat Mar 1, 2023
0f4801e
135 code quality issues that were resolved motnhs ago to re-resolve b…
faddat Mar 1, 2023
b24e0f1
107 lint issssues I fixed months ago remaining
faddat Mar 1, 2023
8eaa482
93 lint issues fixed months ago remaining
faddat Mar 1, 2023
7df67ad
89 lint issues fixed months ago remaining
faddat Mar 1, 2023
c0a39b8
82 lint issues fixed months ago remaining
faddat Mar 1, 2023
8976a08
58 lint issues I fixed months ago remaining
faddat Mar 1, 2023
10f5276
28 lint issues that I fixed months ago, which were readded to the rep…
faddat Mar 1, 2023
a6c236a
there. Now we are back where we were 3 months ago.
faddat Mar 1, 2023
037da31
100%
faddat Mar 1, 2023
0c60902
go install
faddat Mar 1, 2023
b4e90b0
update modules
nghuyenthevinh2000 Mar 14, 2023
ff2db17
fix some gas
nghuyenthevinh2000 Mar 14, 2023
f9e7593
pass unit test
nghuyenthevinh2000 Mar 14, 2023
56aca2e
Add v3 name constant
fragwuerdig Mar 15, 2023
b86f44f
Create v3/upgrades.go
fragwuerdig Mar 15, 2023
0c40315
Upgrade Handler for v3
fragwuerdig Mar 15, 2023
a7b995e
Update app.go to contain v3 upgrade
fragwuerdig Mar 15, 2023
2d3f4c9
Merge remote-tracking branch 'origin/main' into cleanup-again
faddat Mar 15, 2023
b439a8d
linted
faddat Mar 15, 2023
1c691ca
fix test_utils.go
faddat Mar 15, 2023
008a420
remove exclusions
faddat Mar 15, 2023
a224fce
Merge remote-tracking branch 'origin/v0.45.13-proposal' into cleanup-…
faddat Mar 15, 2023
e587a9d
don't use deprecated
faddat Mar 15, 2023
0b719b6
Merge remote-tracking branch 'origin/v3-upgrade' into cleanup-again
faddat Mar 15, 2023
ae3ef18
lint
faddat Mar 15, 2023
e6641c4
imports should be consistent
faddat Mar 15, 2023
2cde9cb
imports should be consistent
faddat Mar 15, 2023
3159333
organize replace statements
faddat Mar 15, 2023
6041881
annotation
faddat Mar 15, 2023
a4b8092
Revert "Merge remote-tracking branch 'origin/v3-upgrade' into cleanup…
faddat Mar 15, 2023
955cccb
Revert "Merge remote-tracking branch 'origin/v0.45.13-proposal' into …
faddat Mar 15, 2023
3184df5
fix cmd
faddat Mar 15, 2023
6e7bbca
without upstream PRs
faddat Mar 15, 2023
1db0047
tidy
faddat Mar 15, 2023
5c41ee2
tidy and update ci go versioning
faddat Mar 15, 2023
4f560fa
go mod and sum
faddat Mar 18, 2023
f80a5d8
Merge remote-tracking branch 'origin/main' into cleanup-again
faddat Mar 18, 2023
ea3827c
unused-param lint fixes
faddat Mar 18, 2023
794fcdf
unused-param lint fixes
faddat Mar 18, 2023
32b914f
fix redefines-builtin-id
faddat Mar 18, 2023
3faec01
address feedback on authtypes in ante_test.go
faddat Mar 18, 2023
5bd485b
remove liveness test
faddat Mar 18, 2023
16a49d4
restore livveness test
faddat Mar 18, 2023
2e6dbd3
remove needless deprecated github action
faddat Mar 18, 2023
9167f92
Merge remote-tracking branch 'origin/main' into cleanup-again
faddat Mar 21, 2023
a520f9b
merge main
faddat Mar 21, 2023
5040427
stricter
faddat Mar 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/dependabot.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need any bot watching for CometBFT deps. CometBFT is not (yet) part of our Classic codebase...

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment about dependabot

updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
ignore:
- dependency-name: github.com/CosmWasm/wasmvm
versions:
- 0.14.0-beta2
- 0.14.0-beta3
- 0.14.0-beta4
- 0.14.0-beta5
- 0.14.0-rc1
- dependency-name: github.com/cosmos/cosmos-sdk
versions:
- 0.41.4
- 0.42.0
- 0.42.1
- 0.42.2
- 0.42.4
- dependency-name: google.golang.org/grpc
versions:
- 1.36.0
- 1.36.1
- 1.37.0
- dependency-name: github.com/spf13/cobra
versions:
- 1.1.2
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are in the process of building a new CI/CD pipeline. So most of the assets will most likely end up being deprecated

on: [push, pull_request]
name: Build

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
name: build
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- run: go build ./...

tidy:
runs-on: ubuntu-latest
name: tidy
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- run: |
go mod tidy
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
git status && git --no-pager diff
exit 1
fi
61 changes: 61 additions & 0 deletions .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.

name: Codacy Security Scan

on:
push:
branches: [ "main", "release/v*" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main", "release/v*" ]
schedule:
- cron: '24 14 * * 5'

permissions:
contents: read

jobs:
codacy-security-scan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v3

# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@d43127fe38d20c527dc1951ae5aea23148bab738
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647

# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif
35 changes: 35 additions & 0 deletions .github/workflows/codeql-analizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Code Scanning - Action"

on:
pull_request:
paths:
- "**.go"
push:
branches: [ main ]
paths:
- "**.go"

jobs:
CodeQL-Build:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: 'go'
queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
40 changes: 40 additions & 0 deletions .github/workflows/codeql-cosmos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "CodeQL for cosmos"

on:
pull_request:
paths:
- "**.go"
push:
branches:
- main
- release/v*
paths:
- "**.go"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20"
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: "go"
queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality

- name: Build
run: make build

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
15 changes: 4 additions & 11 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ on:
push:
branches:
- main
- release/**
- release/v*
paths:
- "**.go"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
Expand All @@ -29,19 +25,16 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: "1.20"
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: "go"
queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@mains

- name: Build
run: make build

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v2
20 changes: 20 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
61 changes: 13 additions & 48 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,23 @@
name: Build & Push
# Build & Push builds the simapp docker image on every push to master and
# and pushes the image to https://hub.docker.com/r/interchainio/simapp/tags
---
name: Build Docker Image on PR

on:
pull_request:
push:
branches:
- main
- master
- "release/*"
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5

jobs:
build:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0

- name: Prepare
id: prep
run: |
DOCKER_IMAGE=terramoney/core
VERSION=noop
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
VERSION=latest
fi
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION}"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')

- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to Docker Hub
- name: Build without push
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' && !contains(github.ref, 'release') }}
tags: ${{ steps.prep.outputs.tags }}
context: .
platforms: linux/amd64
push: false
build-args: arch=x86_64
34 changes: 34 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: golangci-lint
on:
push:
tags:
- v*
branches:
- release/v*
- main
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.20"
- uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 10m
Loading