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

doc: Improve CLI parameters DOCS-180 #92

Merged
merged 2 commits into from
Dec 13, 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
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,19 @@ To use the GitHub Action with Codacy integration:

5. Optionally, [enable the GitHub integration](https://docs.codacy.com/repositories-configure/integrations/github-integration/) on Codacy to have information about the analysis of the changed files directly on your pull requests.

## Extra configurations
## Parameters

The Codacy GitHub Action is a wrapper for running the [Codacy Analysis CLI](https://github.com/codacy/codacy-analysis-cli) and supports [the same parameters as the command `analyze`](https://github.com/codacy/codacy-analysis-cli#commands-and-configuration), with the following exceptions:
The Codacy GitHub Action is a wrapper for running the [Codacy Analysis CLI](https://github.com/codacy/codacy-analysis-cli). For a list of supported input parameters, see [`action.yml`](./action.yml). To pass input parameters to the action, [update the associated `with` map](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runsstepswith).

- `--commit-uuid` (the action always analyzes the commit that triggered it)
- `--username` and `--project` (the action automatically uses the owner and name of the repository when you specify the parameter `api-token`)
The following example limits analysis to a `src` directory and provides additional details by setting `verbose` to `true`.
nicklem marked this conversation as resolved.
Show resolved Hide resolved

```yaml
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@master
with:
directory: src
verbose: true
```

## Contributing

Expand Down
41 changes: 19 additions & 22 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,34 @@ inputs:
description: "API account token to retrieve your remote Codacy configuration for the project being analyzed"
codacy-api-base-url:
required: false
description: "Codacy's API URL, to retrieve your remote Codacy configuration"
description: "Codacy API URL to retrieve your remote Codacy configuration"
format:
required: false
description: "Format of the output file"
description: "Output file format"
output:
required: false
description: "Send analysis results to an output file"
description: "Path to a file to save the analysis results"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested this and I suspect that this only works for a local CLI analysis with file system access. It seems to timeout on a GitHub workflow.
Should this even be flagged as supported? Are there other options like this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps with the client side tools integration? Haven't tested that one...

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this either. 🤔 Let's keep this thread open and we'll check again with some more time later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I had a look at the workflow execution output, I'm thinking that perhaps it was something else that caused the GitHub Action to time out. 🤔

Could you please try running it again and see what happens?

Copy link
Contributor Author

@nicklem nicklem Dec 13, 2022

Choose a reason for hiding this comment

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

It indeed worked this time; it was another issue altogether.
I'm still not seeing the file, although there are mentions (here and here) in the logs. I assume that it's saved in some temporary container storage and then discarded.

Should we mention this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the file is probably created correctly at the end of the Codacy Analysis CLI run. But I don't think it's necessary to further clarify this, as it isn't even very clear why anyone would want to use this option (save for maybe uploading it as an artifact of the workflow that could then be consulted later for debugging purposes.).

directory:
required: false
description: "The directory to be analyzed"
description: "Directory to analyze"
parallel:
required: false
description: "Number of tools to run in parallel"
max-tool-memory:
required: false
description: "Maximum of allowed memory for each tool execution"
description: "Maximum allowed memory for running each tool (bytes)"
max-allowed-issues:
required: false
default: "2147483647"
description: "Maximum number of issues allowed for the analysis to succeed"
tool:
required: false
description: "The name of the tool to analyze the code"
description: >-
Only run a specific tool or tool category (metrics, issues, duplication).
For the full list of tools, see https://docs.codacy.com/repositories-configure/codacy-configuration-file/#which-tools-can-be-configured-and-which-name-should-i-use
tool-timeout:
required: false
description: "Maximum time each tool has to execute"
description: "Tool execution timeout (e.g. 15minutes, 1hour)"
upload:
required: false
description: "Upload analysis results to Codacy"
Expand All @@ -54,41 +56,36 @@ inputs:
description: "Fail the analysis if any tool fails to run"
allow-network:
required: false
description: "Allow network access for tools"
description: "Allow the tools to access the network"
force-file-permissions:
required: false
description: "Force files to be readable by changing the permissions before running the analysis"
gh-code-scanning-compat:
required: false
description: >-
Reduce issue severity by one level, for non-security issues, for compatibility with GitHub's code scanning feature.
This option will only have an effect when used in conjunction with '--format sarif'.
Reduce issue severity by one level for non-security issues, for compatibility with GitHub's code scanning feature.
This option only has an effect when used with 'format: sarif'.
run-docker-tools:
required: false
default: "true"
description: >-
Run dockerized tools. Possible values (true|false)
Check the full list in https://docs.codacy.com/repositories-configure/codacy-configuration-file/#which-tools-can-be-configured-and-which-name-should-i-use
Run all dockerized tools supported by Codacy.
For the full list of tools, see https://docs.codacy.com/repositories-configure/codacy-configuration-file/#which-tools-can-be-configured-and-which-name-should-i-use
run-gosec:
required: false
description: >-
Run GoSec. Possible values (true|false)
description: "Run Gosec"
run-staticcheck:
required: false
description: >-
Run StaticCheck. Possible values (true|false)
description: "Run Staticcheck"
clang-tidy-output:
required: false
description: >-
Path to a file containing the output of Clang Tidy.
description: "Path to a file containing the output of Clang-Tidy."
faux-pas-output:
required: false
description: >-
Path to a file containing the output of Faux Pas.
description: "Path to a file containing the output of Faux Pas."
skip-uncommitted-files-check:
required: false
description: >-
Skip validation on uncommitted changes
description: "Skip validation of uncommitted changes"
runs:
using: "composite"
steps:
Expand Down