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

Use golangci-lint #808

Merged
merged 3 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ ratings:
# You can globally exclude files from being analyzed by any engine using the
# exclude_paths key.

#exclude_paths:
#- spec/**/*
#- vendor/**/*
# exclude_paths:
# - spec/**/*
# - vendor/**/*
101 changes: 101 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
linters:
enabled:
- revive
- unparam
disable: []

issues:
exclude-rules:
- path: cli/update.go
linters:
- staticcheck
- path: tools/timeoutcmd/timeoutcmd.go
linters:
- staticcheck
- govet
- path: bitrise/print.go
linters:
- ineffassign
- gosimple
- path: tools/tools_test.go
linters:
- ineffassign
- path: bitrise/template_utils_test.go
linters:
- ineffassign
- path: cli/run_util.go
linters:
- ineffassign
- gosimple
- path: cli/run_util_test.go
linters:
- ineffassign
- path: cli/run.go
linters:
- deadcode
- varcheck
- path: cli/run_test.go
linters:
- ineffassign
- path: cli/flags.go
linters:
- deadcode
- unused
- varcheck
- path: cli/step_info.go
linters:
- gosimple
- path: cli/step_list.go
linters:
- gosimple
- path: cli/version.go
linters:
- gosimple
- path: cli/trigger_check.go
linters:
- gosimple
- path: cli/workflow_list.go
linters:
- gosimple
- path: bitrise/template_utils_test.go
linters:
- ineffassign
- path: bitrise/util.go
linters:
- gosimple
- path: bitrise/util_test.go
linters:
- ineffassign
- path: models/models_methods.go
linters:
- ineffassign
- path: plugins/run.go
linters:
- ineffassign
- deadcode
- path: toolkits/swift.go
linters:
- ineffassign
- path: configs/configs.go
linters:
- gosimple
- path: analytics/tracker.go
linters:
- gosimple
- path: tools/filterwriter/range.go
linters:
- gosimple
- path: plugins/git.go
linters:
- deadcode
- unused
- path: plugins/models_methods.go
linters:
- deadcode
- unused
- path: plugins/plugins.go
linters:
- gosimple
- linters:
- staticcheck
text: "SA4006:" # this value of ... is never used
14 changes: 7 additions & 7 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,28 @@ release:
### Install or upgrade

To install this version, run the following command (in a bash shell):

```bash
curl -fL https://github.com/bitrise-io/{{ .ProjectName }}/releases/download/{{ .Tag }}/{{ .ProjectName }}-"$(uname -s)"-"$(uname -m)" > /usr/local/bin/{{ .ProjectName }}
```
ℹ️ M1 machine: Please note by default `/usr/local/bin` does not exist on M1 machines and isn't encouraged by the community over `/opt/bin`. Use a custom folder path or use your own `bin` folder path. i.e `/opt/bin`

Then:

```
chmod +x /usr/local/bin/{{ .ProjectName }}
```

That's all, you're ready to call `{{ .ProjectName }}`!

checksum:
name_template: 'checksums.txt'
name_template: checksums.txt
snapshot:
# Run `goreleaser release --snapshot` locally to create binaries without publishing and checks
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- "^docs:"
- "'^test:"
4 changes: 2 additions & 2 deletions _tests/brew_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ workflows:
brew test bitrise
all:
before_run:
- reinstall
- check
- reinstall
- check
12 changes: 6 additions & 6 deletions _tests/integration/async_step_test_bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ workflows:
after_run: []
envs: []
steps:
- script:
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
- script:
inputs:
- content: |-
#!/usr/bin/env bash
set -ex

nc -l 9000 &
nc -l 9000 &
11 changes: 5 additions & 6 deletions _tests/integration/bash_toolkit_step_template/bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ workflows:
inputs:
- example_step_input: Example Step Input's value


# ----------------------------------------------------------------
# --- workflows to Share this step into a Step Library
share-this-step:
envs:
# if you want to share this step into a StepLib
- MY_STEPLIB_REPO_FORK_GIT_URL:
- STEP_ID_IN_STEPLIB:
- STEP_GIT_VERION_TAG_TO_SHARE:
- STEP_GIT_CLONE_URL:
# if you want to share this step into a StepLib
- MY_STEPLIB_REPO_FORK_GIT_URL:
- STEP_ID_IN_STEPLIB:
- STEP_GIT_VERION_TAG_TO_SHARE:
- STEP_GIT_CLONE_URL:
description: |-
If this is the first time you try to share a Step you should
first call: $ bitrise share
Expand Down
54 changes: 27 additions & 27 deletions _tests/integration/bash_toolkit_step_template/step.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
title: "STEP TEMPLATE"
title: STEP TEMPLATE
summary: A short summary of the step. Don't make it too long ;)
description: |-
This is a Step template.
Expand All @@ -17,43 +17,43 @@ website: https://github.com/...
source_code_url: https://github.com/...
support_url: https://github.com/.../issues
host_os_tags:
- osx-10.10
- osx-10.10
project_type_tags:
- ios
- ios
type_tags:
- script
- script
is_requires_admin_user: true
is_always_run: false
is_skippable: false
dependencies:
- manager: brew
name: git
- manager: brew
name: git
run_if: ""
toolkit:
bash:
entry_file: step_entry.sh
inputs:
- example_step_input: Default Value - you can leave this empty if you want to
opts:
title: "Example Step Input"
summary: Summary. No more than 2-3 sentences.
description: |
Description of this input.
- example_step_input: Default Value - you can leave this empty if you want to
opts:
title: Example Step Input
summary: Summary. No more than 2-3 sentences.
description: |
Description of this input.

Can be Markdown formatted text.
is_expand: false
is_required: true
is_dont_change_value: true
value_options: []
Can be Markdown formatted text.
is_expand: false
is_required: true
is_dont_change_value: true
value_options: []
outputs:
- EXAMPLE_STEP_OUTPUT:
opts:
title: "Example Step Output"
summary: Summary. No more than 2-3 sentences.
description: |
Description of this output.
- EXAMPLE_STEP_OUTPUT:
opts:
title: Example Step Output
summary: Summary. No more than 2-3 sentences.
description: |
Description of this output.

Can be Markdown formatted text.
is_expand: false
is_required: true
is_dont_change_value: true
Can be Markdown formatted text.
is_expand: false
is_required: true
is_dont_change_value: true
14 changes: 7 additions & 7 deletions _tests/integration/envstore_test_bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ workflows:
if [ $output_envstore_json != "{}" ] ; then
echo "Should be: {}"
echo "But got: $output_envstore_json"
exit 1
exit 1
fi

envman add --key OUTPUT1 --value output1
Expand All @@ -22,14 +22,14 @@ workflows:
if [ $OUTPUT1 != "output1" ] ; then
echo "Should be: output1"
echo "But got: $OUTPUT1"
exit 1
exit 1
fi

output_envstore_json=$(envman --path $ENVMAN_ENVSTORE_PATH print --format json)
if [ $output_envstore_json != "{}" ] ; then
echo "Should be: {}"
echo "But got: $output_envstore_json"
exit 1
exit 1
fi

envman add --key OUTPUT2 --value output2
Expand All @@ -39,18 +39,18 @@ workflows:
if [ $OUTPUT1 != "output1" ] ; then
echo "Should be: output1"
echo "But got: $OUTPUT1"
exit 1
exit 1
fi

if [ $OUTPUT2 != "output2" ] ; then
echo "Should be: output2"
echo "But got: $OUTPUT2"
exit 1
exit 1
fi

output_envstore_json=$(envman --path $ENVMAN_ENVSTORE_PATH print --format json)
if [ $output_envstore_json != "{}" ] ; then
echo "Should be: {}"
echo "But got: $output_envstore_json"
exit 1
fi
exit 1
fi
10 changes: 5 additions & 5 deletions _tests/integration/exit_code_test_bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ format_version: 1.3.0
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

trigger_map:
- pattern: "exit_code_test_fail"
- pattern: exit_code_test_fail
is_pull_request_allowed: true
workflow: exit_code_test_fail
- pattern: "exit_code_test_ok"
- pattern: exit_code_test_ok
is_pull_request_allowed: true
workflow: exit_code_test_ok
- pattern: "exit_code_test_sippable_fail"
- pattern: exit_code_test_sippable_fail
is_pull_request_allowed: true
workflow: exit_code_test_sippable_fail
- pattern: "exit_code_test_sippable_ok"
- pattern: exit_code_test_sippable_ok
is_pull_request_allowed: true
workflow: exit_code_test_sippable_ok

Expand Down Expand Up @@ -48,4 +48,4 @@ workflows:
title: Exit code of bitrise CLI should be 0
is_skippable: true
inputs:
- content: exit 0
- content: exit 0
2 changes: 1 addition & 1 deletion _tests/integration/global_flag_test_bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ workflows:
- script:
run_if: not .IsCI
inputs:
- content: exit 1
- content: exit 1
2 changes: 1 addition & 1 deletion _tests/integration/global_flag_test_secrets.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
envs:
- PR: false
- PULL_REQUEST_ID: ""
- CI: false
- CI: false
11 changes: 5 additions & 6 deletions _tests/integration/go_toolkit_step_template/bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ workflows:
inputs:
- example_step_input: Example Step Input's value


# ----------------------------------------------------------------
# --- workflows to Share this step into a Step Library
share-this-step:
envs:
# if you want to share this step into a StepLib
- MY_STEPLIB_REPO_FORK_GIT_URL:
- STEP_ID_IN_STEPLIB:
- STEP_GIT_VERION_TAG_TO_SHARE:
- STEP_GIT_CLONE_URL:
# if you want to share this step into a StepLib
- MY_STEPLIB_REPO_FORK_GIT_URL:
- STEP_ID_IN_STEPLIB:
- STEP_GIT_VERION_TAG_TO_SHARE:
- STEP_GIT_CLONE_URL:
description: |-
If this is the first time you try to share a Step you should
first call: $ bitrise share
Expand Down
Loading