> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/sast-and-sca/prezero/static-analysis-sast/analyzing-applications/ruby.md).

# Ruby (Beta)

This article shows you how to analyze your applications written in Ruby using Qwiet AI by Harness. It assumes that you have already [set up and authenticated](broken://spaces/uPVBkglG6gsk2SsnsKgG/pages/fDfomI4jhzwCNFxmGSLc) with Qwiet.

## Requirements <a href="#requirements" id="requirements"></a>

See [Prerequisites](broken://spaces/uPVBkglG6gsk2SsnsKgG/pages/0c1ezDgaUil5NxR4VnY3#language-support-and-requirements) for more information.

## Analyzing your Ruby application <a href="#analyzing-your-ruby-application" id="analyzing-your-ruby-application"></a>

![](/files/mlZo7QhbBaWAQlpvEVi9)note

Qwiet offers a [sample application](https://github.com/ShiftLeftSecurity/shiftleft-ruby-demo) that you can use to run and test Qwiet AI by Harness. It also includes a functioning configuration file to demonstrate how you can leverage GitHub Actions to automate code analysis whenever you open a new Pull Request (PR).

To analyze your Ruby application, run:

```
sl analyze --app <name> --ruby <path>
```

![](/files/DfHDmRpYn5HJOmhRtTva) ![](/files/P5vj8JOtHNJWVEvAqKym)

| Parameter      | Description                                                                                                                                                                                                                            |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--app <name>` | The name of the application to be analyzed (maximum length: 100 characters)                                                                                                                                                            |
| `--ruby`       | The flag identifying the application's language                                                                                                                                                                                        |
| `<path>`       | The path to your project. If you're executing `sl analyze` in the package's directory, you can pass in shorthands like `.`. You can also use `/<absolute-path-of-directory-of-package>` or `./...` (current project and sub-projects). |

See the [CLI reference](broken://spaces/4t03gua31tHpZwtcczPO/pages/bfq0NtVB7O7f6pFvFzK3) for additional `sl analyze` options.

### Scanning for open-source vulnerabilities <a href="#scanning-for-open-source-vulnerabilities" id="scanning-for-open-source-vulnerabilities"></a>

For [SCA](/sast-and-sca/prezero/oss-vulnerabilities.md), Qwiet looks for information about open-source packages in the project path you provided when running `sl analyze`. Depending on how your project repo is structured, you may also need to provide an additional configuration option so that Qwiet AI by Harness can identify where your dependencies are located (for example, if you're running `sl analyze` for a package other than `.`, please use `--oss-project-dir <project-dir>` to specify the location of the `<project-dir>` directory where `Gemfile` or `Gemfile.lock` is located).

### Sample usage <a href="#sample-usage" id="sample-usage"></a>

```
sl analyze --app shiftleft-ruby-demo --ruby .
```

![](/files/DfHDmRpYn5HJOmhRtTva) ![](/files/P5vj8JOtHNJWVEvAqKym)

### Additional parameters <a href="#additional-parameters" id="additional-parameters"></a>

The analysis accepts additional parameters after a double hyphen `--`.

| Additional parameter | Description                                                       |
| -------------------- | ----------------------------------------------------------------- |
| `--exclude`          | Exclude packages by exact match on full package path              |
| `--exclude-regex`    | Exclude packages with paths matching the given regular expression |

Such parameters, if valid, are passed directly to the Ruby analyzer.

### Sample usage of additional parameters <a href="#sample-usage-of-additional-parameters" id="sample-usage-of-additional-parameters"></a>

To ignore a specific file like `lib/encryption.rb` from the analysis:

```
sl analyze --app <name> --ruby [<path>] -- --exclude 'lib/encryption.rb'
```

![](/files/DfHDmRpYn5HJOmhRtTva) ![](/files/P5vj8JOtHNJWVEvAqKym)

## Tagging results with your branch name <a href="#tagging-results-with-your-branch-name" id="tagging-results-with-your-branch-name"></a>

To include the branch name in your Qwiet AI by Harness results, allowing you to distinguish one set of results from another, add the following to your invocation of Qwiet:

```
sl analyze --tag branch=$(git symbolic-ref --short HEAD)
```

![](/files/DfHDmRpYn5HJOmhRtTva) ![](/files/P5vj8JOtHNJWVEvAqKym)

If you're working in a GitHub environment (e.g., [GitHub Actions](https://github.com/features/actions)), you can also use `--tag branch=${{ github.head_ref }}` to populate your branch name.

If you don't provide a branch name, but Qwiet detects one available in your environment, it will use that name.

## Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

If you have any issues scanning your project, please see our [general troubleshooting page](/sast-and-sca/prezero/tutorials/troubleshooting.md).
