Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Boeing/config-file-validator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.6.0
Choose a base ref
...
head repository: Boeing/config-file-validator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.7.0
Choose a head ref
  • 16 commits
  • 60 files changed
  • 8 contributors

Commits on Mar 29, 2024

  1. updating PKGBUILD (#129)

    kehoecj authored Mar 29, 2024
    Copy the full SHA
    54b6781 View commit details

Commits on Apr 10, 2024

  1. Fix Go Report Card Issues (#131)

    * Fix ineffassign
    
    * Fix ineffassign
    
    * Fix misspell
    
    * Fix gocyclo
    
    * Return error
    
    * @ccoVeille s suggestion
    
    * Returning error
    
    Co-authored-by: ccoVeille <[email protected]>
    
    * Removed interface{} to solve type problems.
    >
    >
    Co-authored-by: ccoVeille <[email protected]>
    
    * Comment
    Co-authored-by: ccoVeille <[email protected]>
    
    * Fix file output on quiet flag
    
    * Delete test/result.json
    
    * Changed 1 test
    
    * Test fix
    
    * remove test.txt
    
    * Coverage test
    Co-authored-by: ccoVeille <[email protected]>
    
    ---------
    
    Co-authored-by: ccoVeille <[email protected]>
    HakanVardarr and ccoVeille authored Apr 10, 2024
    Copy the full SHA
    9006fce View commit details
  2. chore: Updated coverage badge.

    actions-user committed Apr 10, 2024
    Copy the full SHA
    4fbc213 View commit details

Commits on Apr 11, 2024

  1. code review (#132)

    * chore: format files before working on them
    
    files were formatted with gofumpt
    
    * fix: make sure to always wrap errors
    
    This is the only way to be able to catch a specific error with errors.Is
    in the code calling the method
    
    * fix: errors have to be manipulated with care
    
    The existing code could lead to errors with wrapped errors
    
    - using `if err == whatever` don't catch wrapped errors
    
    - using type assertion could lead to panic
    
    * fix: error returned by reporters must be handled
    
    * fix: misuage of WalkDirFunc
    
    * chore: fix some typos and error in the struct
    
    * chore: remove unused receivers
    
    The code is then clearer
    
    * chore: Replace all interface{} by any
    
    any is available since Go 1.18, it makes code clearer.
    
    * chore: use uppercase for JSON, XML, and YAML acronyms
    
    * chore: use simpler name for cli Option
    
    an option of cli doesn't need to be named cli.CLIOption
    
    * chore: avoid shadowing import
    
    when importing something from cli package, we shouldn't name a variable cli
    
    * chore: avoid useless else
    
    The code is clearer to understand.
    
    * chore: remove unused assertErrorIs and accept assert.Error
    ccoVeille authored Apr 11, 2024
    Copy the full SHA
    6d21ca3 View commit details
  2. chore: Updated coverage badge.

    actions-user committed Apr 11, 2024
    Copy the full SHA
    bb6358e View commit details

Commits on Apr 16, 2024

  1. chore: enable golangci-lint on repository (#138)

    ccoVeille authored Apr 16, 2024
    Copy the full SHA
    c8df506 View commit details

Commits on May 29, 2024

  1. Enable openssf scorecard (#151)

    * initialize openssf scorecard
    
    * test-scorecard-on-PR
    
    * add scorecard badge to README
    
    * increasing timeout in golangci workflow
    
    * Add scorecard badge to index.md
    
    * Update .github/workflows/scorecard.yml
    
    Co-authored-by: Jamie Davidson <[email protected]>
    
    * Update scorecard.yml
    
    ---------
    
    Co-authored-by: Jamie Davidson <[email protected]>
    kehoecj and jd4235 authored May 29, 2024
    Copy the full SHA
    1730fbe View commit details
  2. chore: Updated coverage badge.

    actions-user committed May 29, 2024
    Copy the full SHA
    2fdf93a View commit details
  3. Improve Scorecard scores (#152)

    * add openssf best practices badge
    
    * adding security
    
    * remove binary file
    
    * improving workflow security
    
    * addings SHAs to base containers
    
    * fixing workflows
    
    * fixing workflows
    
    * updating security text
    kehoecj authored May 29, 2024
    Copy the full SHA
    f28a04d View commit details

Commits on May 30, 2024

  1. ci(goreportcard): Add step for goreportcard check (#149)

    Bhargav-InfraCloud authored May 30, 2024
    Copy the full SHA
    7203891 View commit details

Commits on Aug 3, 2024

  1. EditorConfig file type #145 (#157)

    * EditorConfig file type
    
    * Removed deprecated ParseBytes function
    
    * Update pkg/filetype/file_type.go
    
    ---------
    
    Co-authored-by: Clayton Kehoe <[email protected]>
    HakanVardarr and kehoecj authored Aug 3, 2024
    Copy the full SHA
    be200ae View commit details
  2. Update README.md

    kehoecj authored Aug 3, 2024
    Copy the full SHA
    2982c50 View commit details
  3. Update index.md

    kehoecj authored Aug 3, 2024
    Copy the full SHA
    d9a4db4 View commit details
  4. small optimization for fsfinder (#136)

    * changed []string to map[string]struct{} in FileSystemFinder struct fields because of optimization (arrays were used only to check the occurrence of an element)
    
    * Changed field Extensions type in FileType from []string to map[string]struct{}
    
    * added requested changes
    
    * small refactoring of findOne func
    
    * fixd the return value
    
    * get back to trimprefix func
    
    * cleanup
    
    * fsfinder optimization
    
    * i hope it fixed
    
    * removed unnecessary calls to filepath.Abs
    
    * Apply suggestions from code review
    
    ---------
    
    Co-authored-by: Yaroslav <=>
    Co-authored-by: Clayton Kehoe <[email protected]>
    SkobelkinYaroslav and kehoecj authored Aug 3, 2024
    Copy the full SHA
    e601c40 View commit details

Commits on Aug 12, 2024

  1. Update Dockerfile to latest apline

    kehoecj authored Aug 12, 2024
    Copy the full SHA
    c502b13 View commit details

Commits on Aug 13, 2024

  1. ci: add the permission to release assets (#160)

    The release v1.7.0 failed due to the permission error.
    
    https://github.com/Boeing/config-file-validator/actions/runs/10362649156/job/28684983356#step:6:284
    
    ```
    + github-assets-uploader -logtostderr -f ../validator-v1.7.0-linux-amd64.tar.gz -mediatype application/gzip -repo Boeing/config-file-validator -token *** -tag=v1.7.0 -releasename= -retry 3
    W0813 02:34:38.260789    1654 main.go:48] Upload asset error, will retry in 4s: POST https://uploads.github.com/repos/Boeing/config-file-validator/releases/169879682/assets?name=validator-v1.7.0-linux-amd64.tar.gz: 403 Resource not accessible by integration []
    W0813 02:34:42.775738    1654 main.go:48] Upload asset error, will retry in 9s: POST https://uploads.github.com/repos/Boeing/config-file-validator/releases/169879682/assets?name=validator-v1.7.0-linux-amd64.tar.gz: 403 Resource not accessible by integration []
    E0813 02:34:52.242572    1654 err_exit.go:11] POST https://uploads.github.com/repos/Boeing/config-file-validator/releases/169879682/assets?name=validator-v1.7.0-linux-amd64.tar.gz: 403 Resource not accessible by integration []
    ```
    
    The permission `contents: write` is required, but it was removed by f28a04d#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34 .
    So this commit adds the permission.
    suzuki-shunsuke authored Aug 13, 2024
    Copy the full SHA
    10a6def View commit details
Showing with 780 additions and 253 deletions.
  1. +3 −0 .gitattributes
  2. +31 −8 .github/workflows/go.yml
  3. +58 −0 .github/workflows/golangci-lint.yml
  4. +58 −0 .github/workflows/goreportcard.yaml
  5. +20 −7 .github/workflows/release.yml
  6. +68 −0 .github/workflows/scorecard.yml
  7. +1 −0 .gitignore
  8. +161 −0 .golangci.yaml
  9. +2 −2 Dockerfile
  10. +1 −1 PKGBUILD
  11. +10 −1 README.md
  12. +9 −0 SECURITY.md
  13. +9 −7 cmd/validator/validator.go
  14. +3 −0 cmd/validator/validator_test.go
  15. +3 −1 go.mod
  16. +5 −0 go.sum
  17. +11 −2 index.md
  18. +87 −60 pkg/cli/cli.go
  19. +3 −7 pkg/cli/cli_test.go
  20. +0 −1 pkg/cli/group_output.go
  21. +3 −6 pkg/cli/group_output_test.go
  22. +18 −9 pkg/filetype/file_type.go
  23. +16 −8 pkg/finder/finder_test.go
  24. +36 −28 pkg/finder/fsfinder.go
  25. +19 −14 pkg/reporter/json_reporter.go
  26. +1 −1 pkg/reporter/junit_reporter.go
  27. +1 −0 pkg/reporter/reporter.go
  28. +53 −34 pkg/reporter/reporter_test.go
  29. +21 −23 pkg/reporter/stdout_reporter.go
  30. +4 −4 pkg/validator/csv.go
  31. +18 −0 pkg/validator/editorconfig.go
  32. +8 −3 pkg/validator/env.go
  33. +1 −1 pkg/validator/hcl.go
  34. +1 −1 pkg/validator/hocon.go
  35. +1 −1 pkg/validator/ini.go
  36. +12 −5 pkg/validator/json.go
  37. +2 −2 pkg/validator/plist.go
  38. +1 −1 pkg/validator/properties.go
  39. +4 −3 pkg/validator/toml.go
  40. +8 −6 pkg/validator/validator_test.go
  41. +3 −3 pkg/validator/xml.go
  42. +3 −3 pkg/validator/yaml.go
  43. +1 −0 test/fixtures/good.editorconfig
  44. 0 test/fixtures/{mixedcase-extention → mixedcase-extension}/good.CSv
  45. 0 test/fixtures/{mixedcase-extention → mixedcase-extension}/good.HCl
  46. 0 test/fixtures/{mixedcase-extention → mixedcase-extension}/good.INi
  47. 0 test/fixtures/{mixedcase-extention → mixedcase-extension}/good.JSon
  48. 0 test/fixtures/{mixedcase-extention → mixedcase-extension}/good.PList
  49. 0 test/fixtures/{mixedcase-extention → mixedcase-extension}/good.PRoperties
  50. 0 test/fixtures/{mixedcase-extention → mixedcase-extension}/good.TOml
  51. 0 test/fixtures/{mixedcase-extention → mixedcase-extension}/good.YAml
  52. +2 −0 test/fixtures/subdir2/bad.editorconfig
  53. 0 test/fixtures/{uppercase-extention → uppercase-extension}/good.CSV
  54. 0 test/fixtures/{uppercase-extention → uppercase-extension}/good.HCL
  55. 0 test/fixtures/{uppercase-extention → uppercase-extension}/good.INI
  56. 0 test/fixtures/{uppercase-extention → uppercase-extension}/good.JSON
  57. 0 test/fixtures/{uppercase-extention → uppercase-extension}/good.PLIST
  58. 0 test/fixtures/{uppercase-extention → uppercase-extension}/good.PROPERTIES
  59. 0 test/fixtures/{uppercase-extention → uppercase-extension}/good.TOML
  60. 0 test/fixtures/{uppercase-extention → uppercase-extension}/good.YAML
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# recommended by https://github.com/golangci/golangci-lint-action
# this will force line ending to be lf on windows
*.go text eol=lf
39 changes: 31 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -11,14 +11,22 @@ on:
- main
pull_request:

permissions:
contents: read

jobs:
download:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.22'

@@ -29,10 +37,15 @@ jobs:
needs: download
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.22'

@@ -46,10 +59,15 @@ jobs:
needs: download
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.22'

@@ -65,12 +83,17 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.22'

58 changes: 58 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: golangci-lint
on:
push:
branches:
- master
- main
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read

jobs:
golangci:
strategy:
matrix:
go: ['1.21']
os: [ubuntu-latest, macos-latest, windows-latest]
permissions:
# Optional: Allow write access to checks to allow the action to annotate code in the PR.
checks: write

name: lint
runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ matrix.go }}
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@d6238b002a20823d52840fda27e2d4891c5952dc # v4.0.1
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.57.2

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
#
# Note: by default the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
args: --timeout=10m

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional:The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
58 changes: 58 additions & 0 deletions .github/workflows/goreportcard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Go Report Card

on:
push:
branches:
- main
pull_request:

permissions: # added using https://github.com/step-security/secure-repo
contents: read

jobs:
goreportcard:
strategy:
matrix:
go: ['stable']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ matrix.go }}
cache: false
- name: Checkout gojp/goreportcard repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
repository: gojp/goreportcard
path: goreportcard
- name: Install goreportcard-cli
# goreportcard-cli requires the following linters:
# 1. gometalinter
# 2. golint
# 3. gocyclo
# 4. ineffassign
# 5. misspell
# among which, the linter gometalinter is deprecated. However, goreportcard repo has a vendor version of it.
# Hence installing from the repo instead of `go install`. Refer https://github.com/gojp/goreportcard/issues/301
run: |
cd goreportcard
# Install prerequisite linter binaries: gometalinter, golint, gocyclo, ineffassign & misspell
# Refer: https://github.com/gojp/goreportcard?tab=readme-ov-file#command-line-interface
make install
# Install goreportcard-cli binary
go install ./cmd/goreportcard-cli
- name: Checkout Boeing/config-file-validator repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Run goreportcard
run: |
# Failure threshold is set to 100% to fail at any errors. Default is 75%.
goreportcard-cli -t 100
27 changes: 20 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -9,8 +9,7 @@ env:
IMAGE_NAME: ${{ github.repository }}

permissions:
contents: write
packages: write
contents: read

jobs:
releases-matrix:
@@ -26,9 +25,18 @@ jobs:
- goarch: arm64
goos: windows

permissions:
packages: write
contents: write

steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: wangyoucao577/go-release-action@8fa1e8368c8465264d64e0198208e10f71474c87 # v1.50
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
@@ -46,15 +54,20 @@ jobs:
strategy:
matrix:
include:
- base: "alpine:3.19"
- base: "alpine:3.19@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b"
postfix: ""
- base: "scratch"
postfix: "-scratch"
- base: "ubuntu:20.04"
- base: "ubuntu:20.04@sha256:874aca52f79ae5f8258faff03e10ce99ae836f6e7d2df6ecd3da5c1cad3a912b"
postfix: "-ubuntu"

steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
68 changes: 68 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 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.

name: Scorecard supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '43 11 * * 5'
push:
branches: [ "main" ]
pull_request:

# Declare default permissions as read only.
permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write

steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- name: "Checkout code"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
with:
results_file: results.sarif
results_format: sarif

# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
*.so
*.dylib
cmd/validator/validator
bin/

# Test binary, built with `go test -c`
*.test
Loading